github.com/argoproj/argo-cd@v1.8.7/pkg/apiclient/certificate/certificate.pb.gw.go (about)

     1  // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
     2  // source: server/certificate/certificate.proto
     3  
     4  /*
     5  Package certificate is a reverse proxy.
     6  
     7  It translates gRPC into RESTful JSON APIs.
     8  */
     9  package certificate
    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_CertificateService_ListCertificates_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
    36  )
    37  
    38  func request_CertificateService_ListCertificates_0(ctx context.Context, marshaler runtime.Marshaler, client CertificateServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
    39  	var protoReq RepositoryCertificateQuery
    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_CertificateService_ListCertificates_0); err != nil {
    46  		return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
    47  	}
    48  
    49  	msg, err := client.ListCertificates(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
    50  	return msg, metadata, err
    51  
    52  }
    53  
    54  func local_request_CertificateService_ListCertificates_0(ctx context.Context, marshaler runtime.Marshaler, server CertificateServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
    55  	var protoReq RepositoryCertificateQuery
    56  	var metadata runtime.ServerMetadata
    57  
    58  	if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_CertificateService_ListCertificates_0); err != nil {
    59  		return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
    60  	}
    61  
    62  	msg, err := server.ListCertificates(ctx, &protoReq)
    63  	return msg, metadata, err
    64  
    65  }
    66  
    67  var (
    68  	filter_CertificateService_CreateCertificate_0 = &utilities.DoubleArray{Encoding: map[string]int{"certificates": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}}
    69  )
    70  
    71  func request_CertificateService_CreateCertificate_0(ctx context.Context, marshaler runtime.Marshaler, client CertificateServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
    72  	var protoReq RepositoryCertificateCreateRequest
    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.Certificates); 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_CertificateService_CreateCertificate_0); err != nil {
    87  		return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
    88  	}
    89  
    90  	msg, err := client.CreateCertificate(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
    91  	return msg, metadata, err
    92  
    93  }
    94  
    95  func local_request_CertificateService_CreateCertificate_0(ctx context.Context, marshaler runtime.Marshaler, server CertificateServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
    96  	var protoReq RepositoryCertificateCreateRequest
    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.Certificates); 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_CertificateService_CreateCertificate_0); err != nil {
   108  		return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
   109  	}
   110  
   111  	msg, err := server.CreateCertificate(ctx, &protoReq)
   112  	return msg, metadata, err
   113  
   114  }
   115  
   116  var (
   117  	filter_CertificateService_DeleteCertificate_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
   118  )
   119  
   120  func request_CertificateService_DeleteCertificate_0(ctx context.Context, marshaler runtime.Marshaler, client CertificateServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
   121  	var protoReq RepositoryCertificateQuery
   122  	var metadata runtime.ServerMetadata
   123  
   124  	if err := req.ParseForm(); err != nil {
   125  		return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
   126  	}
   127  	if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_CertificateService_DeleteCertificate_0); err != nil {
   128  		return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
   129  	}
   130  
   131  	msg, err := client.DeleteCertificate(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
   132  	return msg, metadata, err
   133  
   134  }
   135  
   136  func local_request_CertificateService_DeleteCertificate_0(ctx context.Context, marshaler runtime.Marshaler, server CertificateServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
   137  	var protoReq RepositoryCertificateQuery
   138  	var metadata runtime.ServerMetadata
   139  
   140  	if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_CertificateService_DeleteCertificate_0); err != nil {
   141  		return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
   142  	}
   143  
   144  	msg, err := server.DeleteCertificate(ctx, &protoReq)
   145  	return msg, metadata, err
   146  
   147  }
   148  
   149  // RegisterCertificateServiceHandlerServer registers the http handlers for service CertificateService to "mux".
   150  // UnaryRPC     :call CertificateServiceServer directly.
   151  // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
   152  func RegisterCertificateServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server CertificateServiceServer) error {
   153  
   154  	mux.Handle("GET", pattern_CertificateService_ListCertificates_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
   155  		ctx, cancel := context.WithCancel(req.Context())
   156  		defer cancel()
   157  		inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
   158  		rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
   159  		if err != nil {
   160  			runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
   161  			return
   162  		}
   163  		resp, md, err := local_request_CertificateService_ListCertificates_0(rctx, inboundMarshaler, server, req, pathParams)
   164  		ctx = runtime.NewServerMetadataContext(ctx, md)
   165  		if err != nil {
   166  			runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
   167  			return
   168  		}
   169  
   170  		forward_CertificateService_ListCertificates_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
   171  
   172  	})
   173  
   174  	mux.Handle("POST", pattern_CertificateService_CreateCertificate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
   175  		ctx, cancel := context.WithCancel(req.Context())
   176  		defer cancel()
   177  		inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
   178  		rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
   179  		if err != nil {
   180  			runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
   181  			return
   182  		}
   183  		resp, md, err := local_request_CertificateService_CreateCertificate_0(rctx, inboundMarshaler, server, req, pathParams)
   184  		ctx = runtime.NewServerMetadataContext(ctx, md)
   185  		if err != nil {
   186  			runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
   187  			return
   188  		}
   189  
   190  		forward_CertificateService_CreateCertificate_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
   191  
   192  	})
   193  
   194  	mux.Handle("DELETE", pattern_CertificateService_DeleteCertificate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
   195  		ctx, cancel := context.WithCancel(req.Context())
   196  		defer cancel()
   197  		inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
   198  		rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
   199  		if err != nil {
   200  			runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
   201  			return
   202  		}
   203  		resp, md, err := local_request_CertificateService_DeleteCertificate_0(rctx, inboundMarshaler, server, req, pathParams)
   204  		ctx = runtime.NewServerMetadataContext(ctx, md)
   205  		if err != nil {
   206  			runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
   207  			return
   208  		}
   209  
   210  		forward_CertificateService_DeleteCertificate_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
   211  
   212  	})
   213  
   214  	return nil
   215  }
   216  
   217  // RegisterCertificateServiceHandlerFromEndpoint is same as RegisterCertificateServiceHandler but
   218  // automatically dials to "endpoint" and closes the connection when "ctx" gets done.
   219  func RegisterCertificateServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
   220  	conn, err := grpc.Dial(endpoint, opts...)
   221  	if err != nil {
   222  		return err
   223  	}
   224  	defer func() {
   225  		if err != nil {
   226  			if cerr := conn.Close(); cerr != nil {
   227  				grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
   228  			}
   229  			return
   230  		}
   231  		go func() {
   232  			<-ctx.Done()
   233  			if cerr := conn.Close(); cerr != nil {
   234  				grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
   235  			}
   236  		}()
   237  	}()
   238  
   239  	return RegisterCertificateServiceHandler(ctx, mux, conn)
   240  }
   241  
   242  // RegisterCertificateServiceHandler registers the http handlers for service CertificateService to "mux".
   243  // The handlers forward requests to the grpc endpoint over "conn".
   244  func RegisterCertificateServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
   245  	return RegisterCertificateServiceHandlerClient(ctx, mux, NewCertificateServiceClient(conn))
   246  }
   247  
   248  // RegisterCertificateServiceHandlerClient registers the http handlers for service CertificateService
   249  // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "CertificateServiceClient".
   250  // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "CertificateServiceClient"
   251  // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
   252  // "CertificateServiceClient" to call the correct interceptors.
   253  func RegisterCertificateServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client CertificateServiceClient) error {
   254  
   255  	mux.Handle("GET", pattern_CertificateService_ListCertificates_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
   256  		ctx, cancel := context.WithCancel(req.Context())
   257  		defer cancel()
   258  		inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
   259  		rctx, err := runtime.AnnotateContext(ctx, mux, req)
   260  		if err != nil {
   261  			runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
   262  			return
   263  		}
   264  		resp, md, err := request_CertificateService_ListCertificates_0(rctx, inboundMarshaler, client, req, pathParams)
   265  		ctx = runtime.NewServerMetadataContext(ctx, md)
   266  		if err != nil {
   267  			runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
   268  			return
   269  		}
   270  
   271  		forward_CertificateService_ListCertificates_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
   272  
   273  	})
   274  
   275  	mux.Handle("POST", pattern_CertificateService_CreateCertificate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
   276  		ctx, cancel := context.WithCancel(req.Context())
   277  		defer cancel()
   278  		inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
   279  		rctx, err := runtime.AnnotateContext(ctx, mux, req)
   280  		if err != nil {
   281  			runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
   282  			return
   283  		}
   284  		resp, md, err := request_CertificateService_CreateCertificate_0(rctx, inboundMarshaler, client, req, pathParams)
   285  		ctx = runtime.NewServerMetadataContext(ctx, md)
   286  		if err != nil {
   287  			runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
   288  			return
   289  		}
   290  
   291  		forward_CertificateService_CreateCertificate_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
   292  
   293  	})
   294  
   295  	mux.Handle("DELETE", pattern_CertificateService_DeleteCertificate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
   296  		ctx, cancel := context.WithCancel(req.Context())
   297  		defer cancel()
   298  		inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
   299  		rctx, err := runtime.AnnotateContext(ctx, mux, req)
   300  		if err != nil {
   301  			runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
   302  			return
   303  		}
   304  		resp, md, err := request_CertificateService_DeleteCertificate_0(rctx, inboundMarshaler, client, req, pathParams)
   305  		ctx = runtime.NewServerMetadataContext(ctx, md)
   306  		if err != nil {
   307  			runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
   308  			return
   309  		}
   310  
   311  		forward_CertificateService_DeleteCertificate_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
   312  
   313  	})
   314  
   315  	return nil
   316  }
   317  
   318  var (
   319  	pattern_CertificateService_ListCertificates_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "certificates"}, "", runtime.AssumeColonVerbOpt(true)))
   320  
   321  	pattern_CertificateService_CreateCertificate_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "certificates"}, "", runtime.AssumeColonVerbOpt(true)))
   322  
   323  	pattern_CertificateService_DeleteCertificate_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "certificates"}, "", runtime.AssumeColonVerbOpt(true)))
   324  )
   325  
   326  var (
   327  	forward_CertificateService_ListCertificates_0 = runtime.ForwardResponseMessage
   328  
   329  	forward_CertificateService_CreateCertificate_0 = runtime.ForwardResponseMessage
   330  
   331  	forward_CertificateService_DeleteCertificate_0 = runtime.ForwardResponseMessage
   332  )