github.com/argoproj/argo-cd@v1.8.7/pkg/apiclient/gpgkey/gpgkey.pb.gw.go (about) 1 // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. 2 // source: server/gpgkey/gpgkey.proto 3 4 /* 5 Package gpgkey is a reverse proxy. 6 7 It translates gRPC into RESTful JSON APIs. 8 */ 9 package gpgkey 10 11 import ( 12 "context" 13 "io" 14 "net/http" 15 16 "github.com/golang/protobuf/descriptor" 17 "github.com/golang/protobuf/proto" 18 "github.com/grpc-ecosystem/grpc-gateway/runtime" 19 "github.com/grpc-ecosystem/grpc-gateway/utilities" 20 "google.golang.org/grpc" 21 "google.golang.org/grpc/codes" 22 "google.golang.org/grpc/grpclog" 23 "google.golang.org/grpc/status" 24 ) 25 26 // Suppress "imported and not used" errors 27 var _ codes.Code 28 var _ io.Reader 29 var _ status.Status 30 var _ = runtime.String 31 var _ = utilities.NewDoubleArray 32 var _ = descriptor.ForMessage 33 34 var ( 35 filter_GPGKeyService_List_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} 36 ) 37 38 func request_GPGKeyService_List_0(ctx context.Context, marshaler runtime.Marshaler, client GPGKeyServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 39 var protoReq GnuPGPublicKeyQuery 40 var metadata runtime.ServerMetadata 41 42 if err := req.ParseForm(); err != nil { 43 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) 44 } 45 if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_GPGKeyService_List_0); err != nil { 46 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) 47 } 48 49 msg, err := client.List(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) 50 return msg, metadata, err 51 52 } 53 54 func local_request_GPGKeyService_List_0(ctx context.Context, marshaler runtime.Marshaler, server GPGKeyServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 55 var protoReq GnuPGPublicKeyQuery 56 var metadata runtime.ServerMetadata 57 58 if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_GPGKeyService_List_0); err != nil { 59 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) 60 } 61 62 msg, err := server.List(ctx, &protoReq) 63 return msg, metadata, err 64 65 } 66 67 func request_GPGKeyService_Get_0(ctx context.Context, marshaler runtime.Marshaler, client GPGKeyServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 68 var protoReq GnuPGPublicKeyQuery 69 var metadata runtime.ServerMetadata 70 71 var ( 72 val string 73 ok bool 74 err error 75 _ = err 76 ) 77 78 val, ok = pathParams["keyID"] 79 if !ok { 80 return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "keyID") 81 } 82 83 protoReq.KeyID, err = runtime.String(val) 84 85 if err != nil { 86 return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "keyID", err) 87 } 88 89 msg, err := client.Get(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) 90 return msg, metadata, err 91 92 } 93 94 func local_request_GPGKeyService_Get_0(ctx context.Context, marshaler runtime.Marshaler, server GPGKeyServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 95 var protoReq GnuPGPublicKeyQuery 96 var metadata runtime.ServerMetadata 97 98 var ( 99 val string 100 ok bool 101 err error 102 _ = err 103 ) 104 105 val, ok = pathParams["keyID"] 106 if !ok { 107 return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "keyID") 108 } 109 110 protoReq.KeyID, err = runtime.String(val) 111 112 if err != nil { 113 return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "keyID", err) 114 } 115 116 msg, err := server.Get(ctx, &protoReq) 117 return msg, metadata, err 118 119 } 120 121 var ( 122 filter_GPGKeyService_Create_0 = &utilities.DoubleArray{Encoding: map[string]int{"publickey": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} 123 ) 124 125 func request_GPGKeyService_Create_0(ctx context.Context, marshaler runtime.Marshaler, client GPGKeyServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 126 var protoReq GnuPGPublicKeyCreateRequest 127 var metadata runtime.ServerMetadata 128 129 newReader, berr := utilities.IOReaderFactory(req.Body) 130 if berr != nil { 131 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) 132 } 133 if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Publickey); err != nil && err != io.EOF { 134 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) 135 } 136 137 if err := req.ParseForm(); err != nil { 138 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) 139 } 140 if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_GPGKeyService_Create_0); err != nil { 141 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) 142 } 143 144 msg, err := client.Create(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) 145 return msg, metadata, err 146 147 } 148 149 func local_request_GPGKeyService_Create_0(ctx context.Context, marshaler runtime.Marshaler, server GPGKeyServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 150 var protoReq GnuPGPublicKeyCreateRequest 151 var metadata runtime.ServerMetadata 152 153 newReader, berr := utilities.IOReaderFactory(req.Body) 154 if berr != nil { 155 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) 156 } 157 if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Publickey); err != nil && err != io.EOF { 158 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) 159 } 160 161 if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_GPGKeyService_Create_0); err != nil { 162 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) 163 } 164 165 msg, err := server.Create(ctx, &protoReq) 166 return msg, metadata, err 167 168 } 169 170 var ( 171 filter_GPGKeyService_Delete_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} 172 ) 173 174 func request_GPGKeyService_Delete_0(ctx context.Context, marshaler runtime.Marshaler, client GPGKeyServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 175 var protoReq GnuPGPublicKeyQuery 176 var metadata runtime.ServerMetadata 177 178 if err := req.ParseForm(); err != nil { 179 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) 180 } 181 if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_GPGKeyService_Delete_0); err != nil { 182 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) 183 } 184 185 msg, err := client.Delete(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) 186 return msg, metadata, err 187 188 } 189 190 func local_request_GPGKeyService_Delete_0(ctx context.Context, marshaler runtime.Marshaler, server GPGKeyServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 191 var protoReq GnuPGPublicKeyQuery 192 var metadata runtime.ServerMetadata 193 194 if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_GPGKeyService_Delete_0); err != nil { 195 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) 196 } 197 198 msg, err := server.Delete(ctx, &protoReq) 199 return msg, metadata, err 200 201 } 202 203 // RegisterGPGKeyServiceHandlerServer registers the http handlers for service GPGKeyService to "mux". 204 // UnaryRPC :call GPGKeyServiceServer directly. 205 // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. 206 func RegisterGPGKeyServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server GPGKeyServiceServer) error { 207 208 mux.Handle("GET", pattern_GPGKeyService_List_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 209 ctx, cancel := context.WithCancel(req.Context()) 210 defer cancel() 211 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 212 rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) 213 if err != nil { 214 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 215 return 216 } 217 resp, md, err := local_request_GPGKeyService_List_0(rctx, inboundMarshaler, server, req, pathParams) 218 ctx = runtime.NewServerMetadataContext(ctx, md) 219 if err != nil { 220 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 221 return 222 } 223 224 forward_GPGKeyService_List_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 225 226 }) 227 228 mux.Handle("GET", pattern_GPGKeyService_Get_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 229 ctx, cancel := context.WithCancel(req.Context()) 230 defer cancel() 231 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 232 rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) 233 if err != nil { 234 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 235 return 236 } 237 resp, md, err := local_request_GPGKeyService_Get_0(rctx, inboundMarshaler, server, req, pathParams) 238 ctx = runtime.NewServerMetadataContext(ctx, md) 239 if err != nil { 240 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 241 return 242 } 243 244 forward_GPGKeyService_Get_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 245 246 }) 247 248 mux.Handle("POST", pattern_GPGKeyService_Create_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 249 ctx, cancel := context.WithCancel(req.Context()) 250 defer cancel() 251 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 252 rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) 253 if err != nil { 254 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 255 return 256 } 257 resp, md, err := local_request_GPGKeyService_Create_0(rctx, inboundMarshaler, server, req, pathParams) 258 ctx = runtime.NewServerMetadataContext(ctx, md) 259 if err != nil { 260 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 261 return 262 } 263 264 forward_GPGKeyService_Create_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 265 266 }) 267 268 mux.Handle("DELETE", pattern_GPGKeyService_Delete_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 269 ctx, cancel := context.WithCancel(req.Context()) 270 defer cancel() 271 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 272 rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) 273 if err != nil { 274 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 275 return 276 } 277 resp, md, err := local_request_GPGKeyService_Delete_0(rctx, inboundMarshaler, server, req, pathParams) 278 ctx = runtime.NewServerMetadataContext(ctx, md) 279 if err != nil { 280 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 281 return 282 } 283 284 forward_GPGKeyService_Delete_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 285 286 }) 287 288 return nil 289 } 290 291 // RegisterGPGKeyServiceHandlerFromEndpoint is same as RegisterGPGKeyServiceHandler but 292 // automatically dials to "endpoint" and closes the connection when "ctx" gets done. 293 func RegisterGPGKeyServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { 294 conn, err := grpc.Dial(endpoint, opts...) 295 if err != nil { 296 return err 297 } 298 defer func() { 299 if err != nil { 300 if cerr := conn.Close(); cerr != nil { 301 grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) 302 } 303 return 304 } 305 go func() { 306 <-ctx.Done() 307 if cerr := conn.Close(); cerr != nil { 308 grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) 309 } 310 }() 311 }() 312 313 return RegisterGPGKeyServiceHandler(ctx, mux, conn) 314 } 315 316 // RegisterGPGKeyServiceHandler registers the http handlers for service GPGKeyService to "mux". 317 // The handlers forward requests to the grpc endpoint over "conn". 318 func RegisterGPGKeyServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { 319 return RegisterGPGKeyServiceHandlerClient(ctx, mux, NewGPGKeyServiceClient(conn)) 320 } 321 322 // RegisterGPGKeyServiceHandlerClient registers the http handlers for service GPGKeyService 323 // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "GPGKeyServiceClient". 324 // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "GPGKeyServiceClient" 325 // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in 326 // "GPGKeyServiceClient" to call the correct interceptors. 327 func RegisterGPGKeyServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client GPGKeyServiceClient) error { 328 329 mux.Handle("GET", pattern_GPGKeyService_List_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 330 ctx, cancel := context.WithCancel(req.Context()) 331 defer cancel() 332 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 333 rctx, err := runtime.AnnotateContext(ctx, mux, req) 334 if err != nil { 335 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 336 return 337 } 338 resp, md, err := request_GPGKeyService_List_0(rctx, inboundMarshaler, client, req, pathParams) 339 ctx = runtime.NewServerMetadataContext(ctx, md) 340 if err != nil { 341 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 342 return 343 } 344 345 forward_GPGKeyService_List_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 346 347 }) 348 349 mux.Handle("GET", pattern_GPGKeyService_Get_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 350 ctx, cancel := context.WithCancel(req.Context()) 351 defer cancel() 352 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 353 rctx, err := runtime.AnnotateContext(ctx, mux, req) 354 if err != nil { 355 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 356 return 357 } 358 resp, md, err := request_GPGKeyService_Get_0(rctx, inboundMarshaler, client, req, pathParams) 359 ctx = runtime.NewServerMetadataContext(ctx, md) 360 if err != nil { 361 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 362 return 363 } 364 365 forward_GPGKeyService_Get_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 366 367 }) 368 369 mux.Handle("POST", pattern_GPGKeyService_Create_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 370 ctx, cancel := context.WithCancel(req.Context()) 371 defer cancel() 372 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 373 rctx, err := runtime.AnnotateContext(ctx, mux, req) 374 if err != nil { 375 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 376 return 377 } 378 resp, md, err := request_GPGKeyService_Create_0(rctx, inboundMarshaler, client, req, pathParams) 379 ctx = runtime.NewServerMetadataContext(ctx, md) 380 if err != nil { 381 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 382 return 383 } 384 385 forward_GPGKeyService_Create_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 386 387 }) 388 389 mux.Handle("DELETE", pattern_GPGKeyService_Delete_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 390 ctx, cancel := context.WithCancel(req.Context()) 391 defer cancel() 392 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 393 rctx, err := runtime.AnnotateContext(ctx, mux, req) 394 if err != nil { 395 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 396 return 397 } 398 resp, md, err := request_GPGKeyService_Delete_0(rctx, inboundMarshaler, client, req, pathParams) 399 ctx = runtime.NewServerMetadataContext(ctx, md) 400 if err != nil { 401 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 402 return 403 } 404 405 forward_GPGKeyService_Delete_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 406 407 }) 408 409 return nil 410 } 411 412 var ( 413 pattern_GPGKeyService_List_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "gpgkeys"}, "", runtime.AssumeColonVerbOpt(true))) 414 415 pattern_GPGKeyService_Get_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"api", "v1", "gpgkeys", "keyID"}, "", runtime.AssumeColonVerbOpt(true))) 416 417 pattern_GPGKeyService_Create_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "gpgkeys"}, "", runtime.AssumeColonVerbOpt(true))) 418 419 pattern_GPGKeyService_Delete_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "gpgkeys"}, "", runtime.AssumeColonVerbOpt(true))) 420 ) 421 422 var ( 423 forward_GPGKeyService_List_0 = runtime.ForwardResponseMessage 424 425 forward_GPGKeyService_Get_0 = runtime.ForwardResponseMessage 426 427 forward_GPGKeyService_Create_0 = runtime.ForwardResponseMessage 428 429 forward_GPGKeyService_Delete_0 = runtime.ForwardResponseMessage 430 )