github.com/argoproj/argo-cd@v1.8.7/pkg/apiclient/repocreds/repocreds.pb.gw.go (about) 1 // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. 2 // source: server/repocreds/repocreds.proto 3 4 /* 5 Package repocreds is a reverse proxy. 6 7 It translates gRPC into RESTful JSON APIs. 8 */ 9 package repocreds 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_RepoCredsService_ListRepositoryCredentials_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} 36 ) 37 38 func request_RepoCredsService_ListRepositoryCredentials_0(ctx context.Context, marshaler runtime.Marshaler, client RepoCredsServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 39 var protoReq RepoCredsQuery 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_RepoCredsService_ListRepositoryCredentials_0); err != nil { 46 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) 47 } 48 49 msg, err := client.ListRepositoryCredentials(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) 50 return msg, metadata, err 51 52 } 53 54 func local_request_RepoCredsService_ListRepositoryCredentials_0(ctx context.Context, marshaler runtime.Marshaler, server RepoCredsServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 55 var protoReq RepoCredsQuery 56 var metadata runtime.ServerMetadata 57 58 if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_RepoCredsService_ListRepositoryCredentials_0); err != nil { 59 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) 60 } 61 62 msg, err := server.ListRepositoryCredentials(ctx, &protoReq) 63 return msg, metadata, err 64 65 } 66 67 var ( 68 filter_RepoCredsService_CreateRepositoryCredentials_0 = &utilities.DoubleArray{Encoding: map[string]int{"creds": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} 69 ) 70 71 func request_RepoCredsService_CreateRepositoryCredentials_0(ctx context.Context, marshaler runtime.Marshaler, client RepoCredsServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 72 var protoReq RepoCredsCreateRequest 73 var metadata runtime.ServerMetadata 74 75 newReader, berr := utilities.IOReaderFactory(req.Body) 76 if berr != nil { 77 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) 78 } 79 if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Creds); err != nil && err != io.EOF { 80 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) 81 } 82 83 if err := req.ParseForm(); err != nil { 84 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) 85 } 86 if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_RepoCredsService_CreateRepositoryCredentials_0); err != nil { 87 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) 88 } 89 90 msg, err := client.CreateRepositoryCredentials(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) 91 return msg, metadata, err 92 93 } 94 95 func local_request_RepoCredsService_CreateRepositoryCredentials_0(ctx context.Context, marshaler runtime.Marshaler, server RepoCredsServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 96 var protoReq RepoCredsCreateRequest 97 var metadata runtime.ServerMetadata 98 99 newReader, berr := utilities.IOReaderFactory(req.Body) 100 if berr != nil { 101 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) 102 } 103 if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Creds); err != nil && err != io.EOF { 104 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) 105 } 106 107 if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_RepoCredsService_CreateRepositoryCredentials_0); err != nil { 108 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) 109 } 110 111 msg, err := server.CreateRepositoryCredentials(ctx, &protoReq) 112 return msg, metadata, err 113 114 } 115 116 func request_RepoCredsService_UpdateRepositoryCredentials_0(ctx context.Context, marshaler runtime.Marshaler, client RepoCredsServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 117 var protoReq RepoCredsUpdateRequest 118 var metadata runtime.ServerMetadata 119 120 newReader, berr := utilities.IOReaderFactory(req.Body) 121 if berr != nil { 122 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) 123 } 124 if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Creds); err != nil && err != io.EOF { 125 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) 126 } 127 128 var ( 129 val string 130 ok bool 131 err error 132 _ = err 133 ) 134 135 val, ok = pathParams["creds.url"] 136 if !ok { 137 return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "creds.url") 138 } 139 140 err = runtime.PopulateFieldFromPath(&protoReq, "creds.url", val) 141 142 if err != nil { 143 return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "creds.url", err) 144 } 145 146 msg, err := client.UpdateRepositoryCredentials(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) 147 return msg, metadata, err 148 149 } 150 151 func local_request_RepoCredsService_UpdateRepositoryCredentials_0(ctx context.Context, marshaler runtime.Marshaler, server RepoCredsServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 152 var protoReq RepoCredsUpdateRequest 153 var metadata runtime.ServerMetadata 154 155 newReader, berr := utilities.IOReaderFactory(req.Body) 156 if berr != nil { 157 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) 158 } 159 if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Creds); err != nil && err != io.EOF { 160 return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) 161 } 162 163 var ( 164 val string 165 ok bool 166 err error 167 _ = err 168 ) 169 170 val, ok = pathParams["creds.url"] 171 if !ok { 172 return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "creds.url") 173 } 174 175 err = runtime.PopulateFieldFromPath(&protoReq, "creds.url", val) 176 177 if err != nil { 178 return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "creds.url", err) 179 } 180 181 msg, err := server.UpdateRepositoryCredentials(ctx, &protoReq) 182 return msg, metadata, err 183 184 } 185 186 func request_RepoCredsService_DeleteRepositoryCredentials_0(ctx context.Context, marshaler runtime.Marshaler, client RepoCredsServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 187 var protoReq RepoCredsDeleteRequest 188 var metadata runtime.ServerMetadata 189 190 var ( 191 val string 192 ok bool 193 err error 194 _ = err 195 ) 196 197 val, ok = pathParams["url"] 198 if !ok { 199 return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "url") 200 } 201 202 protoReq.Url, err = runtime.String(val) 203 204 if err != nil { 205 return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "url", err) 206 } 207 208 msg, err := client.DeleteRepositoryCredentials(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) 209 return msg, metadata, err 210 211 } 212 213 func local_request_RepoCredsService_DeleteRepositoryCredentials_0(ctx context.Context, marshaler runtime.Marshaler, server RepoCredsServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 214 var protoReq RepoCredsDeleteRequest 215 var metadata runtime.ServerMetadata 216 217 var ( 218 val string 219 ok bool 220 err error 221 _ = err 222 ) 223 224 val, ok = pathParams["url"] 225 if !ok { 226 return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "url") 227 } 228 229 protoReq.Url, err = runtime.String(val) 230 231 if err != nil { 232 return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "url", err) 233 } 234 235 msg, err := server.DeleteRepositoryCredentials(ctx, &protoReq) 236 return msg, metadata, err 237 238 } 239 240 // RegisterRepoCredsServiceHandlerServer registers the http handlers for service RepoCredsService to "mux". 241 // UnaryRPC :call RepoCredsServiceServer directly. 242 // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. 243 func RegisterRepoCredsServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server RepoCredsServiceServer) error { 244 245 mux.Handle("GET", pattern_RepoCredsService_ListRepositoryCredentials_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 246 ctx, cancel := context.WithCancel(req.Context()) 247 defer cancel() 248 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 249 rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) 250 if err != nil { 251 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 252 return 253 } 254 resp, md, err := local_request_RepoCredsService_ListRepositoryCredentials_0(rctx, inboundMarshaler, server, req, pathParams) 255 ctx = runtime.NewServerMetadataContext(ctx, md) 256 if err != nil { 257 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 258 return 259 } 260 261 forward_RepoCredsService_ListRepositoryCredentials_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 262 263 }) 264 265 mux.Handle("POST", pattern_RepoCredsService_CreateRepositoryCredentials_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 266 ctx, cancel := context.WithCancel(req.Context()) 267 defer cancel() 268 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 269 rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) 270 if err != nil { 271 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 272 return 273 } 274 resp, md, err := local_request_RepoCredsService_CreateRepositoryCredentials_0(rctx, inboundMarshaler, server, req, pathParams) 275 ctx = runtime.NewServerMetadataContext(ctx, md) 276 if err != nil { 277 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 278 return 279 } 280 281 forward_RepoCredsService_CreateRepositoryCredentials_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 282 283 }) 284 285 mux.Handle("PUT", pattern_RepoCredsService_UpdateRepositoryCredentials_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 286 ctx, cancel := context.WithCancel(req.Context()) 287 defer cancel() 288 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 289 rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) 290 if err != nil { 291 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 292 return 293 } 294 resp, md, err := local_request_RepoCredsService_UpdateRepositoryCredentials_0(rctx, inboundMarshaler, server, req, pathParams) 295 ctx = runtime.NewServerMetadataContext(ctx, md) 296 if err != nil { 297 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 298 return 299 } 300 301 forward_RepoCredsService_UpdateRepositoryCredentials_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 302 303 }) 304 305 mux.Handle("DELETE", pattern_RepoCredsService_DeleteRepositoryCredentials_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 306 ctx, cancel := context.WithCancel(req.Context()) 307 defer cancel() 308 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 309 rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) 310 if err != nil { 311 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 312 return 313 } 314 resp, md, err := local_request_RepoCredsService_DeleteRepositoryCredentials_0(rctx, inboundMarshaler, server, req, pathParams) 315 ctx = runtime.NewServerMetadataContext(ctx, md) 316 if err != nil { 317 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 318 return 319 } 320 321 forward_RepoCredsService_DeleteRepositoryCredentials_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 322 323 }) 324 325 return nil 326 } 327 328 // RegisterRepoCredsServiceHandlerFromEndpoint is same as RegisterRepoCredsServiceHandler but 329 // automatically dials to "endpoint" and closes the connection when "ctx" gets done. 330 func RegisterRepoCredsServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { 331 conn, err := grpc.Dial(endpoint, opts...) 332 if err != nil { 333 return err 334 } 335 defer func() { 336 if err != nil { 337 if cerr := conn.Close(); cerr != nil { 338 grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) 339 } 340 return 341 } 342 go func() { 343 <-ctx.Done() 344 if cerr := conn.Close(); cerr != nil { 345 grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) 346 } 347 }() 348 }() 349 350 return RegisterRepoCredsServiceHandler(ctx, mux, conn) 351 } 352 353 // RegisterRepoCredsServiceHandler registers the http handlers for service RepoCredsService to "mux". 354 // The handlers forward requests to the grpc endpoint over "conn". 355 func RegisterRepoCredsServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { 356 return RegisterRepoCredsServiceHandlerClient(ctx, mux, NewRepoCredsServiceClient(conn)) 357 } 358 359 // RegisterRepoCredsServiceHandlerClient registers the http handlers for service RepoCredsService 360 // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "RepoCredsServiceClient". 361 // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "RepoCredsServiceClient" 362 // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in 363 // "RepoCredsServiceClient" to call the correct interceptors. 364 func RegisterRepoCredsServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client RepoCredsServiceClient) error { 365 366 mux.Handle("GET", pattern_RepoCredsService_ListRepositoryCredentials_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 367 ctx, cancel := context.WithCancel(req.Context()) 368 defer cancel() 369 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 370 rctx, err := runtime.AnnotateContext(ctx, mux, req) 371 if err != nil { 372 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 373 return 374 } 375 resp, md, err := request_RepoCredsService_ListRepositoryCredentials_0(rctx, inboundMarshaler, client, req, pathParams) 376 ctx = runtime.NewServerMetadataContext(ctx, md) 377 if err != nil { 378 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 379 return 380 } 381 382 forward_RepoCredsService_ListRepositoryCredentials_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 383 384 }) 385 386 mux.Handle("POST", pattern_RepoCredsService_CreateRepositoryCredentials_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 387 ctx, cancel := context.WithCancel(req.Context()) 388 defer cancel() 389 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 390 rctx, err := runtime.AnnotateContext(ctx, mux, req) 391 if err != nil { 392 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 393 return 394 } 395 resp, md, err := request_RepoCredsService_CreateRepositoryCredentials_0(rctx, inboundMarshaler, client, req, pathParams) 396 ctx = runtime.NewServerMetadataContext(ctx, md) 397 if err != nil { 398 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 399 return 400 } 401 402 forward_RepoCredsService_CreateRepositoryCredentials_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 403 404 }) 405 406 mux.Handle("PUT", pattern_RepoCredsService_UpdateRepositoryCredentials_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 407 ctx, cancel := context.WithCancel(req.Context()) 408 defer cancel() 409 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 410 rctx, err := runtime.AnnotateContext(ctx, mux, req) 411 if err != nil { 412 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 413 return 414 } 415 resp, md, err := request_RepoCredsService_UpdateRepositoryCredentials_0(rctx, inboundMarshaler, client, req, pathParams) 416 ctx = runtime.NewServerMetadataContext(ctx, md) 417 if err != nil { 418 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 419 return 420 } 421 422 forward_RepoCredsService_UpdateRepositoryCredentials_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 423 424 }) 425 426 mux.Handle("DELETE", pattern_RepoCredsService_DeleteRepositoryCredentials_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 427 ctx, cancel := context.WithCancel(req.Context()) 428 defer cancel() 429 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 430 rctx, err := runtime.AnnotateContext(ctx, mux, req) 431 if err != nil { 432 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 433 return 434 } 435 resp, md, err := request_RepoCredsService_DeleteRepositoryCredentials_0(rctx, inboundMarshaler, client, req, pathParams) 436 ctx = runtime.NewServerMetadataContext(ctx, md) 437 if err != nil { 438 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 439 return 440 } 441 442 forward_RepoCredsService_DeleteRepositoryCredentials_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 443 444 }) 445 446 return nil 447 } 448 449 var ( 450 pattern_RepoCredsService_ListRepositoryCredentials_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "repocreds"}, "", runtime.AssumeColonVerbOpt(true))) 451 452 pattern_RepoCredsService_CreateRepositoryCredentials_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "repocreds"}, "", runtime.AssumeColonVerbOpt(true))) 453 454 pattern_RepoCredsService_UpdateRepositoryCredentials_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"api", "v1", "repocreds", "creds.url"}, "", runtime.AssumeColonVerbOpt(true))) 455 456 pattern_RepoCredsService_DeleteRepositoryCredentials_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"api", "v1", "repocreds", "url"}, "", runtime.AssumeColonVerbOpt(true))) 457 ) 458 459 var ( 460 forward_RepoCredsService_ListRepositoryCredentials_0 = runtime.ForwardResponseMessage 461 462 forward_RepoCredsService_CreateRepositoryCredentials_0 = runtime.ForwardResponseMessage 463 464 forward_RepoCredsService_UpdateRepositoryCredentials_0 = runtime.ForwardResponseMessage 465 466 forward_RepoCredsService_DeleteRepositoryCredentials_0 = runtime.ForwardResponseMessage 467 )