go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/examples/appengine/quotabeta/proto/service.pb.go (about)

     1  // Copyright 2022 The LUCI Authors. All rights reserved.
     2  // Use of this source code is governed under the Apache License, Version 2.0
     3  // that can be found in the LICENSE file.
     4  
     5  // Code generated by protoc-gen-go. DO NOT EDIT.
     6  // versions:
     7  // 	protoc-gen-go v1.31.0
     8  // 	protoc        v3.21.7
     9  // source: go.chromium.org/luci/examples/appengine/quotabeta/proto/service.proto
    10  
    11  package proto
    12  
    13  import prpc "go.chromium.org/luci/grpc/prpc"
    14  
    15  import (
    16  	context "context"
    17  	grpc "google.golang.org/grpc"
    18  	codes "google.golang.org/grpc/codes"
    19  	status "google.golang.org/grpc/status"
    20  	protoreflect "google.golang.org/protobuf/reflect/protoreflect"
    21  	protoimpl "google.golang.org/protobuf/runtime/protoimpl"
    22  	emptypb "google.golang.org/protobuf/types/known/emptypb"
    23  	reflect "reflect"
    24  )
    25  
    26  const (
    27  	// Verify that this generated code is sufficiently up-to-date.
    28  	_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
    29  	// Verify that runtime/protoimpl is sufficiently up-to-date.
    30  	_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
    31  )
    32  
    33  var File_go_chromium_org_luci_examples_appengine_quotabeta_proto_service_proto protoreflect.FileDescriptor
    34  
    35  var file_go_chromium_org_luci_examples_appengine_quotabeta_proto_service_proto_rawDesc = []byte{
    36  	0x0a, 0x45, 0x67, 0x6f, 0x2e, 0x63, 0x68, 0x72, 0x6f, 0x6d, 0x69, 0x75, 0x6d, 0x2e, 0x6f, 0x72,
    37  	0x67, 0x2f, 0x6c, 0x75, 0x63, 0x69, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f,
    38  	0x61, 0x70, 0x70, 0x65, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x2f, 0x71, 0x75, 0x6f, 0x74, 0x61, 0x62,
    39  	0x65, 0x74, 0x61, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63,
    40  	0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, 0x72, 0x70, 0x63, 0x1a, 0x1b, 0x67, 0x6f,
    41  	0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d,
    42  	0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x96, 0x02, 0x0a, 0x04, 0x44, 0x65,
    43  	0x6d, 0x6f, 0x12, 0x41, 0x0a, 0x0f, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x52, 0x61, 0x74, 0x65,
    44  	0x4c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70,
    45  	0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x16, 0x2e,
    46  	0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e,
    47  	0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x42, 0x0a, 0x10, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x51,
    48  	0x75, 0x6f, 0x74, 0x61, 0x52, 0x65, 0x73, 0x65, 0x74, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67,
    49  	0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74,
    50  	0x79, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
    51  	0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x42, 0x0a, 0x10, 0x50, 0x65, 0x72,
    52  	0x55, 0x73, 0x65, 0x72, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x16, 0x2e,
    53  	0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e,
    54  	0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70,
    55  	0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x43, 0x0a,
    56  	0x11, 0x50, 0x65, 0x72, 0x55, 0x73, 0x65, 0x72, 0x51, 0x75, 0x6f, 0x74, 0x61, 0x52, 0x65, 0x73,
    57  	0x65, 0x74, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
    58  	0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f,
    59  	0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70,
    60  	0x74, 0x79, 0x42, 0x39, 0x5a, 0x37, 0x67, 0x6f, 0x2e, 0x63, 0x68, 0x72, 0x6f, 0x6d, 0x69, 0x75,
    61  	0x6d, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x6c, 0x75, 0x63, 0x69, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70,
    62  	0x6c, 0x65, 0x73, 0x2f, 0x61, 0x70, 0x70, 0x65, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x2f, 0x71, 0x75,
    63  	0x6f, 0x74, 0x61, 0x62, 0x65, 0x74, 0x61, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70,
    64  	0x72, 0x6f, 0x74, 0x6f, 0x33,
    65  }
    66  
    67  var file_go_chromium_org_luci_examples_appengine_quotabeta_proto_service_proto_goTypes = []interface{}{
    68  	(*emptypb.Empty)(nil), // 0: google.protobuf.Empty
    69  }
    70  var file_go_chromium_org_luci_examples_appengine_quotabeta_proto_service_proto_depIdxs = []int32{
    71  	0, // 0: rpc.Demo.GlobalRateLimit:input_type -> google.protobuf.Empty
    72  	0, // 1: rpc.Demo.GlobalQuotaReset:input_type -> google.protobuf.Empty
    73  	0, // 2: rpc.Demo.PerUserRateLimit:input_type -> google.protobuf.Empty
    74  	0, // 3: rpc.Demo.PerUserQuotaReset:input_type -> google.protobuf.Empty
    75  	0, // 4: rpc.Demo.GlobalRateLimit:output_type -> google.protobuf.Empty
    76  	0, // 5: rpc.Demo.GlobalQuotaReset:output_type -> google.protobuf.Empty
    77  	0, // 6: rpc.Demo.PerUserRateLimit:output_type -> google.protobuf.Empty
    78  	0, // 7: rpc.Demo.PerUserQuotaReset:output_type -> google.protobuf.Empty
    79  	4, // [4:8] is the sub-list for method output_type
    80  	0, // [0:4] is the sub-list for method input_type
    81  	0, // [0:0] is the sub-list for extension type_name
    82  	0, // [0:0] is the sub-list for extension extendee
    83  	0, // [0:0] is the sub-list for field type_name
    84  }
    85  
    86  func init() { file_go_chromium_org_luci_examples_appengine_quotabeta_proto_service_proto_init() }
    87  func file_go_chromium_org_luci_examples_appengine_quotabeta_proto_service_proto_init() {
    88  	if File_go_chromium_org_luci_examples_appengine_quotabeta_proto_service_proto != nil {
    89  		return
    90  	}
    91  	type x struct{}
    92  	out := protoimpl.TypeBuilder{
    93  		File: protoimpl.DescBuilder{
    94  			GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
    95  			RawDescriptor: file_go_chromium_org_luci_examples_appengine_quotabeta_proto_service_proto_rawDesc,
    96  			NumEnums:      0,
    97  			NumMessages:   0,
    98  			NumExtensions: 0,
    99  			NumServices:   1,
   100  		},
   101  		GoTypes:           file_go_chromium_org_luci_examples_appengine_quotabeta_proto_service_proto_goTypes,
   102  		DependencyIndexes: file_go_chromium_org_luci_examples_appengine_quotabeta_proto_service_proto_depIdxs,
   103  	}.Build()
   104  	File_go_chromium_org_luci_examples_appengine_quotabeta_proto_service_proto = out.File
   105  	file_go_chromium_org_luci_examples_appengine_quotabeta_proto_service_proto_rawDesc = nil
   106  	file_go_chromium_org_luci_examples_appengine_quotabeta_proto_service_proto_goTypes = nil
   107  	file_go_chromium_org_luci_examples_appengine_quotabeta_proto_service_proto_depIdxs = nil
   108  }
   109  
   110  // Reference imports to suppress errors if they are not otherwise used.
   111  var _ context.Context
   112  var _ grpc.ClientConnInterface
   113  
   114  // This is a compile-time assertion to ensure that this generated file
   115  // is compatible with the grpc package it is being compiled against.
   116  const _ = grpc.SupportPackageIsVersion6
   117  
   118  // DemoClient is the client API for Demo service.
   119  //
   120  // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
   121  type DemoClient interface {
   122  	// GlobalRateLimit is an endpoint globally limited to one request every 60
   123  	// seconds. This quota can be reset at any time by calling GlobalQuotaReset.
   124  	GlobalRateLimit(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error)
   125  	// GlobalQuotaReset resets quota for calling GlobalRateLimit.
   126  	GlobalQuotaReset(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error)
   127  	// PerUserRateLimit is an endpoint limited to two requests every 60 seconds
   128  	// from any given user. Users can reset their own quota at any time by calling
   129  	// PerUserQuotaReset.
   130  	PerUserRateLimit(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error)
   131  	// PerUserQuotaReset resets the caller's quota for calling PerUserRateLimit.
   132  	PerUserQuotaReset(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error)
   133  }
   134  type demoPRPCClient struct {
   135  	client *prpc.Client
   136  }
   137  
   138  func NewDemoPRPCClient(client *prpc.Client) DemoClient {
   139  	return &demoPRPCClient{client}
   140  }
   141  
   142  func (c *demoPRPCClient) GlobalRateLimit(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error) {
   143  	out := new(emptypb.Empty)
   144  	err := c.client.Call(ctx, "rpc.Demo", "GlobalRateLimit", in, out, opts...)
   145  	if err != nil {
   146  		return nil, err
   147  	}
   148  	return out, nil
   149  }
   150  
   151  func (c *demoPRPCClient) GlobalQuotaReset(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error) {
   152  	out := new(emptypb.Empty)
   153  	err := c.client.Call(ctx, "rpc.Demo", "GlobalQuotaReset", in, out, opts...)
   154  	if err != nil {
   155  		return nil, err
   156  	}
   157  	return out, nil
   158  }
   159  
   160  func (c *demoPRPCClient) PerUserRateLimit(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error) {
   161  	out := new(emptypb.Empty)
   162  	err := c.client.Call(ctx, "rpc.Demo", "PerUserRateLimit", in, out, opts...)
   163  	if err != nil {
   164  		return nil, err
   165  	}
   166  	return out, nil
   167  }
   168  
   169  func (c *demoPRPCClient) PerUserQuotaReset(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error) {
   170  	out := new(emptypb.Empty)
   171  	err := c.client.Call(ctx, "rpc.Demo", "PerUserQuotaReset", in, out, opts...)
   172  	if err != nil {
   173  		return nil, err
   174  	}
   175  	return out, nil
   176  }
   177  
   178  type demoClient struct {
   179  	cc grpc.ClientConnInterface
   180  }
   181  
   182  func NewDemoClient(cc grpc.ClientConnInterface) DemoClient {
   183  	return &demoClient{cc}
   184  }
   185  
   186  func (c *demoClient) GlobalRateLimit(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error) {
   187  	out := new(emptypb.Empty)
   188  	err := c.cc.Invoke(ctx, "/rpc.Demo/GlobalRateLimit", in, out, opts...)
   189  	if err != nil {
   190  		return nil, err
   191  	}
   192  	return out, nil
   193  }
   194  
   195  func (c *demoClient) GlobalQuotaReset(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error) {
   196  	out := new(emptypb.Empty)
   197  	err := c.cc.Invoke(ctx, "/rpc.Demo/GlobalQuotaReset", in, out, opts...)
   198  	if err != nil {
   199  		return nil, err
   200  	}
   201  	return out, nil
   202  }
   203  
   204  func (c *demoClient) PerUserRateLimit(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error) {
   205  	out := new(emptypb.Empty)
   206  	err := c.cc.Invoke(ctx, "/rpc.Demo/PerUserRateLimit", in, out, opts...)
   207  	if err != nil {
   208  		return nil, err
   209  	}
   210  	return out, nil
   211  }
   212  
   213  func (c *demoClient) PerUserQuotaReset(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error) {
   214  	out := new(emptypb.Empty)
   215  	err := c.cc.Invoke(ctx, "/rpc.Demo/PerUserQuotaReset", in, out, opts...)
   216  	if err != nil {
   217  		return nil, err
   218  	}
   219  	return out, nil
   220  }
   221  
   222  // DemoServer is the server API for Demo service.
   223  type DemoServer interface {
   224  	// GlobalRateLimit is an endpoint globally limited to one request every 60
   225  	// seconds. This quota can be reset at any time by calling GlobalQuotaReset.
   226  	GlobalRateLimit(context.Context, *emptypb.Empty) (*emptypb.Empty, error)
   227  	// GlobalQuotaReset resets quota for calling GlobalRateLimit.
   228  	GlobalQuotaReset(context.Context, *emptypb.Empty) (*emptypb.Empty, error)
   229  	// PerUserRateLimit is an endpoint limited to two requests every 60 seconds
   230  	// from any given user. Users can reset their own quota at any time by calling
   231  	// PerUserQuotaReset.
   232  	PerUserRateLimit(context.Context, *emptypb.Empty) (*emptypb.Empty, error)
   233  	// PerUserQuotaReset resets the caller's quota for calling PerUserRateLimit.
   234  	PerUserQuotaReset(context.Context, *emptypb.Empty) (*emptypb.Empty, error)
   235  }
   236  
   237  // UnimplementedDemoServer can be embedded to have forward compatible implementations.
   238  type UnimplementedDemoServer struct {
   239  }
   240  
   241  func (*UnimplementedDemoServer) GlobalRateLimit(context.Context, *emptypb.Empty) (*emptypb.Empty, error) {
   242  	return nil, status.Errorf(codes.Unimplemented, "method GlobalRateLimit not implemented")
   243  }
   244  func (*UnimplementedDemoServer) GlobalQuotaReset(context.Context, *emptypb.Empty) (*emptypb.Empty, error) {
   245  	return nil, status.Errorf(codes.Unimplemented, "method GlobalQuotaReset not implemented")
   246  }
   247  func (*UnimplementedDemoServer) PerUserRateLimit(context.Context, *emptypb.Empty) (*emptypb.Empty, error) {
   248  	return nil, status.Errorf(codes.Unimplemented, "method PerUserRateLimit not implemented")
   249  }
   250  func (*UnimplementedDemoServer) PerUserQuotaReset(context.Context, *emptypb.Empty) (*emptypb.Empty, error) {
   251  	return nil, status.Errorf(codes.Unimplemented, "method PerUserQuotaReset not implemented")
   252  }
   253  
   254  func RegisterDemoServer(s prpc.Registrar, srv DemoServer) {
   255  	s.RegisterService(&_Demo_serviceDesc, srv)
   256  }
   257  
   258  func _Demo_GlobalRateLimit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   259  	in := new(emptypb.Empty)
   260  	if err := dec(in); err != nil {
   261  		return nil, err
   262  	}
   263  	if interceptor == nil {
   264  		return srv.(DemoServer).GlobalRateLimit(ctx, in)
   265  	}
   266  	info := &grpc.UnaryServerInfo{
   267  		Server:     srv,
   268  		FullMethod: "/rpc.Demo/GlobalRateLimit",
   269  	}
   270  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   271  		return srv.(DemoServer).GlobalRateLimit(ctx, req.(*emptypb.Empty))
   272  	}
   273  	return interceptor(ctx, in, info, handler)
   274  }
   275  
   276  func _Demo_GlobalQuotaReset_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   277  	in := new(emptypb.Empty)
   278  	if err := dec(in); err != nil {
   279  		return nil, err
   280  	}
   281  	if interceptor == nil {
   282  		return srv.(DemoServer).GlobalQuotaReset(ctx, in)
   283  	}
   284  	info := &grpc.UnaryServerInfo{
   285  		Server:     srv,
   286  		FullMethod: "/rpc.Demo/GlobalQuotaReset",
   287  	}
   288  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   289  		return srv.(DemoServer).GlobalQuotaReset(ctx, req.(*emptypb.Empty))
   290  	}
   291  	return interceptor(ctx, in, info, handler)
   292  }
   293  
   294  func _Demo_PerUserRateLimit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   295  	in := new(emptypb.Empty)
   296  	if err := dec(in); err != nil {
   297  		return nil, err
   298  	}
   299  	if interceptor == nil {
   300  		return srv.(DemoServer).PerUserRateLimit(ctx, in)
   301  	}
   302  	info := &grpc.UnaryServerInfo{
   303  		Server:     srv,
   304  		FullMethod: "/rpc.Demo/PerUserRateLimit",
   305  	}
   306  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   307  		return srv.(DemoServer).PerUserRateLimit(ctx, req.(*emptypb.Empty))
   308  	}
   309  	return interceptor(ctx, in, info, handler)
   310  }
   311  
   312  func _Demo_PerUserQuotaReset_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   313  	in := new(emptypb.Empty)
   314  	if err := dec(in); err != nil {
   315  		return nil, err
   316  	}
   317  	if interceptor == nil {
   318  		return srv.(DemoServer).PerUserQuotaReset(ctx, in)
   319  	}
   320  	info := &grpc.UnaryServerInfo{
   321  		Server:     srv,
   322  		FullMethod: "/rpc.Demo/PerUserQuotaReset",
   323  	}
   324  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   325  		return srv.(DemoServer).PerUserQuotaReset(ctx, req.(*emptypb.Empty))
   326  	}
   327  	return interceptor(ctx, in, info, handler)
   328  }
   329  
   330  var _Demo_serviceDesc = grpc.ServiceDesc{
   331  	ServiceName: "rpc.Demo",
   332  	HandlerType: (*DemoServer)(nil),
   333  	Methods: []grpc.MethodDesc{
   334  		{
   335  			MethodName: "GlobalRateLimit",
   336  			Handler:    _Demo_GlobalRateLimit_Handler,
   337  		},
   338  		{
   339  			MethodName: "GlobalQuotaReset",
   340  			Handler:    _Demo_GlobalQuotaReset_Handler,
   341  		},
   342  		{
   343  			MethodName: "PerUserRateLimit",
   344  			Handler:    _Demo_PerUserRateLimit_Handler,
   345  		},
   346  		{
   347  			MethodName: "PerUserQuotaReset",
   348  			Handler:    _Demo_PerUserQuotaReset_Handler,
   349  		},
   350  	},
   351  	Streams:  []grpc.StreamDesc{},
   352  	Metadata: "go.chromium.org/luci/examples/appengine/quotabeta/proto/service.proto",
   353  }