go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/auth/loginsessionspb/service_grpc.pb.go (about) 1 // Copyright 2022 The LUCI Authors. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 // Code generated by protoc-gen-go-grpc. DO NOT EDIT. 16 // versions: 17 // - protoc-gen-go-grpc v1.3.0 18 // - protoc v3.21.7 19 // source: go.chromium.org/luci/auth/loginsessionspb/service.proto 20 21 package loginsessionspb 22 23 import ( 24 context "context" 25 grpc "google.golang.org/grpc" 26 codes "google.golang.org/grpc/codes" 27 status "google.golang.org/grpc/status" 28 ) 29 30 // This is a compile-time assertion to ensure that this generated file 31 // is compatible with the grpc package it is being compiled against. 32 // Requires gRPC-Go v1.32.0 or later. 33 const _ = grpc.SupportPackageIsVersion7 34 35 const ( 36 LoginSessions_CreateLoginSession_FullMethodName = "/luci.auth.loginsessions.LoginSessions/CreateLoginSession" 37 LoginSessions_GetLoginSession_FullMethodName = "/luci.auth.loginsessions.LoginSessions/GetLoginSession" 38 ) 39 40 // LoginSessionsClient is the client API for LoginSessions service. 41 // 42 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. 43 type LoginSessionsClient interface { 44 // CreateLoginSession creates a new login session in PENDING state. 45 // 46 // The returned message contains a new session with auto-generated random `id` 47 // and `password`. It's the only reply that has `password` populated. Both 48 // `id` and `password` are needed to get the up-to-date state of the session 49 // in GetLoginSession. 50 // 51 // Returns: 52 // 53 // INVALID_ARGUMENT: when missing required fields. 54 // PERMISSION_DENIED: when `oauth_client_id` is not recognized or some 55 // requested scopes are forbidden from use. 56 CreateLoginSession(ctx context.Context, in *CreateLoginSessionRequest, opts ...grpc.CallOption) (*LoginSession, error) 57 // GetLoginSession returns the current up-to-date state of a login session. 58 // 59 // The state changes based on interaction with the user in the browser (via 60 // a flow launched by visiting `login_flow_url`) and with passage of time. 61 // 62 // Returns: 63 // 64 // INVALID_ARGUMENT: when missing required fields. 65 // NOT_FOUND: if the session is not found, expired long time ago or the 66 // password doesn't match. 67 GetLoginSession(ctx context.Context, in *GetLoginSessionRequest, opts ...grpc.CallOption) (*LoginSession, error) 68 } 69 70 type loginSessionsClient struct { 71 cc grpc.ClientConnInterface 72 } 73 74 func NewLoginSessionsClient(cc grpc.ClientConnInterface) LoginSessionsClient { 75 return &loginSessionsClient{cc} 76 } 77 78 func (c *loginSessionsClient) CreateLoginSession(ctx context.Context, in *CreateLoginSessionRequest, opts ...grpc.CallOption) (*LoginSession, error) { 79 out := new(LoginSession) 80 err := c.cc.Invoke(ctx, LoginSessions_CreateLoginSession_FullMethodName, in, out, opts...) 81 if err != nil { 82 return nil, err 83 } 84 return out, nil 85 } 86 87 func (c *loginSessionsClient) GetLoginSession(ctx context.Context, in *GetLoginSessionRequest, opts ...grpc.CallOption) (*LoginSession, error) { 88 out := new(LoginSession) 89 err := c.cc.Invoke(ctx, LoginSessions_GetLoginSession_FullMethodName, in, out, opts...) 90 if err != nil { 91 return nil, err 92 } 93 return out, nil 94 } 95 96 // LoginSessionsServer is the server API for LoginSessions service. 97 // All implementations must embed UnimplementedLoginSessionsServer 98 // for forward compatibility 99 type LoginSessionsServer interface { 100 // CreateLoginSession creates a new login session in PENDING state. 101 // 102 // The returned message contains a new session with auto-generated random `id` 103 // and `password`. It's the only reply that has `password` populated. Both 104 // `id` and `password` are needed to get the up-to-date state of the session 105 // in GetLoginSession. 106 // 107 // Returns: 108 // 109 // INVALID_ARGUMENT: when missing required fields. 110 // PERMISSION_DENIED: when `oauth_client_id` is not recognized or some 111 // requested scopes are forbidden from use. 112 CreateLoginSession(context.Context, *CreateLoginSessionRequest) (*LoginSession, error) 113 // GetLoginSession returns the current up-to-date state of a login session. 114 // 115 // The state changes based on interaction with the user in the browser (via 116 // a flow launched by visiting `login_flow_url`) and with passage of time. 117 // 118 // Returns: 119 // 120 // INVALID_ARGUMENT: when missing required fields. 121 // NOT_FOUND: if the session is not found, expired long time ago or the 122 // password doesn't match. 123 GetLoginSession(context.Context, *GetLoginSessionRequest) (*LoginSession, error) 124 mustEmbedUnimplementedLoginSessionsServer() 125 } 126 127 // UnimplementedLoginSessionsServer must be embedded to have forward compatible implementations. 128 type UnimplementedLoginSessionsServer struct { 129 } 130 131 func (UnimplementedLoginSessionsServer) CreateLoginSession(context.Context, *CreateLoginSessionRequest) (*LoginSession, error) { 132 return nil, status.Errorf(codes.Unimplemented, "method CreateLoginSession not implemented") 133 } 134 func (UnimplementedLoginSessionsServer) GetLoginSession(context.Context, *GetLoginSessionRequest) (*LoginSession, error) { 135 return nil, status.Errorf(codes.Unimplemented, "method GetLoginSession not implemented") 136 } 137 func (UnimplementedLoginSessionsServer) mustEmbedUnimplementedLoginSessionsServer() {} 138 139 // UnsafeLoginSessionsServer may be embedded to opt out of forward compatibility for this service. 140 // Use of this interface is not recommended, as added methods to LoginSessionsServer will 141 // result in compilation errors. 142 type UnsafeLoginSessionsServer interface { 143 mustEmbedUnimplementedLoginSessionsServer() 144 } 145 146 func RegisterLoginSessionsServer(s grpc.ServiceRegistrar, srv LoginSessionsServer) { 147 s.RegisterService(&LoginSessions_ServiceDesc, srv) 148 } 149 150 func _LoginSessions_CreateLoginSession_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 151 in := new(CreateLoginSessionRequest) 152 if err := dec(in); err != nil { 153 return nil, err 154 } 155 if interceptor == nil { 156 return srv.(LoginSessionsServer).CreateLoginSession(ctx, in) 157 } 158 info := &grpc.UnaryServerInfo{ 159 Server: srv, 160 FullMethod: LoginSessions_CreateLoginSession_FullMethodName, 161 } 162 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 163 return srv.(LoginSessionsServer).CreateLoginSession(ctx, req.(*CreateLoginSessionRequest)) 164 } 165 return interceptor(ctx, in, info, handler) 166 } 167 168 func _LoginSessions_GetLoginSession_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 169 in := new(GetLoginSessionRequest) 170 if err := dec(in); err != nil { 171 return nil, err 172 } 173 if interceptor == nil { 174 return srv.(LoginSessionsServer).GetLoginSession(ctx, in) 175 } 176 info := &grpc.UnaryServerInfo{ 177 Server: srv, 178 FullMethod: LoginSessions_GetLoginSession_FullMethodName, 179 } 180 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 181 return srv.(LoginSessionsServer).GetLoginSession(ctx, req.(*GetLoginSessionRequest)) 182 } 183 return interceptor(ctx, in, info, handler) 184 } 185 186 // LoginSessions_ServiceDesc is the grpc.ServiceDesc for LoginSessions service. 187 // It's only intended for direct use with grpc.RegisterService, 188 // and not to be introspected or modified (even as a copy) 189 var LoginSessions_ServiceDesc = grpc.ServiceDesc{ 190 ServiceName: "luci.auth.loginsessions.LoginSessions", 191 HandlerType: (*LoginSessionsServer)(nil), 192 Methods: []grpc.MethodDesc{ 193 { 194 MethodName: "CreateLoginSession", 195 Handler: _LoginSessions_CreateLoginSession_Handler, 196 }, 197 { 198 MethodName: "GetLoginSession", 199 Handler: _LoginSessions_GetLoginSession_Handler, 200 }, 201 }, 202 Streams: []grpc.StreamDesc{}, 203 Metadata: "go.chromium.org/luci/auth/loginsessionspb/service.proto", 204 }