chore(API): add set/remove alias suffix API definitions (#6757)
* chore: add set/remove alias suffix API definitions * fix(test): revert alias_test changes * revert alias_test.go changes
This commit is contained in:
1 parent
6f03523372
commit
969bd5f66d
8 files changed
+891
-46
No files matched your search
@@ -492,6 +492,96 @@ func local_request_ScopeService_DetachStoragePolicy_0(ctx context.Context, marsh
|
||||
return msg, metadata, err
|
||||
}
|
||||
|
||||
func request_ScopeService_SetAliasSuffix_0(ctx context.Context, marshaler runtime.Marshaler, client ScopeServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
protoReq SetAliasSuffixRequest
|
||||
metadata runtime.ServerMetadata
|
||||
err error
|
||||
)
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if req.Body != nil {
|
||||
_, _ = io.Copy(io.Discard, req.Body)
|
||||
}
|
||||
val, ok := pathParams["id"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
|
||||
}
|
||||
protoReq.Id, err = runtime.String(val)
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
|
||||
}
|
||||
msg, err := client.SetAliasSuffix(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
}
|
||||
|
||||
func local_request_ScopeService_SetAliasSuffix_0(ctx context.Context, marshaler runtime.Marshaler, server ScopeServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
protoReq SetAliasSuffixRequest
|
||||
metadata runtime.ServerMetadata
|
||||
err error
|
||||
)
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
val, ok := pathParams["id"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
|
||||
}
|
||||
protoReq.Id, err = runtime.String(val)
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
|
||||
}
|
||||
msg, err := server.SetAliasSuffix(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
}
|
||||
|
||||
func request_ScopeService_RemoveAliasSuffix_0(ctx context.Context, marshaler runtime.Marshaler, client ScopeServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
protoReq RemoveAliasSuffixRequest
|
||||
metadata runtime.ServerMetadata
|
||||
err error
|
||||
)
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if req.Body != nil {
|
||||
_, _ = io.Copy(io.Discard, req.Body)
|
||||
}
|
||||
val, ok := pathParams["id"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
|
||||
}
|
||||
protoReq.Id, err = runtime.String(val)
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
|
||||
}
|
||||
msg, err := client.RemoveAliasSuffix(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
}
|
||||
|
||||
func local_request_ScopeService_RemoveAliasSuffix_0(ctx context.Context, marshaler runtime.Marshaler, server ScopeServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
protoReq RemoveAliasSuffixRequest
|
||||
metadata runtime.ServerMetadata
|
||||
err error
|
||||
)
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
val, ok := pathParams["id"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
|
||||
}
|
||||
protoReq.Id, err = runtime.String(val)
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
|
||||
}
|
||||
msg, err := server.RemoveAliasSuffix(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
}
|
||||
|
||||
// RegisterScopeServiceHandlerServer registers the http handlers for service ScopeService to "mux".
|
||||
// UnaryRPC :call ScopeServiceServer directly.
|
||||
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
|
||||
@@ -718,6 +808,46 @@ func RegisterScopeServiceHandlerServer(ctx context.Context, mux *runtime.ServeMu
|
||||
}
|
||||
forward_ScopeService_DetachStoragePolicy_0(annotatedContext, mux, outboundMarshaler, w, req, response_ScopeService_DetachStoragePolicy_0{resp.(*DetachStoragePolicyResponse)}, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
mux.Handle(http.MethodPost, pattern_ScopeService_SetAliasSuffix_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.ScopeService/SetAliasSuffix", runtime.WithHTTPPathPattern("/v1/scopes/{id}:set-alias-suffix"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_ScopeService_SetAliasSuffix_0(annotatedContext, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
forward_ScopeService_SetAliasSuffix_0(annotatedContext, mux, outboundMarshaler, w, req, response_ScopeService_SetAliasSuffix_0{resp.(*SetAliasSuffixResponse)}, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
mux.Handle(http.MethodPost, pattern_ScopeService_RemoveAliasSuffix_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.ScopeService/RemoveAliasSuffix", runtime.WithHTTPPathPattern("/v1/scopes/{id}:remove-alias-suffix"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_ScopeService_RemoveAliasSuffix_0(annotatedContext, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
forward_ScopeService_RemoveAliasSuffix_0(annotatedContext, mux, outboundMarshaler, w, req, response_ScopeService_RemoveAliasSuffix_0{resp.(*RemoveAliasSuffixResponse)}, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -945,6 +1075,40 @@ func RegisterScopeServiceHandlerClient(ctx context.Context, mux *runtime.ServeMu
|
||||
}
|
||||
forward_ScopeService_DetachStoragePolicy_0(annotatedContext, mux, outboundMarshaler, w, req, response_ScopeService_DetachStoragePolicy_0{resp.(*DetachStoragePolicyResponse)}, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
mux.Handle(http.MethodPost, pattern_ScopeService_SetAliasSuffix_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.ScopeService/SetAliasSuffix", runtime.WithHTTPPathPattern("/v1/scopes/{id}:set-alias-suffix"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_ScopeService_SetAliasSuffix_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
forward_ScopeService_SetAliasSuffix_0(annotatedContext, mux, outboundMarshaler, w, req, response_ScopeService_SetAliasSuffix_0{resp.(*SetAliasSuffixResponse)}, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
mux.Handle(http.MethodPost, pattern_ScopeService_RemoveAliasSuffix_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.ScopeService/RemoveAliasSuffix", runtime.WithHTTPPathPattern("/v1/scopes/{id}:remove-alias-suffix"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_ScopeService_RemoveAliasSuffix_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
forward_ScopeService_RemoveAliasSuffix_0(annotatedContext, mux, outboundMarshaler, w, req, response_ScopeService_RemoveAliasSuffix_0{resp.(*RemoveAliasSuffixResponse)}, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -993,6 +1157,24 @@ func (m response_ScopeService_DetachStoragePolicy_0) XXX_ResponseBody() interfac
|
||||
return response.Item
|
||||
}
|
||||
|
||||
type response_ScopeService_SetAliasSuffix_0 struct {
|
||||
*SetAliasSuffixResponse
|
||||
}
|
||||
|
||||
func (m response_ScopeService_SetAliasSuffix_0) XXX_ResponseBody() interface{} {
|
||||
response := m.SetAliasSuffixResponse
|
||||
return response.Item
|
||||
}
|
||||
|
||||
type response_ScopeService_RemoveAliasSuffix_0 struct {
|
||||
*RemoveAliasSuffixResponse
|
||||
}
|
||||
|
||||
func (m response_ScopeService_RemoveAliasSuffix_0) XXX_ResponseBody() interface{} {
|
||||
response := m.RemoveAliasSuffixResponse
|
||||
return response.Item
|
||||
}
|
||||
|
||||
var (
|
||||
pattern_ScopeService_GetScope_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v1", "scopes", "id"}, ""))
|
||||
pattern_ScopeService_ListScopes_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "scopes"}, ""))
|
||||
@@ -1005,6 +1187,8 @@ var (
|
||||
pattern_ScopeService_DestroyKeyVersion_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "scopes"}, "destroy-key-version"))
|
||||
pattern_ScopeService_AttachStoragePolicy_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v1", "scopes", "id"}, "attach-storage-policy"))
|
||||
pattern_ScopeService_DetachStoragePolicy_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v1", "scopes", "id"}, "detach-storage-policy"))
|
||||
pattern_ScopeService_SetAliasSuffix_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v1", "scopes", "id"}, "set-alias-suffix"))
|
||||
pattern_ScopeService_RemoveAliasSuffix_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v1", "scopes", "id"}, "remove-alias-suffix"))
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -1019,4 +1203,6 @@ var (
|
||||
forward_ScopeService_DestroyKeyVersion_0 = runtime.ForwardResponseMessage
|
||||
forward_ScopeService_AttachStoragePolicy_0 = runtime.ForwardResponseMessage
|
||||
forward_ScopeService_DetachStoragePolicy_0 = runtime.ForwardResponseMessage
|
||||
forward_ScopeService_SetAliasSuffix_0 = runtime.ForwardResponseMessage
|
||||
forward_ScopeService_RemoveAliasSuffix_0 = runtime.ForwardResponseMessage
|
||||
)
|
||||
Reference in new issue
Block a user