From 15374f1380e1deb078379723ba8074bec2718017 Mon Sep 17 00:00:00 2001 From: Sonali Wale <86949270+sonali523@users.noreply.github.com> Date: Tue, 8 Feb 2022 18:44:23 +0530 Subject: [PATCH] Get migration staged data API (#6673) * Get migration staged data API added Signed-off-by: sonali wale * Minor changes added Signed-off-by: sonali wale * Modified the response type Signed-off-by: sonali wale * Test cases added Signed-off-by: sonali wale * Updated test cases Signed-off-by: sonali wale * Updated parsed data Signed-off-by: sonali wale * json tag updated Signed-off-by: sonali wale --- .studio/infra-proxy-service | 8 + .../migrations/migrations.pb.client_mock.go | 78 ++- .../infra_proxy/migrations/migrations.pb.go | 181 ++++--- .../migrations/migrations.pb.gw.go | 102 +++- .../migrations/migrations.pb.policy.go | 15 +- .../infra_proxy/migrations/migrations.proto | 10 +- .../migrations/migrations.swagger.json | 131 ++++- .../migrations/request/migrations.pb.go | 127 +++-- .../migrations/request/migrations.proto | 7 +- .../migrations/response/migrations.pb.go | 461 +++++++++++++++-- .../migrations/response/migrations.proto | 47 +- .../migrations/request/migrations.pb.go | 130 +++-- .../migrations/request/migrations.proto | 7 +- .../migrations/response/migrations.pb.go | 462 ++++++++++++++++-- .../migrations/response/migrations.proto | 47 +- .../migrations/service/migrations.pb.go | 151 ++++-- .../migrations/service/migrations.proto | 5 +- .../api/migrations.pb.swagger.go | 131 ++++- .../infra_proxy/migrations/migrations.go | 59 ++- .../integration_test/migrations.json | 98 ++++ .../integration_test/migrations_test.go | 26 + .../integration_test/suite_test.go | 25 +- .../migrations/migrations.go | 89 +++- .../migrations/migrations_test.go | 49 +- .../migrations/pipeline/models.go | 2 +- .../infra-proxy-service/pipeline/models.go | 14 +- .../migration/sql/07_migration.up.sql | 2 +- .../storage/postgres/migrations.go | 8 +- .../infra-proxy-service/storage/storage.go | 14 +- 29 files changed, 2155 insertions(+), 331 deletions(-) create mode 100644 components/infra-proxy-service/integration_test/migrations.json create mode 100644 components/infra-proxy-service/integration_test/migrations_test.go diff --git a/.studio/infra-proxy-service b/.studio/infra-proxy-service index 48aab1bdb18..21d4dc6055e 100644 --- a/.studio/infra-proxy-service +++ b/.studio/infra-proxy-service @@ -25,6 +25,14 @@ function infra_service_integration() { log_line "Finished loading chef repo..." } +document "infra_service_migration_integration" < chef.automate.api.infra_proxy.migrations.request.GetMigrationStatus + 0, // 0: chef.automate.api.infra_proxy.migrations.InfraProxyMigration.GetMigrationStatus:input_type -> chef.automate.api.infra_proxy.migrations.request.GetMigrationStatusRequest 1, // 1: chef.automate.api.infra_proxy.migrations.InfraProxyMigration.CancelMigration:input_type -> chef.automate.api.infra_proxy.migrations.request.CancelMigrationRequest - 2, // 2: chef.automate.api.infra_proxy.migrations.InfraProxyMigration.GetMigrationStatus:output_type -> chef.automate.api.infra_proxy.migrations.response.GetMigrationStatus - 3, // 3: chef.automate.api.infra_proxy.migrations.InfraProxyMigration.CancelMigration:output_type -> chef.automate.api.infra_proxy.migrations.response.CancelMigrationResponce - 2, // [2:4] is the sub-list for method output_type - 0, // [0:2] is the sub-list for method input_type + 2, // 2: chef.automate.api.infra_proxy.migrations.InfraProxyMigration.GetStagedData:input_type -> chef.automate.api.infra_proxy.migrations.request.GetStagedDataRequest + 3, // 3: chef.automate.api.infra_proxy.migrations.InfraProxyMigration.GetMigrationStatus:output_type -> chef.automate.api.infra_proxy.migrations.response.GetMigrationStatusResponse + 4, // 4: chef.automate.api.infra_proxy.migrations.InfraProxyMigration.CancelMigration:output_type -> chef.automate.api.infra_proxy.migrations.response.CancelMigrationResponse + 5, // 5: chef.automate.api.infra_proxy.migrations.InfraProxyMigration.GetStagedData:output_type -> chef.automate.api.infra_proxy.migrations.response.GetStagedDataResponse + 3, // [3:6] is the sub-list for method output_type + 0, // [0:3] is the sub-list for method input_type 0, // [0:0] is the sub-list for extension type_name 0, // [0:0] is the sub-list for extension extendee 0, // [0:0] is the sub-list for field type_name @@ -154,8 +179,9 @@ const _ = grpc.SupportPackageIsVersion6 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type InfraProxyMigrationClient interface { - GetMigrationStatus(ctx context.Context, in *request.GetMigrationStatus, opts ...grpc.CallOption) (*response.GetMigrationStatus, error) - CancelMigration(ctx context.Context, in *request.CancelMigrationRequest, opts ...grpc.CallOption) (*response.CancelMigrationResponce, error) + GetMigrationStatus(ctx context.Context, in *request.GetMigrationStatusRequest, opts ...grpc.CallOption) (*response.GetMigrationStatusResponse, error) + CancelMigration(ctx context.Context, in *request.CancelMigrationRequest, opts ...grpc.CallOption) (*response.CancelMigrationResponse, error) + GetStagedData(ctx context.Context, in *request.GetStagedDataRequest, opts ...grpc.CallOption) (*response.GetStagedDataResponse, error) } type infraProxyMigrationClient struct { @@ -166,8 +192,8 @@ func NewInfraProxyMigrationClient(cc grpc.ClientConnInterface) InfraProxyMigrati return &infraProxyMigrationClient{cc} } -func (c *infraProxyMigrationClient) GetMigrationStatus(ctx context.Context, in *request.GetMigrationStatus, opts ...grpc.CallOption) (*response.GetMigrationStatus, error) { - out := new(response.GetMigrationStatus) +func (c *infraProxyMigrationClient) GetMigrationStatus(ctx context.Context, in *request.GetMigrationStatusRequest, opts ...grpc.CallOption) (*response.GetMigrationStatusResponse, error) { + out := new(response.GetMigrationStatusResponse) err := c.cc.Invoke(ctx, "/chef.automate.api.infra_proxy.migrations.InfraProxyMigration/GetMigrationStatus", in, out, opts...) if err != nil { return nil, err @@ -175,8 +201,8 @@ func (c *infraProxyMigrationClient) GetMigrationStatus(ctx context.Context, in * return out, nil } -func (c *infraProxyMigrationClient) CancelMigration(ctx context.Context, in *request.CancelMigrationRequest, opts ...grpc.CallOption) (*response.CancelMigrationResponce, error) { - out := new(response.CancelMigrationResponce) +func (c *infraProxyMigrationClient) CancelMigration(ctx context.Context, in *request.CancelMigrationRequest, opts ...grpc.CallOption) (*response.CancelMigrationResponse, error) { + out := new(response.CancelMigrationResponse) err := c.cc.Invoke(ctx, "/chef.automate.api.infra_proxy.migrations.InfraProxyMigration/CancelMigration", in, out, opts...) if err != nil { return nil, err @@ -184,29 +210,42 @@ func (c *infraProxyMigrationClient) CancelMigration(ctx context.Context, in *req return out, nil } +func (c *infraProxyMigrationClient) GetStagedData(ctx context.Context, in *request.GetStagedDataRequest, opts ...grpc.CallOption) (*response.GetStagedDataResponse, error) { + out := new(response.GetStagedDataResponse) + err := c.cc.Invoke(ctx, "/chef.automate.api.infra_proxy.migrations.InfraProxyMigration/GetStagedData", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // InfraProxyMigrationServer is the server API for InfraProxyMigration service. type InfraProxyMigrationServer interface { - GetMigrationStatus(context.Context, *request.GetMigrationStatus) (*response.GetMigrationStatus, error) - CancelMigration(context.Context, *request.CancelMigrationRequest) (*response.CancelMigrationResponce, error) + GetMigrationStatus(context.Context, *request.GetMigrationStatusRequest) (*response.GetMigrationStatusResponse, error) + CancelMigration(context.Context, *request.CancelMigrationRequest) (*response.CancelMigrationResponse, error) + GetStagedData(context.Context, *request.GetStagedDataRequest) (*response.GetStagedDataResponse, error) } // UnimplementedInfraProxyMigrationServer can be embedded to have forward compatible implementations. type UnimplementedInfraProxyMigrationServer struct { } -func (*UnimplementedInfraProxyMigrationServer) GetMigrationStatus(context.Context, *request.GetMigrationStatus) (*response.GetMigrationStatus, error) { +func (*UnimplementedInfraProxyMigrationServer) GetMigrationStatus(context.Context, *request.GetMigrationStatusRequest) (*response.GetMigrationStatusResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetMigrationStatus not implemented") } -func (*UnimplementedInfraProxyMigrationServer) CancelMigration(context.Context, *request.CancelMigrationRequest) (*response.CancelMigrationResponce, error) { +func (*UnimplementedInfraProxyMigrationServer) CancelMigration(context.Context, *request.CancelMigrationRequest) (*response.CancelMigrationResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method CancelMigration not implemented") } +func (*UnimplementedInfraProxyMigrationServer) GetStagedData(context.Context, *request.GetStagedDataRequest) (*response.GetStagedDataResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetStagedData not implemented") +} func RegisterInfraProxyMigrationServer(s *grpc.Server, srv InfraProxyMigrationServer) { s.RegisterService(&_InfraProxyMigration_serviceDesc, srv) } func _InfraProxyMigration_GetMigrationStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(request.GetMigrationStatus) + in := new(request.GetMigrationStatusRequest) if err := dec(in); err != nil { return nil, err } @@ -218,7 +257,7 @@ func _InfraProxyMigration_GetMigrationStatus_Handler(srv interface{}, ctx contex FullMethod: "/chef.automate.api.infra_proxy.migrations.InfraProxyMigration/GetMigrationStatus", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(InfraProxyMigrationServer).GetMigrationStatus(ctx, req.(*request.GetMigrationStatus)) + return srv.(InfraProxyMigrationServer).GetMigrationStatus(ctx, req.(*request.GetMigrationStatusRequest)) } return interceptor(ctx, in, info, handler) } @@ -241,6 +280,24 @@ func _InfraProxyMigration_CancelMigration_Handler(srv interface{}, ctx context.C return interceptor(ctx, in, info, handler) } +func _InfraProxyMigration_GetStagedData_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(request.GetStagedDataRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(InfraProxyMigrationServer).GetStagedData(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/chef.automate.api.infra_proxy.migrations.InfraProxyMigration/GetStagedData", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(InfraProxyMigrationServer).GetStagedData(ctx, req.(*request.GetStagedDataRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _InfraProxyMigration_serviceDesc = grpc.ServiceDesc{ ServiceName: "chef.automate.api.infra_proxy.migrations.InfraProxyMigration", HandlerType: (*InfraProxyMigrationServer)(nil), @@ -253,6 +310,10 @@ var _InfraProxyMigration_serviceDesc = grpc.ServiceDesc{ MethodName: "CancelMigration", Handler: _InfraProxyMigration_CancelMigration_Handler, }, + { + MethodName: "GetStagedData", + Handler: _InfraProxyMigration_GetStagedData_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "external/infra_proxy/migrations/migrations.proto", diff --git a/api/external/infra_proxy/migrations/migrations.pb.gw.go b/api/external/infra_proxy/migrations/migrations.pb.gw.go index f756d67aabb..c7db809ce89 100644 --- a/api/external/infra_proxy/migrations/migrations.pb.gw.go +++ b/api/external/infra_proxy/migrations/migrations.pb.gw.go @@ -33,7 +33,7 @@ var _ = utilities.NewDoubleArray var _ = descriptor.ForMessage func request_InfraProxyMigration_GetMigrationStatus_0(ctx context.Context, marshaler runtime.Marshaler, client InfraProxyMigrationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq request.GetMigrationStatus + var protoReq request.GetMigrationStatusRequest var metadata runtime.ServerMetadata var ( @@ -60,7 +60,7 @@ func request_InfraProxyMigration_GetMigrationStatus_0(ctx context.Context, marsh } func local_request_InfraProxyMigration_GetMigrationStatus_0(ctx context.Context, marshaler runtime.Marshaler, server InfraProxyMigrationServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq request.GetMigrationStatus + var protoReq request.GetMigrationStatusRequest var metadata runtime.ServerMetadata var ( @@ -162,6 +162,60 @@ func local_request_InfraProxyMigration_CancelMigration_0(ctx context.Context, ma } +func request_InfraProxyMigration_GetStagedData_0(ctx context.Context, marshaler runtime.Marshaler, client InfraProxyMigrationClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq request.GetStagedDataRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["migration_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "migration_id") + } + + protoReq.MigrationId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "migration_id", err) + } + + msg, err := client.GetStagedData(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_InfraProxyMigration_GetStagedData_0(ctx context.Context, marshaler runtime.Marshaler, server InfraProxyMigrationServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq request.GetStagedDataRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["migration_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "migration_id") + } + + protoReq.MigrationId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "migration_id", err) + } + + msg, err := server.GetStagedData(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterInfraProxyMigrationHandlerServer registers the http handlers for service InfraProxyMigration to "mux". // UnaryRPC :call InfraProxyMigrationServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -207,6 +261,26 @@ func RegisterInfraProxyMigrationHandlerServer(ctx context.Context, mux *runtime. }) + mux.Handle("GET", pattern_InfraProxyMigration_GetStagedData_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) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_InfraProxyMigration_GetStagedData_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_InfraProxyMigration_GetStagedData_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -288,6 +362,26 @@ func RegisterInfraProxyMigrationHandlerClient(ctx context.Context, mux *runtime. }) + mux.Handle("GET", pattern_InfraProxyMigration_GetStagedData_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) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_InfraProxyMigration_GetStagedData_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_InfraProxyMigration_GetStagedData_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -295,10 +389,14 @@ var ( pattern_InfraProxyMigration_GetMigrationStatus_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 2, 5, 1, 0, 4, 1, 5, 6}, []string{"api", "v0", "infra", "servers", "migrations", "status", "migration_id"}, "", runtime.AssumeColonVerbOpt(true))) pattern_InfraProxyMigration_CancelMigration_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5, 2, 6, 1, 0, 4, 1, 5, 7}, []string{"api", "v0", "infra", "servers", "server_id", "migrations", "cancel_migration", "migration_id"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_InfraProxyMigration_GetStagedData_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 2, 5, 1, 0, 4, 1, 5, 6}, []string{"api", "v0", "infra", "servers", "migrations", "staged_data", "migration_id"}, "", runtime.AssumeColonVerbOpt(true))) ) var ( forward_InfraProxyMigration_GetMigrationStatus_0 = runtime.ForwardResponseMessage forward_InfraProxyMigration_CancelMigration_0 = runtime.ForwardResponseMessage + + forward_InfraProxyMigration_GetStagedData_0 = runtime.ForwardResponseMessage ) diff --git a/api/external/infra_proxy/migrations/migrations.pb.policy.go b/api/external/infra_proxy/migrations/migrations.pb.policy.go index 318529d033a..5ee8ed29d8a 100644 --- a/api/external/infra_proxy/migrations/migrations.pb.policy.go +++ b/api/external/infra_proxy/migrations/migrations.pb.policy.go @@ -10,7 +10,7 @@ import ( func init() { policy.MapMethodTo("/chef.automate.api.infra_proxy.migrations.InfraProxyMigration/GetMigrationStatus", "infra:infraServers", "infra:infraServers:get", "GET", "/api/v0/infra/servers/migrations/status/{migration_id}", func(unexpandedResource string, input interface{}) string { - if m, ok := input.(*request.GetMigrationStatus); ok { + if m, ok := input.(*request.GetMigrationStatusRequest); ok { return policy.ExpandParameterizedResource(unexpandedResource, func(want string) string { switch want { case "migration_id": @@ -37,4 +37,17 @@ func init() { } return "" }) + policy.MapMethodTo("/chef.automate.api.infra_proxy.migrations.InfraProxyMigration/GetStagedData", "infra:infraServers:migrations:{migration_id}", "infra:infraServers:get", "GET", "/api/v0/infra/servers/migrations/staged_data/{migration_id}", func(unexpandedResource string, input interface{}) string { + if m, ok := input.(*request.GetStagedDataRequest); ok { + return policy.ExpandParameterizedResource(unexpandedResource, func(want string) string { + switch want { + case "migration_id": + return m.MigrationId + default: + return "" + } + }) + } + return "" + }) } diff --git a/api/external/infra_proxy/migrations/migrations.proto b/api/external/infra_proxy/migrations/migrations.proto index 6e110a5496b..36c7e24f6e3 100644 --- a/api/external/infra_proxy/migrations/migrations.proto +++ b/api/external/infra_proxy/migrations/migrations.proto @@ -10,15 +10,21 @@ import "external/infra_proxy/migrations/request/migrations.proto"; import "external/infra_proxy/migrations/response/migrations.proto"; service InfraProxyMigration { - rpc GetMigrationStatus (infra_proxy.migrations.request.GetMigrationStatus) returns (infra_proxy.migrations.response.GetMigrationStatus) { + rpc GetMigrationStatus (infra_proxy.migrations.request.GetMigrationStatusRequest) returns (infra_proxy.migrations.response.GetMigrationStatusResponse) { option (google.api.http).get = "/api/v0/infra/servers/migrations/status/{migration_id}"; option (chef.automate.api.iam.policy).resource = "infra:infraServers"; option (chef.automate.api.iam.policy).action = "infra:infraServers:get"; }; - rpc CancelMigration (infra_proxy.migrations.request.CancelMigrationRequest) returns (infra_proxy.migrations.response.CancelMigrationResponce) { + rpc CancelMigration (infra_proxy.migrations.request.CancelMigrationRequest) returns (infra_proxy.migrations.response.CancelMigrationResponse) { option (google.api.http).get = "/api/v0/infra/servers/{server_id}/migrations/cancel_migration/{migration_id}"; option (chef.automate.api.iam.policy).resource = "infra:infraServers:{server_id}:migrations:{migration_id}"; option (chef.automate.api.iam.policy).action = "infra:infraServers:get"; }; + + rpc GetStagedData (infra_proxy.migrations.request.GetStagedDataRequest) returns (infra_proxy.migrations.response.GetStagedDataResponse) { + option (google.api.http).get = "/api/v0/infra/servers/migrations/staged_data/{migration_id}"; + option (chef.automate.api.iam.policy).resource = "infra:infraServers:migrations:{migration_id}"; + option (chef.automate.api.iam.policy).action = "infra:infraServers:get"; + }; } diff --git a/api/external/infra_proxy/migrations/migrations.swagger.json b/api/external/infra_proxy/migrations/migrations.swagger.json index 46eefc05d5c..30890cebd6f 100644 --- a/api/external/infra_proxy/migrations/migrations.swagger.json +++ b/api/external/infra_proxy/migrations/migrations.swagger.json @@ -11,6 +11,37 @@ "application/json" ], "paths": { + "/api/v0/infra/servers/migrations/staged_data/{migration_id}": { + "get": { + "operationId": "InfraProxyMigration_GetStagedData", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/chef.automate.api.infra_proxy.migrations.response.GetStagedDataResponse" + } + }, + "default": { + "description": "An unexpected error response", + "schema": { + "$ref": "#/definitions/grpc.gateway.runtime.Error" + } + } + }, + "parameters": [ + { + "name": "migration_id", + "description": "Migration ID", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": [ + "InfraProxyMigration" + ] + } + }, "/api/v0/infra/servers/migrations/status/{migration_id}": { "get": { "operationId": "InfraProxyMigration_GetMigrationStatus", @@ -18,7 +49,7 @@ "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/chef.automate.api.infra_proxy.migrations.response.GetMigrationStatus" + "$ref": "#/definitions/chef.automate.api.infra_proxy.migrations.response.GetMigrationStatusResponse" } }, "default": { @@ -49,7 +80,7 @@ "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/chef.automate.api.infra_proxy.migrations.response.CancelMigrationResponce" + "$ref": "#/definitions/chef.automate.api.infra_proxy.migrations.response.CancelMigrationResponse" } }, "default": { @@ -82,7 +113,7 @@ } }, "definitions": { - "chef.automate.api.infra_proxy.migrations.response.CancelMigrationResponce": { + "chef.automate.api.infra_proxy.migrations.response.CancelMigrationResponse": { "type": "object", "properties": { "success": { @@ -99,7 +130,7 @@ } } }, - "chef.automate.api.infra_proxy.migrations.response.GetMigrationStatus": { + "chef.automate.api.infra_proxy.migrations.response.GetMigrationStatusResponse": { "type": "object", "properties": { "migration_id": { @@ -116,6 +147,98 @@ } } }, + "chef.automate.api.infra_proxy.migrations.response.GetStagedDataResponse": { + "type": "object", + "properties": { + "migration_id": { + "type": "string", + "description": "Migration ID." + }, + "staged_data": { + "$ref": "#/definitions/chef.automate.api.infra_proxy.migrations.response.StagedData", + "title": "Staged data" + } + } + }, + "chef.automate.api.infra_proxy.migrations.response.StagedData": { + "type": "object", + "properties": { + "orgs_to_migrate": { + "type": "integer", + "format": "int32", + "title": "Number of orgs to migrate" + }, + "orgs_to_skip": { + "type": "integer", + "format": "int32", + "title": "Number of orgs to skip" + }, + "orgs_to_update": { + "type": "integer", + "format": "int32", + "title": "Number of orgs to update" + }, + "orgs_to_delete": { + "type": "integer", + "format": "int32", + "title": "Number of orgs to delete" + }, + "users": { + "type": "array", + "items": { + "$ref": "#/definitions/chef.automate.api.infra_proxy.migrations.response.user" + }, + "title": "Users" + } + } + }, + "chef.automate.api.infra_proxy.migrations.response.user": { + "type": "object", + "properties": { + "username": { + "type": "string", + "title": "User's username" + }, + "email": { + "type": "string", + "title": "User's email ID" + }, + "display_name": { + "type": "string", + "title": "User's display name" + }, + "first_name": { + "type": "string", + "title": "User's first name" + }, + "last_name": { + "type": "string", + "title": "User's last name" + }, + "middle_name": { + "type": "string", + "title": "User's middle name" + }, + "automate_username": { + "type": "string", + "title": "User's username in automate" + }, + "connector": { + "type": "string", + "title": "Local or ldap user" + }, + "is_conflicting": { + "type": "boolean", + "format": "boolean", + "title": "IsConflicting for user's existance in db" + }, + "is_admin": { + "type": "boolean", + "format": "boolean", + "title": "user is admin or not" + } + } + }, "google.protobuf.Any": { "type": "object", "properties": { diff --git a/api/external/infra_proxy/migrations/request/migrations.pb.go b/api/external/infra_proxy/migrations/request/migrations.pb.go index cd1cac981b3..f7152aa14f4 100644 --- a/api/external/infra_proxy/migrations/request/migrations.pb.go +++ b/api/external/infra_proxy/migrations/request/migrations.pb.go @@ -206,7 +206,7 @@ func (x *Chunk) GetPosition() int64 { return 0 } -type GetMigrationStatus struct { +type GetMigrationStatusRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields @@ -215,8 +215,8 @@ type GetMigrationStatus struct { MigrationId string `protobuf:"bytes,1,opt,name=migration_id,json=migrationId,proto3" json:"migration_id,omitempty"` } -func (x *GetMigrationStatus) Reset() { - *x = GetMigrationStatus{} +func (x *GetMigrationStatusRequest) Reset() { + *x = GetMigrationStatusRequest{} if protoimpl.UnsafeEnabled { mi := &file_external_infra_proxy_migrations_request_migrations_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -224,13 +224,13 @@ func (x *GetMigrationStatus) Reset() { } } -func (x *GetMigrationStatus) String() string { +func (x *GetMigrationStatusRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*GetMigrationStatus) ProtoMessage() {} +func (*GetMigrationStatusRequest) ProtoMessage() {} -func (x *GetMigrationStatus) ProtoReflect() protoreflect.Message { +func (x *GetMigrationStatusRequest) ProtoReflect() protoreflect.Message { mi := &file_external_infra_proxy_migrations_request_migrations_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -242,12 +242,12 @@ func (x *GetMigrationStatus) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use GetMigrationStatus.ProtoReflect.Descriptor instead. -func (*GetMigrationStatus) Descriptor() ([]byte, []int) { +// Deprecated: Use GetMigrationStatusRequest.ProtoReflect.Descriptor instead. +func (*GetMigrationStatusRequest) Descriptor() ([]byte, []int) { return file_external_infra_proxy_migrations_request_migrations_proto_rawDescGZIP(), []int{3} } -func (x *GetMigrationStatus) GetMigrationId() string { +func (x *GetMigrationStatusRequest) GetMigrationId() string { if x != nil { return x.MigrationId } @@ -311,6 +311,54 @@ func (x *CancelMigrationRequest) GetMigrationId() string { return "" } +type GetStagedDataRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Migration ID + MigrationId string `protobuf:"bytes,1,opt,name=migration_id,json=migrationId,proto3" json:"migration_id,omitempty"` +} + +func (x *GetStagedDataRequest) Reset() { + *x = GetStagedDataRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_external_infra_proxy_migrations_request_migrations_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetStagedDataRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetStagedDataRequest) ProtoMessage() {} + +func (x *GetStagedDataRequest) ProtoReflect() protoreflect.Message { + mi := &file_external_infra_proxy_migrations_request_migrations_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetStagedDataRequest.ProtoReflect.Descriptor instead. +func (*GetStagedDataRequest) Descriptor() ([]byte, []int) { + return file_external_infra_proxy_migrations_request_migrations_proto_rawDescGZIP(), []int{5} +} + +func (x *GetStagedDataRequest) GetMigrationId() string { + if x != nil { + return x.MigrationId + } + return "" +} + var File_external_infra_proxy_migrations_request_migrations_proto protoreflect.FileDescriptor var file_external_infra_proxy_migrations_request_migrations_proto_rawDesc = []byte{ @@ -341,21 +389,25 @@ var file_external_infra_proxy_migrations_request_migrations_proto_rawDesc = []by 0x70, 0x65, 0x22, 0x37, 0x0a, 0x05, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x37, 0x0a, 0x12, 0x47, + 0x03, 0x52, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3e, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x49, 0x64, 0x22, 0x58, 0x0a, 0x16, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x4d, 0x69, - 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, - 0x0a, 0x09, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x08, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x49, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x6d, - 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0b, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x42, 0x46, - 0x5a, 0x44, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x68, 0x65, - 0x66, 0x2f, 0x61, 0x75, 0x74, 0x6f, 0x6d, 0x61, 0x74, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x65, - 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x69, 0x6e, 0x66, 0x72, 0x61, 0x5f, 0x70, 0x72, - 0x6f, 0x78, 0x79, 0x2f, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x72, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x6d, 0x69, 0x67, 0x72, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, + 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x22, 0x58, 0x0a, 0x16, 0x43, + 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x49, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, + 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x22, 0x39, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x67, + 0x65, 0x64, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, + 0x0c, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, + 0x42, 0x46, 0x5a, 0x44, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, + 0x68, 0x65, 0x66, 0x2f, 0x61, 0x75, 0x74, 0x6f, 0x6d, 0x61, 0x74, 0x65, 0x2f, 0x61, 0x70, 0x69, + 0x2f, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x69, 0x6e, 0x66, 0x72, 0x61, 0x5f, + 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x2f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -370,13 +422,14 @@ func file_external_infra_proxy_migrations_request_migrations_proto_rawDescGZIP() return file_external_infra_proxy_migrations_request_migrations_proto_rawDescData } -var file_external_infra_proxy_migrations_request_migrations_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_external_infra_proxy_migrations_request_migrations_proto_msgTypes = make([]protoimpl.MessageInfo, 6) var file_external_infra_proxy_migrations_request_migrations_proto_goTypes = []interface{}{ - (*UploadZipFileRequest)(nil), // 0: chef.automate.api.infra_proxy.migrations.request.UploadZipFileRequest - (*Metadata)(nil), // 1: chef.automate.api.infra_proxy.migrations.request.Metadata - (*Chunk)(nil), // 2: chef.automate.api.infra_proxy.migrations.request.Chunk - (*GetMigrationStatus)(nil), // 3: chef.automate.api.infra_proxy.migrations.request.GetMigrationStatus - (*CancelMigrationRequest)(nil), // 4: chef.automate.api.infra_proxy.migrations.request.CancelMigrationRequest + (*UploadZipFileRequest)(nil), // 0: chef.automate.api.infra_proxy.migrations.request.UploadZipFileRequest + (*Metadata)(nil), // 1: chef.automate.api.infra_proxy.migrations.request.Metadata + (*Chunk)(nil), // 2: chef.automate.api.infra_proxy.migrations.request.Chunk + (*GetMigrationStatusRequest)(nil), // 3: chef.automate.api.infra_proxy.migrations.request.GetMigrationStatusRequest + (*CancelMigrationRequest)(nil), // 4: chef.automate.api.infra_proxy.migrations.request.CancelMigrationRequest + (*GetStagedDataRequest)(nil), // 5: chef.automate.api.infra_proxy.migrations.request.GetStagedDataRequest } var file_external_infra_proxy_migrations_request_migrations_proto_depIdxs = []int32{ 2, // 0: chef.automate.api.infra_proxy.migrations.request.UploadZipFileRequest.chunk:type_name -> chef.automate.api.infra_proxy.migrations.request.Chunk @@ -431,7 +484,7 @@ func file_external_infra_proxy_migrations_request_migrations_proto_init() { } } file_external_infra_proxy_migrations_request_migrations_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetMigrationStatus); i { + switch v := v.(*GetMigrationStatusRequest); i { case 0: return &v.state case 1: @@ -454,6 +507,18 @@ func file_external_infra_proxy_migrations_request_migrations_proto_init() { return nil } } + file_external_infra_proxy_migrations_request_migrations_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetStagedDataRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -461,7 +526,7 @@ func file_external_infra_proxy_migrations_request_migrations_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_external_infra_proxy_migrations_request_migrations_proto_rawDesc, NumEnums: 0, - NumMessages: 5, + NumMessages: 6, NumExtensions: 0, NumServices: 0, }, diff --git a/api/external/infra_proxy/migrations/request/migrations.proto b/api/external/infra_proxy/migrations/request/migrations.proto index 421f0ca5feb..685157bec6f 100644 --- a/api/external/infra_proxy/migrations/request/migrations.proto +++ b/api/external/infra_proxy/migrations/request/migrations.proto @@ -26,7 +26,7 @@ message Chunk { // Stream pointer int64 position = 2; } -message GetMigrationStatus { +message GetMigrationStatusRequest { // Migration ID. string migration_id = 1; } @@ -37,3 +37,8 @@ message CancelMigrationRequest { // Migration ID string migration_id = 2; } + +message GetStagedDataRequest { + // Migration ID + string migration_id = 1; +} diff --git a/api/external/infra_proxy/migrations/response/migrations.pb.go b/api/external/infra_proxy/migrations/response/migrations.pb.go index 1e710a5e2c0..b508963cfdf 100644 --- a/api/external/infra_proxy/migrations/response/migrations.pb.go +++ b/api/external/infra_proxy/migrations/response/migrations.pb.go @@ -91,7 +91,7 @@ func (x *UploadZipFileResponse) GetErrors() []string { return nil } -type GetMigrationStatus struct { +type GetMigrationStatusResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields @@ -104,8 +104,8 @@ type GetMigrationStatus struct { MigrationStatus string `protobuf:"bytes,3,opt,name=migration_status,json=migrationStatus,proto3" json:"migration_status,omitempty"` } -func (x *GetMigrationStatus) Reset() { - *x = GetMigrationStatus{} +func (x *GetMigrationStatusResponse) Reset() { + *x = GetMigrationStatusResponse{} if protoimpl.UnsafeEnabled { mi := &file_external_infra_proxy_migrations_response_migrations_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -113,13 +113,13 @@ func (x *GetMigrationStatus) Reset() { } } -func (x *GetMigrationStatus) String() string { +func (x *GetMigrationStatusResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*GetMigrationStatus) ProtoMessage() {} +func (*GetMigrationStatusResponse) ProtoMessage() {} -func (x *GetMigrationStatus) ProtoReflect() protoreflect.Message { +func (x *GetMigrationStatusResponse) ProtoReflect() protoreflect.Message { mi := &file_external_infra_proxy_migrations_response_migrations_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -131,33 +131,33 @@ func (x *GetMigrationStatus) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use GetMigrationStatus.ProtoReflect.Descriptor instead. -func (*GetMigrationStatus) Descriptor() ([]byte, []int) { +// Deprecated: Use GetMigrationStatusResponse.ProtoReflect.Descriptor instead. +func (*GetMigrationStatusResponse) Descriptor() ([]byte, []int) { return file_external_infra_proxy_migrations_response_migrations_proto_rawDescGZIP(), []int{1} } -func (x *GetMigrationStatus) GetMigrationId() string { +func (x *GetMigrationStatusResponse) GetMigrationId() string { if x != nil { return x.MigrationId } return "" } -func (x *GetMigrationStatus) GetMigrationType() string { +func (x *GetMigrationStatusResponse) GetMigrationType() string { if x != nil { return x.MigrationType } return "" } -func (x *GetMigrationStatus) GetMigrationStatus() string { +func (x *GetMigrationStatusResponse) GetMigrationStatus() string { if x != nil { return x.MigrationStatus } return "" } -type CancelMigrationResponce struct { +type CancelMigrationResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields @@ -168,8 +168,8 @@ type CancelMigrationResponce struct { Errors []string `protobuf:"bytes,2,rep,name=errors,proto3" json:"errors,omitempty"` } -func (x *CancelMigrationResponce) Reset() { - *x = CancelMigrationResponce{} +func (x *CancelMigrationResponse) Reset() { + *x = CancelMigrationResponse{} if protoimpl.UnsafeEnabled { mi := &file_external_infra_proxy_migrations_response_migrations_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -177,13 +177,13 @@ func (x *CancelMigrationResponce) Reset() { } } -func (x *CancelMigrationResponce) String() string { +func (x *CancelMigrationResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*CancelMigrationResponce) ProtoMessage() {} +func (*CancelMigrationResponse) ProtoMessage() {} -func (x *CancelMigrationResponce) ProtoReflect() protoreflect.Message { +func (x *CancelMigrationResponse) ProtoReflect() protoreflect.Message { mi := &file_external_infra_proxy_migrations_response_migrations_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -195,25 +195,295 @@ func (x *CancelMigrationResponce) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use CancelMigrationResponce.ProtoReflect.Descriptor instead. -func (*CancelMigrationResponce) Descriptor() ([]byte, []int) { +// Deprecated: Use CancelMigrationResponse.ProtoReflect.Descriptor instead. +func (*CancelMigrationResponse) Descriptor() ([]byte, []int) { return file_external_infra_proxy_migrations_response_migrations_proto_rawDescGZIP(), []int{2} } -func (x *CancelMigrationResponce) GetSuccess() bool { +func (x *CancelMigrationResponse) GetSuccess() bool { if x != nil { return x.Success } return false } -func (x *CancelMigrationResponce) GetErrors() []string { +func (x *CancelMigrationResponse) GetErrors() []string { if x != nil { return x.Errors } return nil } +type GetStagedDataResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Migration ID. + MigrationId string `protobuf:"bytes,1,opt,name=migration_id,json=migrationId,proto3" json:"migration_id,omitempty"` + // Staged data + StagedData *StagedData `protobuf:"bytes,2,opt,name=staged_data,json=stagedData,proto3" json:"staged_data,omitempty"` +} + +func (x *GetStagedDataResponse) Reset() { + *x = GetStagedDataResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_external_infra_proxy_migrations_response_migrations_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetStagedDataResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetStagedDataResponse) ProtoMessage() {} + +func (x *GetStagedDataResponse) ProtoReflect() protoreflect.Message { + mi := &file_external_infra_proxy_migrations_response_migrations_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetStagedDataResponse.ProtoReflect.Descriptor instead. +func (*GetStagedDataResponse) Descriptor() ([]byte, []int) { + return file_external_infra_proxy_migrations_response_migrations_proto_rawDescGZIP(), []int{3} +} + +func (x *GetStagedDataResponse) GetMigrationId() string { + if x != nil { + return x.MigrationId + } + return "" +} + +func (x *GetStagedDataResponse) GetStagedData() *StagedData { + if x != nil { + return x.StagedData + } + return nil +} + +type StagedData struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Number of orgs to migrate + OrgsToMigrate int32 `protobuf:"varint,1,opt,name=orgs_to_migrate,json=orgsToMigrate,proto3" json:"orgs_to_migrate,omitempty"` + // Number of orgs to skip + OrgsToSkip int32 `protobuf:"varint,2,opt,name=orgs_to_skip,json=orgsToSkip,proto3" json:"orgs_to_skip,omitempty"` + // Number of orgs to update + OrgsToUpdate int32 `protobuf:"varint,3,opt,name=orgs_to_update,json=orgsToUpdate,proto3" json:"orgs_to_update,omitempty"` + // Number of orgs to delete + OrgsToDelete int32 `protobuf:"varint,4,opt,name=orgs_to_delete,json=orgsToDelete,proto3" json:"orgs_to_delete,omitempty"` + // Users + Users []*User `protobuf:"bytes,5,rep,name=users,proto3" json:"users,omitempty"` +} + +func (x *StagedData) Reset() { + *x = StagedData{} + if protoimpl.UnsafeEnabled { + mi := &file_external_infra_proxy_migrations_response_migrations_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StagedData) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StagedData) ProtoMessage() {} + +func (x *StagedData) ProtoReflect() protoreflect.Message { + mi := &file_external_infra_proxy_migrations_response_migrations_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StagedData.ProtoReflect.Descriptor instead. +func (*StagedData) Descriptor() ([]byte, []int) { + return file_external_infra_proxy_migrations_response_migrations_proto_rawDescGZIP(), []int{4} +} + +func (x *StagedData) GetOrgsToMigrate() int32 { + if x != nil { + return x.OrgsToMigrate + } + return 0 +} + +func (x *StagedData) GetOrgsToSkip() int32 { + if x != nil { + return x.OrgsToSkip + } + return 0 +} + +func (x *StagedData) GetOrgsToUpdate() int32 { + if x != nil { + return x.OrgsToUpdate + } + return 0 +} + +func (x *StagedData) GetOrgsToDelete() int32 { + if x != nil { + return x.OrgsToDelete + } + return 0 +} + +func (x *StagedData) GetUsers() []*User { + if x != nil { + return x.Users + } + return nil +} + +type User struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // User's username + Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"` + // User's email ID + Email string `protobuf:"bytes,2,opt,name=email,proto3" json:"email,omitempty"` + // User's display name + DisplayName string `protobuf:"bytes,3,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"` + // User's first name + FirstName string `protobuf:"bytes,4,opt,name=first_name,json=firstName,proto3" json:"first_name,omitempty"` + // User's last name + LastName string `protobuf:"bytes,5,opt,name=last_name,json=lastName,proto3" json:"last_name,omitempty"` + // User's middle name + MiddleName string `protobuf:"bytes,6,opt,name=middle_name,json=middleName,proto3" json:"middle_name,omitempty"` + // User's username in automate + AutomateUsername string `protobuf:"bytes,7,opt,name=automate_username,json=automateUsername,proto3" json:"automate_username,omitempty"` + // Local or ldap user + Connector string `protobuf:"bytes,8,opt,name=connector,proto3" json:"connector,omitempty"` + // IsConflicting for user's existance in db + IsConflicting bool `protobuf:"varint,9,opt,name=is_conflicting,json=isConflicting,proto3" json:"is_conflicting,omitempty"` + // user is admin or not + IsAdmin bool `protobuf:"varint,10,opt,name=is_admin,json=isAdmin,proto3" json:"is_admin,omitempty"` +} + +func (x *User) Reset() { + *x = User{} + if protoimpl.UnsafeEnabled { + mi := &file_external_infra_proxy_migrations_response_migrations_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *User) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*User) ProtoMessage() {} + +func (x *User) ProtoReflect() protoreflect.Message { + mi := &file_external_infra_proxy_migrations_response_migrations_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use User.ProtoReflect.Descriptor instead. +func (*User) Descriptor() ([]byte, []int) { + return file_external_infra_proxy_migrations_response_migrations_proto_rawDescGZIP(), []int{5} +} + +func (x *User) GetUsername() string { + if x != nil { + return x.Username + } + return "" +} + +func (x *User) GetEmail() string { + if x != nil { + return x.Email + } + return "" +} + +func (x *User) GetDisplayName() string { + if x != nil { + return x.DisplayName + } + return "" +} + +func (x *User) GetFirstName() string { + if x != nil { + return x.FirstName + } + return "" +} + +func (x *User) GetLastName() string { + if x != nil { + return x.LastName + } + return "" +} + +func (x *User) GetMiddleName() string { + if x != nil { + return x.MiddleName + } + return "" +} + +func (x *User) GetAutomateUsername() string { + if x != nil { + return x.AutomateUsername + } + return "" +} + +func (x *User) GetConnector() string { + if x != nil { + return x.Connector + } + return "" +} + +func (x *User) GetIsConflicting() bool { + if x != nil { + return x.IsConflicting + } + return false +} + +func (x *User) GetIsAdmin() bool { + if x != nil { + return x.IsAdmin + } + return false +} + var File_external_infra_proxy_migrations_response_migrations_proto protoreflect.FileDescriptor var file_external_infra_proxy_migrations_response_migrations_proto_rawDesc = []byte{ @@ -230,26 +500,72 @@ var file_external_infra_proxy_migrations_response_migrations_proto_rawDesc = []b 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x18, 0x03, 0x20, - 0x03, 0x28, 0x09, 0x52, 0x06, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x22, 0x89, 0x01, 0x0a, 0x12, + 0x03, 0x28, 0x09, 0x52, 0x06, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x22, 0x91, 0x01, 0x0a, 0x1a, 0x47, 0x65, 0x74, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, - 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x25, 0x0a, 0x0e, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6d, - 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x29, 0x0a, 0x10, - 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x4b, 0x0a, 0x17, 0x43, 0x61, 0x6e, 0x63, 0x65, - 0x6c, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x63, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x16, 0x0a, 0x06, - 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x65, 0x72, - 0x72, 0x6f, 0x72, 0x73, 0x42, 0x47, 0x5a, 0x45, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, - 0x6f, 0x6d, 0x2f, 0x63, 0x68, 0x65, 0x66, 0x2f, 0x61, 0x75, 0x74, 0x6f, 0x6d, 0x61, 0x74, 0x65, - 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x69, 0x6e, - 0x66, 0x72, 0x61, 0x5f, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x6d, 0x69, + 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0b, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x25, 0x0a, + 0x0e, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x54, 0x79, 0x70, 0x65, 0x12, 0x29, 0x0a, 0x10, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, + 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, + 0x4b, 0x0a, 0x17, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, + 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, + 0x63, 0x65, 0x73, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x18, 0x02, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x22, 0x9a, 0x01, 0x0a, + 0x15, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x67, 0x65, 0x64, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6d, 0x69, + 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x5e, 0x0a, 0x0b, 0x73, 0x74, 0x61, + 0x67, 0x65, 0x64, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3d, + 0x2e, 0x63, 0x68, 0x65, 0x66, 0x2e, 0x61, 0x75, 0x74, 0x6f, 0x6d, 0x61, 0x74, 0x65, 0x2e, 0x61, + 0x70, 0x69, 0x2e, 0x69, 0x6e, 0x66, 0x72, 0x61, 0x5f, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x6d, + 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x67, 0x65, 0x64, 0x44, 0x61, 0x74, 0x61, 0x52, 0x0a, 0x73, + 0x74, 0x61, 0x67, 0x65, 0x64, 0x44, 0x61, 0x74, 0x61, 0x22, 0xf1, 0x01, 0x0a, 0x0a, 0x53, 0x74, + 0x61, 0x67, 0x65, 0x64, 0x44, 0x61, 0x74, 0x61, 0x12, 0x26, 0x0a, 0x0f, 0x6f, 0x72, 0x67, 0x73, + 0x5f, 0x74, 0x6f, 0x5f, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x0d, 0x6f, 0x72, 0x67, 0x73, 0x54, 0x6f, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x65, + 0x12, 0x20, 0x0a, 0x0c, 0x6f, 0x72, 0x67, 0x73, 0x5f, 0x74, 0x6f, 0x5f, 0x73, 0x6b, 0x69, 0x70, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x6f, 0x72, 0x67, 0x73, 0x54, 0x6f, 0x53, 0x6b, + 0x69, 0x70, 0x12, 0x24, 0x0a, 0x0e, 0x6f, 0x72, 0x67, 0x73, 0x5f, 0x74, 0x6f, 0x5f, 0x75, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x6f, 0x72, 0x67, 0x73, + 0x54, 0x6f, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x24, 0x0a, 0x0e, 0x6f, 0x72, 0x67, 0x73, + 0x5f, 0x74, 0x6f, 0x5f, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x0c, 0x6f, 0x72, 0x67, 0x73, 0x54, 0x6f, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x4d, + 0x0a, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x37, 0x2e, + 0x63, 0x68, 0x65, 0x66, 0x2e, 0x61, 0x75, 0x74, 0x6f, 0x6d, 0x61, 0x74, 0x65, 0x2e, 0x61, 0x70, + 0x69, 0x2e, 0x69, 0x6e, 0x66, 0x72, 0x61, 0x5f, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x6d, 0x69, + 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x52, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73, 0x22, 0xc5, 0x02, + 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, + 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x21, 0x0a, 0x0c, 0x64, 0x69, 0x73, 0x70, + 0x6c, 0x61, 0x79, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, + 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x66, + 0x69, 0x72, 0x73, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x09, 0x66, 0x69, 0x72, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x6c, 0x61, + 0x73, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6c, + 0x61, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x69, 0x64, 0x64, 0x6c, + 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6d, 0x69, + 0x64, 0x64, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x2b, 0x0a, 0x11, 0x61, 0x75, 0x74, 0x6f, + 0x6d, 0x61, 0x74, 0x65, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x07, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x10, 0x61, 0x75, 0x74, 0x6f, 0x6d, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, + 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, + 0x6f, 0x72, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, + 0x74, 0x6f, 0x72, 0x12, 0x25, 0x0a, 0x0e, 0x69, 0x73, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x6c, 0x69, + 0x63, 0x74, 0x69, 0x6e, 0x67, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x69, 0x73, 0x43, + 0x6f, 0x6e, 0x66, 0x6c, 0x69, 0x63, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x19, 0x0a, 0x08, 0x69, 0x73, + 0x5f, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x69, 0x73, + 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x42, 0x47, 0x5a, 0x45, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, + 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x68, 0x65, 0x66, 0x2f, 0x61, 0x75, 0x74, 0x6f, 0x6d, 0x61, 0x74, + 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x69, + 0x6e, 0x66, 0x72, 0x61, 0x5f, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x6d, 0x69, 0x67, 0x72, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -264,18 +580,23 @@ func file_external_infra_proxy_migrations_response_migrations_proto_rawDescGZIP( return file_external_infra_proxy_migrations_response_migrations_proto_rawDescData } -var file_external_infra_proxy_migrations_response_migrations_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_external_infra_proxy_migrations_response_migrations_proto_msgTypes = make([]protoimpl.MessageInfo, 6) var file_external_infra_proxy_migrations_response_migrations_proto_goTypes = []interface{}{ - (*UploadZipFileResponse)(nil), // 0: chef.automate.api.infra_proxy.migrations.response.UploadZipFileResponse - (*GetMigrationStatus)(nil), // 1: chef.automate.api.infra_proxy.migrations.response.GetMigrationStatus - (*CancelMigrationResponce)(nil), // 2: chef.automate.api.infra_proxy.migrations.response.CancelMigrationResponce + (*UploadZipFileResponse)(nil), // 0: chef.automate.api.infra_proxy.migrations.response.UploadZipFileResponse + (*GetMigrationStatusResponse)(nil), // 1: chef.automate.api.infra_proxy.migrations.response.GetMigrationStatusResponse + (*CancelMigrationResponse)(nil), // 2: chef.automate.api.infra_proxy.migrations.response.CancelMigrationResponse + (*GetStagedDataResponse)(nil), // 3: chef.automate.api.infra_proxy.migrations.response.GetStagedDataResponse + (*StagedData)(nil), // 4: chef.automate.api.infra_proxy.migrations.response.StagedData + (*User)(nil), // 5: chef.automate.api.infra_proxy.migrations.response.user } var file_external_infra_proxy_migrations_response_migrations_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name + 4, // 0: chef.automate.api.infra_proxy.migrations.response.GetStagedDataResponse.staged_data:type_name -> chef.automate.api.infra_proxy.migrations.response.StagedData + 5, // 1: chef.automate.api.infra_proxy.migrations.response.StagedData.users:type_name -> chef.automate.api.infra_proxy.migrations.response.user + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name } func init() { file_external_infra_proxy_migrations_response_migrations_proto_init() } @@ -297,7 +618,7 @@ func file_external_infra_proxy_migrations_response_migrations_proto_init() { } } file_external_infra_proxy_migrations_response_migrations_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetMigrationStatus); i { + switch v := v.(*GetMigrationStatusResponse); i { case 0: return &v.state case 1: @@ -309,7 +630,43 @@ func file_external_infra_proxy_migrations_response_migrations_proto_init() { } } file_external_infra_proxy_migrations_response_migrations_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CancelMigrationResponce); i { + switch v := v.(*CancelMigrationResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_external_infra_proxy_migrations_response_migrations_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetStagedDataResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_external_infra_proxy_migrations_response_migrations_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StagedData); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_external_infra_proxy_migrations_response_migrations_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*User); i { case 0: return &v.state case 1: @@ -327,7 +684,7 @@ func file_external_infra_proxy_migrations_response_migrations_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_external_infra_proxy_migrations_response_migrations_proto_rawDesc, NumEnums: 0, - NumMessages: 3, + NumMessages: 6, NumExtensions: 0, NumServices: 0, }, diff --git a/api/external/infra_proxy/migrations/response/migrations.proto b/api/external/infra_proxy/migrations/response/migrations.proto index ac8d10d3bc5..42a6fb769c1 100644 --- a/api/external/infra_proxy/migrations/response/migrations.proto +++ b/api/external/infra_proxy/migrations/response/migrations.proto @@ -13,7 +13,7 @@ message UploadZipFileResponse { repeated string errors = 3; } -message GetMigrationStatus { +message GetMigrationStatusResponse { // Migration ID. string migration_id = 1; // Migration type @@ -22,9 +22,52 @@ message GetMigrationStatus { string migration_status = 3; } -message CancelMigrationResponce { +message CancelMigrationResponse { // migration ID bool success = 1; // Error message repeated string errors = 2; } + +message GetStagedDataResponse { + // Migration ID. + string migration_id =1; + // Staged data + StagedData staged_data = 2; +} + +message StagedData { + // Number of orgs to migrate + int32 orgs_to_migrate =1; + // Number of orgs to skip + int32 orgs_to_skip =2; + // Number of orgs to update + int32 orgs_to_update =3; + // Number of orgs to delete + int32 orgs_to_delete =4; + // Users + repeated user users =5; +} + +message user { + // User's username + string username =1; + // User's email ID + string email =2; + // User's display name + string display_name=3; + // User's first name + string first_name=4; + // User's last name + string last_name=5; + // User's middle name + string middle_name=6; + // User's username in automate + string automate_username =7; + // Local or ldap user + string connector=8; + // IsConflicting for user's existance in db + bool is_conflicting=9; + // user is admin or not + bool is_admin=10; +} diff --git a/api/interservice/infra_proxy/migrations/request/migrations.pb.go b/api/interservice/infra_proxy/migrations/request/migrations.pb.go index d3ca5037e2c..f46900395b0 100644 --- a/api/interservice/infra_proxy/migrations/request/migrations.pb.go +++ b/api/interservice/infra_proxy/migrations/request/migrations.pb.go @@ -206,7 +206,7 @@ func (x *Chunk) GetPosition() int64 { return 0 } -type GetMigrationStatus struct { +type GetMigrationStatusRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields @@ -215,8 +215,8 @@ type GetMigrationStatus struct { MigrationId string `protobuf:"bytes,1,opt,name=migration_id,json=migrationId,proto3" json:"migration_id,omitempty" toml:"migration_id,omitempty" mapstructure:"migration_id,omitempty"` } -func (x *GetMigrationStatus) Reset() { - *x = GetMigrationStatus{} +func (x *GetMigrationStatusRequest) Reset() { + *x = GetMigrationStatusRequest{} if protoimpl.UnsafeEnabled { mi := &file_interservice_infra_proxy_migrations_request_migrations_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -224,13 +224,13 @@ func (x *GetMigrationStatus) Reset() { } } -func (x *GetMigrationStatus) String() string { +func (x *GetMigrationStatusRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*GetMigrationStatus) ProtoMessage() {} +func (*GetMigrationStatusRequest) ProtoMessage() {} -func (x *GetMigrationStatus) ProtoReflect() protoreflect.Message { +func (x *GetMigrationStatusRequest) ProtoReflect() protoreflect.Message { mi := &file_interservice_infra_proxy_migrations_request_migrations_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -242,12 +242,12 @@ func (x *GetMigrationStatus) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use GetMigrationStatus.ProtoReflect.Descriptor instead. -func (*GetMigrationStatus) Descriptor() ([]byte, []int) { +// Deprecated: Use GetMigrationStatusRequest.ProtoReflect.Descriptor instead. +func (*GetMigrationStatusRequest) Descriptor() ([]byte, []int) { return file_interservice_infra_proxy_migrations_request_migrations_proto_rawDescGZIP(), []int{3} } -func (x *GetMigrationStatus) GetMigrationId() string { +func (x *GetMigrationStatusRequest) GetMigrationId() string { if x != nil { return x.MigrationId } @@ -311,6 +311,54 @@ func (x *CancelMigrationRequest) GetMigrationId() string { return "" } +type GetStagedDataRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Migration ID + MigrationId string `protobuf:"bytes,1,opt,name=migration_id,json=migrationId,proto3" json:"migration_id,omitempty" toml:"migration_id,omitempty" mapstructure:"migration_id,omitempty"` +} + +func (x *GetStagedDataRequest) Reset() { + *x = GetStagedDataRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_interservice_infra_proxy_migrations_request_migrations_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetStagedDataRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetStagedDataRequest) ProtoMessage() {} + +func (x *GetStagedDataRequest) ProtoReflect() protoreflect.Message { + mi := &file_interservice_infra_proxy_migrations_request_migrations_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetStagedDataRequest.ProtoReflect.Descriptor instead. +func (*GetStagedDataRequest) Descriptor() ([]byte, []int) { + return file_interservice_infra_proxy_migrations_request_migrations_proto_rawDescGZIP(), []int{5} +} + +func (x *GetStagedDataRequest) GetMigrationId() string { + if x != nil { + return x.MigrationId + } + return "" +} + var File_interservice_infra_proxy_migrations_request_migrations_proto protoreflect.FileDescriptor var file_interservice_infra_proxy_migrations_request_migrations_proto_rawDesc = []byte{ @@ -342,21 +390,26 @@ var file_interservice_infra_proxy_migrations_request_migrations_proto_rawDesc = 0x37, 0x0a, 0x05, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, - 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x37, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x4d, - 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x21, - 0x0a, 0x0c, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, - 0x64, 0x22, 0x58, 0x0a, 0x16, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x4d, 0x69, 0x67, 0x72, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x73, - 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, - 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x49, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x6d, 0x69, 0x67, 0x72, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, - 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x42, 0x4a, 0x5a, 0x48, 0x67, - 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x68, 0x65, 0x66, 0x2f, 0x61, - 0x75, 0x74, 0x6f, 0x6d, 0x61, 0x74, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x69, 0x6e, 0x74, 0x65, - 0x72, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x69, 0x6e, 0x66, 0x72, 0x61, 0x5f, 0x70, - 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, - 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3e, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x4d, + 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6d, 0x69, 0x67, + 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x22, 0x58, 0x0a, 0x16, 0x43, 0x61, 0x6e, 0x63, + 0x65, 0x6c, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x49, 0x64, 0x12, + 0x21, 0x0a, 0x0c, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x49, 0x64, 0x22, 0x39, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x67, 0x65, 0x64, 0x44, + 0x61, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x6d, 0x69, + 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0b, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x42, 0x4a, 0x5a, + 0x48, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x68, 0x65, 0x66, + 0x2f, 0x61, 0x75, 0x74, 0x6f, 0x6d, 0x61, 0x74, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x69, 0x6e, + 0x74, 0x65, 0x72, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x69, 0x6e, 0x66, 0x72, 0x61, + 0x5f, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x2f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( @@ -371,13 +424,14 @@ func file_interservice_infra_proxy_migrations_request_migrations_proto_rawDescGZ return file_interservice_infra_proxy_migrations_request_migrations_proto_rawDescData } -var file_interservice_infra_proxy_migrations_request_migrations_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_interservice_infra_proxy_migrations_request_migrations_proto_msgTypes = make([]protoimpl.MessageInfo, 6) var file_interservice_infra_proxy_migrations_request_migrations_proto_goTypes = []interface{}{ - (*UploadZipFileRequest)(nil), // 0: chef.automate.domain.infra_proxy.migrations.request.UploadZipFileRequest - (*Metadata)(nil), // 1: chef.automate.domain.infra_proxy.migrations.request.Metadata - (*Chunk)(nil), // 2: chef.automate.domain.infra_proxy.migrations.request.Chunk - (*GetMigrationStatus)(nil), // 3: chef.automate.domain.infra_proxy.migrations.request.GetMigrationStatus - (*CancelMigrationRequest)(nil), // 4: chef.automate.domain.infra_proxy.migrations.request.CancelMigrationRequest + (*UploadZipFileRequest)(nil), // 0: chef.automate.domain.infra_proxy.migrations.request.UploadZipFileRequest + (*Metadata)(nil), // 1: chef.automate.domain.infra_proxy.migrations.request.Metadata + (*Chunk)(nil), // 2: chef.automate.domain.infra_proxy.migrations.request.Chunk + (*GetMigrationStatusRequest)(nil), // 3: chef.automate.domain.infra_proxy.migrations.request.GetMigrationStatusRequest + (*CancelMigrationRequest)(nil), // 4: chef.automate.domain.infra_proxy.migrations.request.CancelMigrationRequest + (*GetStagedDataRequest)(nil), // 5: chef.automate.domain.infra_proxy.migrations.request.GetStagedDataRequest } var file_interservice_infra_proxy_migrations_request_migrations_proto_depIdxs = []int32{ 2, // 0: chef.automate.domain.infra_proxy.migrations.request.UploadZipFileRequest.chunk:type_name -> chef.automate.domain.infra_proxy.migrations.request.Chunk @@ -432,7 +486,7 @@ func file_interservice_infra_proxy_migrations_request_migrations_proto_init() { } } file_interservice_infra_proxy_migrations_request_migrations_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetMigrationStatus); i { + switch v := v.(*GetMigrationStatusRequest); i { case 0: return &v.state case 1: @@ -455,6 +509,18 @@ func file_interservice_infra_proxy_migrations_request_migrations_proto_init() { return nil } } + file_interservice_infra_proxy_migrations_request_migrations_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetStagedDataRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -462,7 +528,7 @@ func file_interservice_infra_proxy_migrations_request_migrations_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_interservice_infra_proxy_migrations_request_migrations_proto_rawDesc, NumEnums: 0, - NumMessages: 5, + NumMessages: 6, NumExtensions: 0, NumServices: 0, }, diff --git a/api/interservice/infra_proxy/migrations/request/migrations.proto b/api/interservice/infra_proxy/migrations/request/migrations.proto index e3d8c77cf2c..5095f7a025b 100644 --- a/api/interservice/infra_proxy/migrations/request/migrations.proto +++ b/api/interservice/infra_proxy/migrations/request/migrations.proto @@ -27,7 +27,7 @@ message Chunk { int64 position = 2; } -message GetMigrationStatus { +message GetMigrationStatusRequest { // Migration ID. string migration_id = 1; @@ -39,3 +39,8 @@ message CancelMigrationRequest { // Migration ID string migration_id = 2; } + +message GetStagedDataRequest { + // Migration ID + string migration_id = 1; +} diff --git a/api/interservice/infra_proxy/migrations/response/migrations.pb.go b/api/interservice/infra_proxy/migrations/response/migrations.pb.go index c666a400f75..21fe84961b0 100644 --- a/api/interservice/infra_proxy/migrations/response/migrations.pb.go +++ b/api/interservice/infra_proxy/migrations/response/migrations.pb.go @@ -91,7 +91,7 @@ func (x *UploadZipFileResponse) GetErrors() []string { return nil } -type GetMigrationStatus struct { +type GetMigrationStatusResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields @@ -104,8 +104,8 @@ type GetMigrationStatus struct { MigrationStatus string `protobuf:"bytes,3,opt,name=migration_status,json=migrationStatus,proto3" json:"migration_status,omitempty" toml:"migration_status,omitempty" mapstructure:"migration_status,omitempty"` } -func (x *GetMigrationStatus) Reset() { - *x = GetMigrationStatus{} +func (x *GetMigrationStatusResponse) Reset() { + *x = GetMigrationStatusResponse{} if protoimpl.UnsafeEnabled { mi := &file_interservice_infra_proxy_migrations_response_migrations_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -113,13 +113,13 @@ func (x *GetMigrationStatus) Reset() { } } -func (x *GetMigrationStatus) String() string { +func (x *GetMigrationStatusResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*GetMigrationStatus) ProtoMessage() {} +func (*GetMigrationStatusResponse) ProtoMessage() {} -func (x *GetMigrationStatus) ProtoReflect() protoreflect.Message { +func (x *GetMigrationStatusResponse) ProtoReflect() protoreflect.Message { mi := &file_interservice_infra_proxy_migrations_response_migrations_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -131,33 +131,33 @@ func (x *GetMigrationStatus) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use GetMigrationStatus.ProtoReflect.Descriptor instead. -func (*GetMigrationStatus) Descriptor() ([]byte, []int) { +// Deprecated: Use GetMigrationStatusResponse.ProtoReflect.Descriptor instead. +func (*GetMigrationStatusResponse) Descriptor() ([]byte, []int) { return file_interservice_infra_proxy_migrations_response_migrations_proto_rawDescGZIP(), []int{1} } -func (x *GetMigrationStatus) GetMigrationId() string { +func (x *GetMigrationStatusResponse) GetMigrationId() string { if x != nil { return x.MigrationId } return "" } -func (x *GetMigrationStatus) GetMigrationType() string { +func (x *GetMigrationStatusResponse) GetMigrationType() string { if x != nil { return x.MigrationType } return "" } -func (x *GetMigrationStatus) GetMigrationStatus() string { +func (x *GetMigrationStatusResponse) GetMigrationStatus() string { if x != nil { return x.MigrationStatus } return "" } -type CancelMigrationResponce struct { +type CancelMigrationResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields @@ -168,8 +168,8 @@ type CancelMigrationResponce struct { Errors []string `protobuf:"bytes,2,rep,name=errors,proto3" json:"errors,omitempty" toml:"errors,omitempty" mapstructure:"errors,omitempty"` } -func (x *CancelMigrationResponce) Reset() { - *x = CancelMigrationResponce{} +func (x *CancelMigrationResponse) Reset() { + *x = CancelMigrationResponse{} if protoimpl.UnsafeEnabled { mi := &file_interservice_infra_proxy_migrations_response_migrations_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -177,13 +177,13 @@ func (x *CancelMigrationResponce) Reset() { } } -func (x *CancelMigrationResponce) String() string { +func (x *CancelMigrationResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*CancelMigrationResponce) ProtoMessage() {} +func (*CancelMigrationResponse) ProtoMessage() {} -func (x *CancelMigrationResponce) ProtoReflect() protoreflect.Message { +func (x *CancelMigrationResponse) ProtoReflect() protoreflect.Message { mi := &file_interservice_infra_proxy_migrations_response_migrations_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -195,25 +195,295 @@ func (x *CancelMigrationResponce) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use CancelMigrationResponce.ProtoReflect.Descriptor instead. -func (*CancelMigrationResponce) Descriptor() ([]byte, []int) { +// Deprecated: Use CancelMigrationResponse.ProtoReflect.Descriptor instead. +func (*CancelMigrationResponse) Descriptor() ([]byte, []int) { return file_interservice_infra_proxy_migrations_response_migrations_proto_rawDescGZIP(), []int{2} } -func (x *CancelMigrationResponce) GetSuccess() bool { +func (x *CancelMigrationResponse) GetSuccess() bool { if x != nil { return x.Success } return false } -func (x *CancelMigrationResponce) GetErrors() []string { +func (x *CancelMigrationResponse) GetErrors() []string { if x != nil { return x.Errors } return nil } +type GetStagedDataResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Migration ID. + MigrationId string `protobuf:"bytes,1,opt,name=migration_id,json=migrationId,proto3" json:"migration_id,omitempty" toml:"migration_id,omitempty" mapstructure:"migration_id,omitempty"` + // Staged data + StagedData *StagedData `protobuf:"bytes,2,opt,name=staged_data,json=stagedData,proto3" json:"staged_data,omitempty" toml:"staged_data,omitempty" mapstructure:"staged_data,omitempty"` +} + +func (x *GetStagedDataResponse) Reset() { + *x = GetStagedDataResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_interservice_infra_proxy_migrations_response_migrations_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetStagedDataResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetStagedDataResponse) ProtoMessage() {} + +func (x *GetStagedDataResponse) ProtoReflect() protoreflect.Message { + mi := &file_interservice_infra_proxy_migrations_response_migrations_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetStagedDataResponse.ProtoReflect.Descriptor instead. +func (*GetStagedDataResponse) Descriptor() ([]byte, []int) { + return file_interservice_infra_proxy_migrations_response_migrations_proto_rawDescGZIP(), []int{3} +} + +func (x *GetStagedDataResponse) GetMigrationId() string { + if x != nil { + return x.MigrationId + } + return "" +} + +func (x *GetStagedDataResponse) GetStagedData() *StagedData { + if x != nil { + return x.StagedData + } + return nil +} + +type StagedData struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Number of orgs to migrate + OrgsToMigrate int32 `protobuf:"varint,1,opt,name=orgs_to_migrate,json=orgsToMigrate,proto3" json:"orgs_to_migrate,omitempty" toml:"orgs_to_migrate,omitempty" mapstructure:"orgs_to_migrate,omitempty"` + // Number of orgs to skip + OrgsToSkip int32 `protobuf:"varint,2,opt,name=orgs_to_skip,json=orgsToSkip,proto3" json:"orgs_to_skip,omitempty" toml:"orgs_to_skip,omitempty" mapstructure:"orgs_to_skip,omitempty"` + // Number of orgs to update + OrgsToUpdate int32 `protobuf:"varint,3,opt,name=orgs_to_update,json=orgsToUpdate,proto3" json:"orgs_to_update,omitempty" toml:"orgs_to_update,omitempty" mapstructure:"orgs_to_update,omitempty"` + // Number of orgs to delete + OrgsToDelete int32 `protobuf:"varint,4,opt,name=orgs_to_delete,json=orgsToDelete,proto3" json:"orgs_to_delete,omitempty" toml:"orgs_to_delete,omitempty" mapstructure:"orgs_to_delete,omitempty"` + // Users + Users []*User `protobuf:"bytes,5,rep,name=users,proto3" json:"users,omitempty" toml:"users,omitempty" mapstructure:"users,omitempty"` +} + +func (x *StagedData) Reset() { + *x = StagedData{} + if protoimpl.UnsafeEnabled { + mi := &file_interservice_infra_proxy_migrations_response_migrations_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StagedData) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StagedData) ProtoMessage() {} + +func (x *StagedData) ProtoReflect() protoreflect.Message { + mi := &file_interservice_infra_proxy_migrations_response_migrations_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StagedData.ProtoReflect.Descriptor instead. +func (*StagedData) Descriptor() ([]byte, []int) { + return file_interservice_infra_proxy_migrations_response_migrations_proto_rawDescGZIP(), []int{4} +} + +func (x *StagedData) GetOrgsToMigrate() int32 { + if x != nil { + return x.OrgsToMigrate + } + return 0 +} + +func (x *StagedData) GetOrgsToSkip() int32 { + if x != nil { + return x.OrgsToSkip + } + return 0 +} + +func (x *StagedData) GetOrgsToUpdate() int32 { + if x != nil { + return x.OrgsToUpdate + } + return 0 +} + +func (x *StagedData) GetOrgsToDelete() int32 { + if x != nil { + return x.OrgsToDelete + } + return 0 +} + +func (x *StagedData) GetUsers() []*User { + if x != nil { + return x.Users + } + return nil +} + +type User struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // User's username + Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty" toml:"username,omitempty" mapstructure:"username,omitempty"` + // User's email ID + Email string `protobuf:"bytes,2,opt,name=email,proto3" json:"email,omitempty" toml:"email,omitempty" mapstructure:"email,omitempty"` + // User's display name + DisplayName string `protobuf:"bytes,3,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty" toml:"display_name,omitempty" mapstructure:"display_name,omitempty"` + // User's first name + FirstName string `protobuf:"bytes,4,opt,name=first_name,json=firstName,proto3" json:"first_name,omitempty" toml:"first_name,omitempty" mapstructure:"first_name,omitempty"` + // User's last name + LastName string `protobuf:"bytes,5,opt,name=last_name,json=lastName,proto3" json:"last_name,omitempty" toml:"last_name,omitempty" mapstructure:"last_name,omitempty"` + // User's middle name + MiddleName string `protobuf:"bytes,6,opt,name=middle_name,json=middleName,proto3" json:"middle_name,omitempty" toml:"middle_name,omitempty" mapstructure:"middle_name,omitempty"` + // User's username in automate + AutomateUsername string `protobuf:"bytes,7,opt,name=automate_username,json=automateUsername,proto3" json:"automate_username,omitempty" toml:"automate_username,omitempty" mapstructure:"automate_username,omitempty"` + // Local or ldap user + Connector string `protobuf:"bytes,8,opt,name=connector,proto3" json:"connector,omitempty" toml:"connector,omitempty" mapstructure:"connector,omitempty"` + // IsConflicting for user's existance in db + IsConflicting bool `protobuf:"varint,9,opt,name=is_conflicting,json=isConflicting,proto3" json:"is_conflicting,omitempty" toml:"is_conflicting,omitempty" mapstructure:"is_conflicting,omitempty"` + // user is admin or not + IsAdmin bool `protobuf:"varint,10,opt,name=is_admin,json=isAdmin,proto3" json:"is_admin,omitempty" toml:"is_admin,omitempty" mapstructure:"is_admin,omitempty"` +} + +func (x *User) Reset() { + *x = User{} + if protoimpl.UnsafeEnabled { + mi := &file_interservice_infra_proxy_migrations_response_migrations_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *User) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*User) ProtoMessage() {} + +func (x *User) ProtoReflect() protoreflect.Message { + mi := &file_interservice_infra_proxy_migrations_response_migrations_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use User.ProtoReflect.Descriptor instead. +func (*User) Descriptor() ([]byte, []int) { + return file_interservice_infra_proxy_migrations_response_migrations_proto_rawDescGZIP(), []int{5} +} + +func (x *User) GetUsername() string { + if x != nil { + return x.Username + } + return "" +} + +func (x *User) GetEmail() string { + if x != nil { + return x.Email + } + return "" +} + +func (x *User) GetDisplayName() string { + if x != nil { + return x.DisplayName + } + return "" +} + +func (x *User) GetFirstName() string { + if x != nil { + return x.FirstName + } + return "" +} + +func (x *User) GetLastName() string { + if x != nil { + return x.LastName + } + return "" +} + +func (x *User) GetMiddleName() string { + if x != nil { + return x.MiddleName + } + return "" +} + +func (x *User) GetAutomateUsername() string { + if x != nil { + return x.AutomateUsername + } + return "" +} + +func (x *User) GetConnector() string { + if x != nil { + return x.Connector + } + return "" +} + +func (x *User) GetIsConflicting() bool { + if x != nil { + return x.IsConflicting + } + return false +} + +func (x *User) GetIsAdmin() bool { + if x != nil { + return x.IsAdmin + } + return false +} + var File_interservice_infra_proxy_migrations_response_migrations_proto protoreflect.FileDescriptor var file_interservice_infra_proxy_migrations_response_migrations_proto_rawDesc = []byte{ @@ -231,25 +501,72 @@ var file_interservice_infra_proxy_migrations_response_migrations_proto_rawDesc = 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x65, 0x72, 0x72, 0x6f, - 0x72, 0x73, 0x22, 0x89, 0x01, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x6d, 0x69, 0x67, - 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0b, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x25, 0x0a, 0x0e, - 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, - 0x79, 0x70, 0x65, 0x12, 0x29, 0x0a, 0x10, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x6d, - 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x4b, - 0x0a, 0x17, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x63, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, - 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, - 0x65, 0x73, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x18, 0x02, 0x20, - 0x03, 0x28, 0x09, 0x52, 0x06, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x42, 0x4b, 0x5a, 0x49, 0x67, - 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x68, 0x65, 0x66, 0x2f, 0x61, - 0x75, 0x74, 0x6f, 0x6d, 0x61, 0x74, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x69, 0x6e, 0x74, 0x65, - 0x72, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x69, 0x6e, 0x66, 0x72, 0x61, 0x5f, 0x70, - 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, - 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x72, 0x73, 0x22, 0x91, 0x01, 0x0a, 0x1a, 0x47, 0x65, 0x74, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x25, 0x0a, 0x0e, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6d, 0x69, + 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x29, 0x0a, 0x10, 0x6d, + 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x4b, 0x0a, 0x17, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, + 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x65, + 0x72, 0x72, 0x6f, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x65, 0x72, 0x72, + 0x6f, 0x72, 0x73, 0x22, 0x9d, 0x01, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x67, 0x65, + 0x64, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x21, 0x0a, + 0x0c, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, + 0x12, 0x61, 0x0a, 0x0b, 0x73, 0x74, 0x61, 0x67, 0x65, 0x64, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x40, 0x2e, 0x63, 0x68, 0x65, 0x66, 0x2e, 0x61, 0x75, 0x74, + 0x6f, 0x6d, 0x61, 0x74, 0x65, 0x2e, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x69, 0x6e, 0x66, + 0x72, 0x61, 0x5f, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x2e, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x53, 0x74, 0x61, + 0x67, 0x65, 0x64, 0x44, 0x61, 0x74, 0x61, 0x52, 0x0a, 0x73, 0x74, 0x61, 0x67, 0x65, 0x64, 0x44, + 0x61, 0x74, 0x61, 0x22, 0xf4, 0x01, 0x0a, 0x0a, 0x53, 0x74, 0x61, 0x67, 0x65, 0x64, 0x44, 0x61, + 0x74, 0x61, 0x12, 0x26, 0x0a, 0x0f, 0x6f, 0x72, 0x67, 0x73, 0x5f, 0x74, 0x6f, 0x5f, 0x6d, 0x69, + 0x67, 0x72, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0d, 0x6f, 0x72, 0x67, + 0x73, 0x54, 0x6f, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x65, 0x12, 0x20, 0x0a, 0x0c, 0x6f, 0x72, + 0x67, 0x73, 0x5f, 0x74, 0x6f, 0x5f, 0x73, 0x6b, 0x69, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x0a, 0x6f, 0x72, 0x67, 0x73, 0x54, 0x6f, 0x53, 0x6b, 0x69, 0x70, 0x12, 0x24, 0x0a, 0x0e, + 0x6f, 0x72, 0x67, 0x73, 0x5f, 0x74, 0x6f, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x6f, 0x72, 0x67, 0x73, 0x54, 0x6f, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x12, 0x24, 0x0a, 0x0e, 0x6f, 0x72, 0x67, 0x73, 0x5f, 0x74, 0x6f, 0x5f, 0x64, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x6f, 0x72, 0x67, 0x73, + 0x54, 0x6f, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x50, 0x0a, 0x05, 0x75, 0x73, 0x65, 0x72, + 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3a, 0x2e, 0x63, 0x68, 0x65, 0x66, 0x2e, 0x61, + 0x75, 0x74, 0x6f, 0x6d, 0x61, 0x74, 0x65, 0x2e, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x69, + 0x6e, 0x66, 0x72, 0x61, 0x5f, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x6d, 0x69, 0x67, 0x72, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x75, + 0x73, 0x65, 0x72, 0x52, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73, 0x22, 0xc5, 0x02, 0x0a, 0x04, 0x75, + 0x73, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, + 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, + 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x21, 0x0a, 0x0c, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, + 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x69, 0x73, + 0x70, 0x6c, 0x61, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x66, 0x69, 0x72, 0x73, + 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x66, 0x69, + 0x72, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x6c, 0x61, 0x73, 0x74, 0x5f, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6c, 0x61, 0x73, 0x74, + 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x69, 0x64, 0x64, 0x6c, 0x65, 0x5f, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6d, 0x69, 0x64, 0x64, 0x6c, + 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x2b, 0x0a, 0x11, 0x61, 0x75, 0x74, 0x6f, 0x6d, 0x61, 0x74, + 0x65, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x10, 0x61, 0x75, 0x74, 0x6f, 0x6d, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x6e, 0x61, + 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x18, + 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x6f, 0x72, + 0x12, 0x25, 0x0a, 0x0e, 0x69, 0x73, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x6c, 0x69, 0x63, 0x74, 0x69, + 0x6e, 0x67, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x69, 0x73, 0x43, 0x6f, 0x6e, 0x66, + 0x6c, 0x69, 0x63, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x19, 0x0a, 0x08, 0x69, 0x73, 0x5f, 0x61, 0x64, + 0x6d, 0x69, 0x6e, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x69, 0x73, 0x41, 0x64, 0x6d, + 0x69, 0x6e, 0x42, 0x4b, 0x5a, 0x49, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x63, 0x68, 0x65, 0x66, 0x2f, 0x61, 0x75, 0x74, 0x6f, 0x6d, 0x61, 0x74, 0x65, 0x2f, 0x61, + 0x70, 0x69, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, + 0x69, 0x6e, 0x66, 0x72, 0x61, 0x5f, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x6d, 0x69, 0x67, 0x72, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -264,18 +581,23 @@ func file_interservice_infra_proxy_migrations_response_migrations_proto_rawDescG return file_interservice_infra_proxy_migrations_response_migrations_proto_rawDescData } -var file_interservice_infra_proxy_migrations_response_migrations_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_interservice_infra_proxy_migrations_response_migrations_proto_msgTypes = make([]protoimpl.MessageInfo, 6) var file_interservice_infra_proxy_migrations_response_migrations_proto_goTypes = []interface{}{ - (*UploadZipFileResponse)(nil), // 0: chef.automate.domain.infra_proxy.migrations.response.UploadZipFileResponse - (*GetMigrationStatus)(nil), // 1: chef.automate.domain.infra_proxy.migrations.response.GetMigrationStatus - (*CancelMigrationResponce)(nil), // 2: chef.automate.domain.infra_proxy.migrations.response.CancelMigrationResponce + (*UploadZipFileResponse)(nil), // 0: chef.automate.domain.infra_proxy.migrations.response.UploadZipFileResponse + (*GetMigrationStatusResponse)(nil), // 1: chef.automate.domain.infra_proxy.migrations.response.GetMigrationStatusResponse + (*CancelMigrationResponse)(nil), // 2: chef.automate.domain.infra_proxy.migrations.response.CancelMigrationResponse + (*GetStagedDataResponse)(nil), // 3: chef.automate.domain.infra_proxy.migrations.response.GetStagedDataResponse + (*StagedData)(nil), // 4: chef.automate.domain.infra_proxy.migrations.response.StagedData + (*User)(nil), // 5: chef.automate.domain.infra_proxy.migrations.response.user } var file_interservice_infra_proxy_migrations_response_migrations_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name + 4, // 0: chef.automate.domain.infra_proxy.migrations.response.GetStagedDataResponse.staged_data:type_name -> chef.automate.domain.infra_proxy.migrations.response.StagedData + 5, // 1: chef.automate.domain.infra_proxy.migrations.response.StagedData.users:type_name -> chef.automate.domain.infra_proxy.migrations.response.user + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name } func init() { file_interservice_infra_proxy_migrations_response_migrations_proto_init() } @@ -297,7 +619,7 @@ func file_interservice_infra_proxy_migrations_response_migrations_proto_init() { } } file_interservice_infra_proxy_migrations_response_migrations_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetMigrationStatus); i { + switch v := v.(*GetMigrationStatusResponse); i { case 0: return &v.state case 1: @@ -309,7 +631,43 @@ func file_interservice_infra_proxy_migrations_response_migrations_proto_init() { } } file_interservice_infra_proxy_migrations_response_migrations_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CancelMigrationResponce); i { + switch v := v.(*CancelMigrationResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_interservice_infra_proxy_migrations_response_migrations_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetStagedDataResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_interservice_infra_proxy_migrations_response_migrations_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StagedData); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_interservice_infra_proxy_migrations_response_migrations_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*User); i { case 0: return &v.state case 1: @@ -327,7 +685,7 @@ func file_interservice_infra_proxy_migrations_response_migrations_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_interservice_infra_proxy_migrations_response_migrations_proto_rawDesc, NumEnums: 0, - NumMessages: 3, + NumMessages: 6, NumExtensions: 0, NumServices: 0, }, diff --git a/api/interservice/infra_proxy/migrations/response/migrations.proto b/api/interservice/infra_proxy/migrations/response/migrations.proto index 72f9dc47332..92305b86ef4 100644 --- a/api/interservice/infra_proxy/migrations/response/migrations.proto +++ b/api/interservice/infra_proxy/migrations/response/migrations.proto @@ -12,7 +12,7 @@ message UploadZipFileResponse { repeated string errors = 3; } -message GetMigrationStatus { +message GetMigrationStatusResponse { // Migration ID. string migration_id = 1; // Migration type @@ -21,9 +21,52 @@ message GetMigrationStatus { string migration_status = 3; } -message CancelMigrationResponce { +message CancelMigrationResponse { // migration ID bool success = 1; // Error message repeated string errors = 2; } + +message GetStagedDataResponse { + // Migration ID. + string migration_id =1; + // Staged data + StagedData staged_data = 2; +} + +message StagedData { + // Number of orgs to migrate + int32 orgs_to_migrate =1; + // Number of orgs to skip + int32 orgs_to_skip =2; + // Number of orgs to update + int32 orgs_to_update =3; + // Number of orgs to delete + int32 orgs_to_delete =4; + // Users + repeated user users =5; +} + +message user { + // User's username + string username =1; + // User's email ID + string email =2; + // User's display name + string display_name=3; + // User's first name + string first_name=4; + // User's last name + string last_name=5; + // User's middle name + string middle_name=6; + // User's username in automate + string automate_username =7; + // Local or ldap user + string connector=8; + // IsConflicting for user's existance in db + bool is_conflicting=9; + // user is admin or not + bool is_admin=10; +} diff --git a/api/interservice/infra_proxy/migrations/service/migrations.pb.go b/api/interservice/infra_proxy/migrations/service/migrations.pb.go index 9bcb9af8e9e..cf41cd8f429 100644 --- a/api/interservice/infra_proxy/migrations/service/migrations.pb.go +++ b/api/interservice/infra_proxy/migrations/service/migrations.pb.go @@ -50,8 +50,8 @@ var file_interservice_infra_proxy_migrations_service_migrations_proto_rawDesc = 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2f, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, - 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x9f, - 0x04, 0x0a, 0x14, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x61, 0x74, 0x61, + 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0xda, + 0x05, 0x0a, 0x14, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x61, 0x74, 0x61, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0xa8, 0x01, 0x0a, 0x0a, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x49, 0x2e, 0x63, 0x68, 0x65, 0x66, 0x2e, 0x61, 0x75, 0x74, 0x6f, 0x6d, 0x61, 0x74, 0x65, 0x2e, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x69, 0x6e, @@ -63,53 +63,68 @@ var file_interservice_infra_proxy_migrations_service_migrations_proto_rawDesc = 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x5a, 0x69, 0x70, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, - 0x28, 0x01, 0x12, 0xa9, 0x01, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x47, 0x2e, 0x63, 0x68, 0x65, 0x66, + 0x28, 0x01, 0x12, 0xb8, 0x01, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x4e, 0x2e, 0x63, 0x68, 0x65, 0x66, 0x2e, 0x61, 0x75, 0x74, 0x6f, 0x6d, 0x61, 0x74, 0x65, 0x2e, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x69, 0x6e, 0x66, 0x72, 0x61, 0x5f, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x1a, 0x48, 0x2e, 0x63, 0x68, 0x65, 0x66, 0x2e, 0x61, 0x75, 0x74, 0x6f, 0x6d, 0x61, - 0x74, 0x65, 0x2e, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x69, 0x6e, 0x66, 0x72, 0x61, 0x5f, - 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x2e, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x69, 0x67, - 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x00, 0x12, 0xaf, - 0x01, 0x0a, 0x0f, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x12, 0x4b, 0x2e, 0x63, 0x68, 0x65, 0x66, 0x2e, 0x61, 0x75, 0x74, 0x6f, 0x6d, 0x61, - 0x74, 0x65, 0x2e, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x69, 0x6e, 0x66, 0x72, 0x61, 0x5f, - 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x2e, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x4d, - 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x4d, 0x2e, 0x63, 0x68, 0x65, 0x66, 0x2e, 0x61, 0x75, 0x74, 0x6f, 0x6d, 0x61, 0x74, 0x65, 0x2e, - 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x69, 0x6e, 0x66, 0x72, 0x61, 0x5f, 0x70, 0x72, 0x6f, - 0x78, 0x79, 0x2e, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x72, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x4d, 0x69, 0x67, - 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x63, 0x65, 0x22, 0x00, - 0x42, 0x4a, 0x5a, 0x48, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, - 0x68, 0x65, 0x66, 0x2f, 0x61, 0x75, 0x74, 0x6f, 0x6d, 0x61, 0x74, 0x65, 0x2f, 0x61, 0x70, 0x69, - 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x69, 0x6e, - 0x66, 0x72, 0x61, 0x5f, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x50, 0x2e, 0x63, 0x68, 0x65, 0x66, + 0x2e, 0x61, 0x75, 0x74, 0x6f, 0x6d, 0x61, 0x74, 0x65, 0x2e, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, + 0x2e, 0x69, 0x6e, 0x66, 0x72, 0x61, 0x5f, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x6d, 0x69, 0x67, + 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0xaf, 0x01, + 0x0a, 0x0f, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x12, 0x4b, 0x2e, 0x63, 0x68, 0x65, 0x66, 0x2e, 0x61, 0x75, 0x74, 0x6f, 0x6d, 0x61, 0x74, + 0x65, 0x2e, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x69, 0x6e, 0x66, 0x72, 0x61, 0x5f, 0x70, + 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, + 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x4d, 0x69, + 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x4d, + 0x2e, 0x63, 0x68, 0x65, 0x66, 0x2e, 0x61, 0x75, 0x74, 0x6f, 0x6d, 0x61, 0x74, 0x65, 0x2e, 0x64, + 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x69, 0x6e, 0x66, 0x72, 0x61, 0x5f, 0x70, 0x72, 0x6f, 0x78, + 0x79, 0x2e, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x72, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x4d, 0x69, 0x67, 0x72, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, + 0xa9, 0x01, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x67, 0x65, 0x64, 0x44, 0x61, 0x74, + 0x61, 0x12, 0x49, 0x2e, 0x63, 0x68, 0x65, 0x66, 0x2e, 0x61, 0x75, 0x74, 0x6f, 0x6d, 0x61, 0x74, + 0x65, 0x2e, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x69, 0x6e, 0x66, 0x72, 0x61, 0x5f, 0x70, + 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, + 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x67, 0x65, + 0x64, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x4b, 0x2e, 0x63, + 0x68, 0x65, 0x66, 0x2e, 0x61, 0x75, 0x74, 0x6f, 0x6d, 0x61, 0x74, 0x65, 0x2e, 0x64, 0x6f, 0x6d, + 0x61, 0x69, 0x6e, 0x2e, 0x69, 0x6e, 0x66, 0x72, 0x61, 0x5f, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, + 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x72, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x67, 0x65, 0x64, 0x44, 0x61, 0x74, + 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x4a, 0x5a, 0x48, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x68, 0x65, 0x66, 0x2f, 0x61, + 0x75, 0x74, 0x6f, 0x6d, 0x61, 0x74, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x69, 0x6e, 0x74, 0x65, + 0x72, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x69, 0x6e, 0x66, 0x72, 0x61, 0x5f, 0x70, + 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var file_interservice_infra_proxy_migrations_service_migrations_proto_goTypes = []interface{}{ - (*request.UploadZipFileRequest)(nil), // 0: chef.automate.domain.infra_proxy.migrations.request.UploadZipFileRequest - (*request.GetMigrationStatus)(nil), // 1: chef.automate.domain.infra_proxy.migrations.request.GetMigrationStatus - (*request.CancelMigrationRequest)(nil), // 2: chef.automate.domain.infra_proxy.migrations.request.CancelMigrationRequest - (*response.UploadZipFileResponse)(nil), // 3: chef.automate.domain.infra_proxy.migrations.response.UploadZipFileResponse - (*response.GetMigrationStatus)(nil), // 4: chef.automate.domain.infra_proxy.migrations.response.GetMigrationStatus - (*response.CancelMigrationResponce)(nil), // 5: chef.automate.domain.infra_proxy.migrations.response.CancelMigrationResponce + (*request.UploadZipFileRequest)(nil), // 0: chef.automate.domain.infra_proxy.migrations.request.UploadZipFileRequest + (*request.GetMigrationStatusRequest)(nil), // 1: chef.automate.domain.infra_proxy.migrations.request.GetMigrationStatusRequest + (*request.CancelMigrationRequest)(nil), // 2: chef.automate.domain.infra_proxy.migrations.request.CancelMigrationRequest + (*request.GetStagedDataRequest)(nil), // 3: chef.automate.domain.infra_proxy.migrations.request.GetStagedDataRequest + (*response.UploadZipFileResponse)(nil), // 4: chef.automate.domain.infra_proxy.migrations.response.UploadZipFileResponse + (*response.GetMigrationStatusResponse)(nil), // 5: chef.automate.domain.infra_proxy.migrations.response.GetMigrationStatusResponse + (*response.CancelMigrationResponse)(nil), // 6: chef.automate.domain.infra_proxy.migrations.response.CancelMigrationResponse + (*response.GetStagedDataResponse)(nil), // 7: chef.automate.domain.infra_proxy.migrations.response.GetStagedDataResponse } var file_interservice_infra_proxy_migrations_service_migrations_proto_depIdxs = []int32{ 0, // 0: chef.automate.domain.infra_proxy.migrations.service.MigrationDataService.UploadFile:input_type -> chef.automate.domain.infra_proxy.migrations.request.UploadZipFileRequest - 1, // 1: chef.automate.domain.infra_proxy.migrations.service.MigrationDataService.GetMigrationStatus:input_type -> chef.automate.domain.infra_proxy.migrations.request.GetMigrationStatus + 1, // 1: chef.automate.domain.infra_proxy.migrations.service.MigrationDataService.GetMigrationStatus:input_type -> chef.automate.domain.infra_proxy.migrations.request.GetMigrationStatusRequest 2, // 2: chef.automate.domain.infra_proxy.migrations.service.MigrationDataService.CancelMigration:input_type -> chef.automate.domain.infra_proxy.migrations.request.CancelMigrationRequest - 3, // 3: chef.automate.domain.infra_proxy.migrations.service.MigrationDataService.UploadFile:output_type -> chef.automate.domain.infra_proxy.migrations.response.UploadZipFileResponse - 4, // 4: chef.automate.domain.infra_proxy.migrations.service.MigrationDataService.GetMigrationStatus:output_type -> chef.automate.domain.infra_proxy.migrations.response.GetMigrationStatus - 5, // 5: chef.automate.domain.infra_proxy.migrations.service.MigrationDataService.CancelMigration:output_type -> chef.automate.domain.infra_proxy.migrations.response.CancelMigrationResponce - 3, // [3:6] is the sub-list for method output_type - 0, // [0:3] is the sub-list for method input_type + 3, // 3: chef.automate.domain.infra_proxy.migrations.service.MigrationDataService.GetStagedData:input_type -> chef.automate.domain.infra_proxy.migrations.request.GetStagedDataRequest + 4, // 4: chef.automate.domain.infra_proxy.migrations.service.MigrationDataService.UploadFile:output_type -> chef.automate.domain.infra_proxy.migrations.response.UploadZipFileResponse + 5, // 5: chef.automate.domain.infra_proxy.migrations.service.MigrationDataService.GetMigrationStatus:output_type -> chef.automate.domain.infra_proxy.migrations.response.GetMigrationStatusResponse + 6, // 6: chef.automate.domain.infra_proxy.migrations.service.MigrationDataService.CancelMigration:output_type -> chef.automate.domain.infra_proxy.migrations.response.CancelMigrationResponse + 7, // 7: chef.automate.domain.infra_proxy.migrations.service.MigrationDataService.GetStagedData:output_type -> chef.automate.domain.infra_proxy.migrations.response.GetStagedDataResponse + 4, // [4:8] is the sub-list for method output_type + 0, // [0:4] is the sub-list for method input_type 0, // [0:0] is the sub-list for extension type_name 0, // [0:0] is the sub-list for extension extendee 0, // [0:0] is the sub-list for field type_name @@ -152,8 +167,9 @@ const _ = grpc.SupportPackageIsVersion6 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MigrationDataServiceClient interface { UploadFile(ctx context.Context, opts ...grpc.CallOption) (MigrationDataService_UploadFileClient, error) - GetMigrationStatus(ctx context.Context, in *request.GetMigrationStatus, opts ...grpc.CallOption) (*response.GetMigrationStatus, error) - CancelMigration(ctx context.Context, in *request.CancelMigrationRequest, opts ...grpc.CallOption) (*response.CancelMigrationResponce, error) + GetMigrationStatus(ctx context.Context, in *request.GetMigrationStatusRequest, opts ...grpc.CallOption) (*response.GetMigrationStatusResponse, error) + CancelMigration(ctx context.Context, in *request.CancelMigrationRequest, opts ...grpc.CallOption) (*response.CancelMigrationResponse, error) + GetStagedData(ctx context.Context, in *request.GetStagedDataRequest, opts ...grpc.CallOption) (*response.GetStagedDataResponse, error) } type migrationDataServiceClient struct { @@ -198,8 +214,8 @@ func (x *migrationDataServiceUploadFileClient) CloseAndRecv() (*response.UploadZ return m, nil } -func (c *migrationDataServiceClient) GetMigrationStatus(ctx context.Context, in *request.GetMigrationStatus, opts ...grpc.CallOption) (*response.GetMigrationStatus, error) { - out := new(response.GetMigrationStatus) +func (c *migrationDataServiceClient) GetMigrationStatus(ctx context.Context, in *request.GetMigrationStatusRequest, opts ...grpc.CallOption) (*response.GetMigrationStatusResponse, error) { + out := new(response.GetMigrationStatusResponse) err := c.cc.Invoke(ctx, "/chef.automate.domain.infra_proxy.migrations.service.MigrationDataService/GetMigrationStatus", in, out, opts...) if err != nil { return nil, err @@ -207,8 +223,8 @@ func (c *migrationDataServiceClient) GetMigrationStatus(ctx context.Context, in return out, nil } -func (c *migrationDataServiceClient) CancelMigration(ctx context.Context, in *request.CancelMigrationRequest, opts ...grpc.CallOption) (*response.CancelMigrationResponce, error) { - out := new(response.CancelMigrationResponce) +func (c *migrationDataServiceClient) CancelMigration(ctx context.Context, in *request.CancelMigrationRequest, opts ...grpc.CallOption) (*response.CancelMigrationResponse, error) { + out := new(response.CancelMigrationResponse) err := c.cc.Invoke(ctx, "/chef.automate.domain.infra_proxy.migrations.service.MigrationDataService/CancelMigration", in, out, opts...) if err != nil { return nil, err @@ -216,11 +232,21 @@ func (c *migrationDataServiceClient) CancelMigration(ctx context.Context, in *re return out, nil } +func (c *migrationDataServiceClient) GetStagedData(ctx context.Context, in *request.GetStagedDataRequest, opts ...grpc.CallOption) (*response.GetStagedDataResponse, error) { + out := new(response.GetStagedDataResponse) + err := c.cc.Invoke(ctx, "/chef.automate.domain.infra_proxy.migrations.service.MigrationDataService/GetStagedData", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MigrationDataServiceServer is the server API for MigrationDataService service. type MigrationDataServiceServer interface { UploadFile(MigrationDataService_UploadFileServer) error - GetMigrationStatus(context.Context, *request.GetMigrationStatus) (*response.GetMigrationStatus, error) - CancelMigration(context.Context, *request.CancelMigrationRequest) (*response.CancelMigrationResponce, error) + GetMigrationStatus(context.Context, *request.GetMigrationStatusRequest) (*response.GetMigrationStatusResponse, error) + CancelMigration(context.Context, *request.CancelMigrationRequest) (*response.CancelMigrationResponse, error) + GetStagedData(context.Context, *request.GetStagedDataRequest) (*response.GetStagedDataResponse, error) } // UnimplementedMigrationDataServiceServer can be embedded to have forward compatible implementations. @@ -230,12 +256,15 @@ type UnimplementedMigrationDataServiceServer struct { func (*UnimplementedMigrationDataServiceServer) UploadFile(MigrationDataService_UploadFileServer) error { return status.Errorf(codes.Unimplemented, "method UploadFile not implemented") } -func (*UnimplementedMigrationDataServiceServer) GetMigrationStatus(context.Context, *request.GetMigrationStatus) (*response.GetMigrationStatus, error) { +func (*UnimplementedMigrationDataServiceServer) GetMigrationStatus(context.Context, *request.GetMigrationStatusRequest) (*response.GetMigrationStatusResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetMigrationStatus not implemented") } -func (*UnimplementedMigrationDataServiceServer) CancelMigration(context.Context, *request.CancelMigrationRequest) (*response.CancelMigrationResponce, error) { +func (*UnimplementedMigrationDataServiceServer) CancelMigration(context.Context, *request.CancelMigrationRequest) (*response.CancelMigrationResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method CancelMigration not implemented") } +func (*UnimplementedMigrationDataServiceServer) GetStagedData(context.Context, *request.GetStagedDataRequest) (*response.GetStagedDataResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetStagedData not implemented") +} func RegisterMigrationDataServiceServer(s *grpc.Server, srv MigrationDataServiceServer) { s.RegisterService(&_MigrationDataService_serviceDesc, srv) @@ -268,7 +297,7 @@ func (x *migrationDataServiceUploadFileServer) Recv() (*request.UploadZipFileReq } func _MigrationDataService_GetMigrationStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(request.GetMigrationStatus) + in := new(request.GetMigrationStatusRequest) if err := dec(in); err != nil { return nil, err } @@ -280,7 +309,7 @@ func _MigrationDataService_GetMigrationStatus_Handler(srv interface{}, ctx conte FullMethod: "/chef.automate.domain.infra_proxy.migrations.service.MigrationDataService/GetMigrationStatus", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MigrationDataServiceServer).GetMigrationStatus(ctx, req.(*request.GetMigrationStatus)) + return srv.(MigrationDataServiceServer).GetMigrationStatus(ctx, req.(*request.GetMigrationStatusRequest)) } return interceptor(ctx, in, info, handler) } @@ -303,6 +332,24 @@ func _MigrationDataService_CancelMigration_Handler(srv interface{}, ctx context. return interceptor(ctx, in, info, handler) } +func _MigrationDataService_GetStagedData_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(request.GetStagedDataRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MigrationDataServiceServer).GetStagedData(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/chef.automate.domain.infra_proxy.migrations.service.MigrationDataService/GetStagedData", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MigrationDataServiceServer).GetStagedData(ctx, req.(*request.GetStagedDataRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _MigrationDataService_serviceDesc = grpc.ServiceDesc{ ServiceName: "chef.automate.domain.infra_proxy.migrations.service.MigrationDataService", HandlerType: (*MigrationDataServiceServer)(nil), @@ -315,6 +362,10 @@ var _MigrationDataService_serviceDesc = grpc.ServiceDesc{ MethodName: "CancelMigration", Handler: _MigrationDataService_CancelMigration_Handler, }, + { + MethodName: "GetStagedData", + Handler: _MigrationDataService_GetStagedData_Handler, + }, }, Streams: []grpc.StreamDesc{ { diff --git a/api/interservice/infra_proxy/migrations/service/migrations.proto b/api/interservice/infra_proxy/migrations/service/migrations.proto index 02514b28bd9..5af38fbe07b 100644 --- a/api/interservice/infra_proxy/migrations/service/migrations.proto +++ b/api/interservice/infra_proxy/migrations/service/migrations.proto @@ -10,6 +10,7 @@ import "google/api/annotations.proto"; service MigrationDataService{ rpc UploadFile (stream chef.automate.domain.infra_proxy.migrations.request.UploadZipFileRequest) returns (chef.automate.domain.infra_proxy.migrations.response.UploadZipFileResponse) {}; - rpc GetMigrationStatus (chef.automate.domain.infra_proxy.migrations.request.GetMigrationStatus) returns (chef.automate.domain.infra_proxy.migrations.response.GetMigrationStatus) {}; - rpc CancelMigration (chef.automate.domain.infra_proxy.migrations.request.CancelMigrationRequest) returns (chef.automate.domain.infra_proxy.migrations.response.CancelMigrationResponce) {}; + rpc GetMigrationStatus (chef.automate.domain.infra_proxy.migrations.request.GetMigrationStatusRequest) returns (chef.automate.domain.infra_proxy.migrations.response.GetMigrationStatusResponse) {}; + rpc CancelMigration (chef.automate.domain.infra_proxy.migrations.request.CancelMigrationRequest) returns (chef.automate.domain.infra_proxy.migrations.response.CancelMigrationResponse) {}; + rpc GetStagedData (chef.automate.domain.infra_proxy.migrations.request.GetStagedDataRequest) returns (chef.automate.domain.infra_proxy.migrations.response.GetStagedDataResponse) {}; } diff --git a/components/automate-gateway/api/migrations.pb.swagger.go b/components/automate-gateway/api/migrations.pb.swagger.go index db17dcae60a..98cbf681f8e 100644 --- a/components/automate-gateway/api/migrations.pb.swagger.go +++ b/components/automate-gateway/api/migrations.pb.swagger.go @@ -14,6 +14,37 @@ func init() { "application/json" ], "paths": { + "/api/v0/infra/servers/migrations/staged_data/{migration_id}": { + "get": { + "operationId": "InfraProxyMigration_GetStagedData", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/chef.automate.api.infra_proxy.migrations.response.GetStagedDataResponse" + } + }, + "default": { + "description": "An unexpected error response", + "schema": { + "$ref": "#/definitions/grpc.gateway.runtime.Error" + } + } + }, + "parameters": [ + { + "name": "migration_id", + "description": "Migration ID", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": [ + "InfraProxyMigration" + ] + } + }, "/api/v0/infra/servers/migrations/status/{migration_id}": { "get": { "operationId": "InfraProxyMigration_GetMigrationStatus", @@ -21,7 +52,7 @@ func init() { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/chef.automate.api.infra_proxy.migrations.response.GetMigrationStatus" + "$ref": "#/definitions/chef.automate.api.infra_proxy.migrations.response.GetMigrationStatusResponse" } }, "default": { @@ -52,7 +83,7 @@ func init() { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/chef.automate.api.infra_proxy.migrations.response.CancelMigrationResponce" + "$ref": "#/definitions/chef.automate.api.infra_proxy.migrations.response.CancelMigrationResponse" } }, "default": { @@ -85,7 +116,7 @@ func init() { } }, "definitions": { - "chef.automate.api.infra_proxy.migrations.response.CancelMigrationResponce": { + "chef.automate.api.infra_proxy.migrations.response.CancelMigrationResponse": { "type": "object", "properties": { "success": { @@ -102,7 +133,7 @@ func init() { } } }, - "chef.automate.api.infra_proxy.migrations.response.GetMigrationStatus": { + "chef.automate.api.infra_proxy.migrations.response.GetMigrationStatusResponse": { "type": "object", "properties": { "migration_id": { @@ -119,6 +150,98 @@ func init() { } } }, + "chef.automate.api.infra_proxy.migrations.response.GetStagedDataResponse": { + "type": "object", + "properties": { + "migration_id": { + "type": "string", + "description": "Migration ID." + }, + "staged_data": { + "$ref": "#/definitions/chef.automate.api.infra_proxy.migrations.response.StagedData", + "title": "Staged data" + } + } + }, + "chef.automate.api.infra_proxy.migrations.response.StagedData": { + "type": "object", + "properties": { + "orgs_to_migrate": { + "type": "integer", + "format": "int32", + "title": "Number of orgs to migrate" + }, + "orgs_to_skip": { + "type": "integer", + "format": "int32", + "title": "Number of orgs to skip" + }, + "orgs_to_update": { + "type": "integer", + "format": "int32", + "title": "Number of orgs to update" + }, + "orgs_to_delete": { + "type": "integer", + "format": "int32", + "title": "Number of orgs to delete" + }, + "users": { + "type": "array", + "items": { + "$ref": "#/definitions/chef.automate.api.infra_proxy.migrations.response.user" + }, + "title": "Users" + } + } + }, + "chef.automate.api.infra_proxy.migrations.response.user": { + "type": "object", + "properties": { + "username": { + "type": "string", + "title": "User's username" + }, + "email": { + "type": "string", + "title": "User's email ID" + }, + "display_name": { + "type": "string", + "title": "User's display name" + }, + "first_name": { + "type": "string", + "title": "User's first name" + }, + "last_name": { + "type": "string", + "title": "User's last name" + }, + "middle_name": { + "type": "string", + "title": "User's middle name" + }, + "automate_username": { + "type": "string", + "title": "User's username in automate" + }, + "connector": { + "type": "string", + "title": "Local or ldap user" + }, + "is_conflicting": { + "type": "boolean", + "format": "boolean", + "title": "IsConflicting for user's existance in db" + }, + "is_admin": { + "type": "boolean", + "format": "boolean", + "title": "user is admin or not" + } + } + }, "google.protobuf.Any": { "type": "object", "properties": { diff --git a/components/automate-gateway/handler/infra_proxy/migrations/migrations.go b/components/automate-gateway/handler/infra_proxy/migrations/migrations.go index 2d3ecd8a4e1..cfcfbdc51a6 100644 --- a/components/automate-gateway/handler/infra_proxy/migrations/migrations.go +++ b/components/automate-gateway/handler/infra_proxy/migrations/migrations.go @@ -6,11 +6,12 @@ import ( gwreq "github.com/chef/automate/api/external/infra_proxy/migrations/request" gwres "github.com/chef/automate/api/external/infra_proxy/migrations/response" infra_req "github.com/chef/automate/api/interservice/infra_proxy/migrations/request" + infra_res "github.com/chef/automate/api/interservice/infra_proxy/migrations/response" ) // GetMigrationStatus fetches the latest migration status against migration id -func (a *InfraProxyMigrationServer) GetMigrationStatus(ctx context.Context, r *gwreq.GetMigrationStatus) (*gwres.GetMigrationStatus, error) { - req := &infra_req.GetMigrationStatus{ +func (a *InfraProxyMigrationServer) GetMigrationStatus(ctx context.Context, r *gwreq.GetMigrationStatusRequest) (*gwres.GetMigrationStatusResponse, error) { + req := &infra_req.GetMigrationStatusRequest{ MigrationId: r.MigrationId, } res, err := a.migrationClient.GetMigrationStatus(ctx, req) @@ -18,7 +19,7 @@ func (a *InfraProxyMigrationServer) GetMigrationStatus(ctx context.Context, r *g return nil, err } - return &gwres.GetMigrationStatus{ + return &gwres.GetMigrationStatusResponse{ MigrationId: res.GetMigrationId(), MigrationType: res.GetMigrationType(), MigrationStatus: res.GetMigrationStatus(), @@ -26,7 +27,7 @@ func (a *InfraProxyMigrationServer) GetMigrationStatus(ctx context.Context, r *g } // CancelMigration cancel the ongoing migration -func (a *InfraProxyMigrationServer) CancelMigration(ctx context.Context, r *gwreq.CancelMigrationRequest) (*gwres.CancelMigrationResponce, error) { +func (a *InfraProxyMigrationServer) CancelMigration(ctx context.Context, r *gwreq.CancelMigrationRequest) (*gwres.CancelMigrationResponse, error) { req := &infra_req.CancelMigrationRequest{ MigrationId: r.MigrationId, } @@ -35,8 +36,56 @@ func (a *InfraProxyMigrationServer) CancelMigration(ctx context.Context, r *gwre return nil, err } - return &gwres.CancelMigrationResponce{ + return &gwres.CancelMigrationResponse{ Success: res.Success, Errors: res.Errors, }, nil } + +// GetStagedData Get the staged data from db for preview screen +func (a *InfraProxyMigrationServer) GetStagedData(ctx context.Context, r *gwreq.GetStagedDataRequest) (*gwres.GetStagedDataResponse, error) { + req := &infra_req.GetStagedDataRequest{ + MigrationId: r.MigrationId, + } + res, err := a.migrationClient.GetStagedData(ctx, req) + if err != nil { + return nil, err + } + + return &gwres.GetStagedDataResponse{ + MigrationId: res.MigrationId, + StagedData: getStagedData(res.StagedData), + }, nil +} + +func getStagedData(stageData *infra_res.StagedData) *gwres.StagedData { + users := []*gwres.User{} + if stageData != nil { + for _, user := range stageData.Users { + users = append(users, getStagedUser(user)) + } + } + + return &gwres.StagedData{ + OrgsToMigrate: stageData.GetOrgsToMigrate(), + OrgsToSkip: stageData.GetOrgsToSkip(), + OrgsToUpdate: stageData.GetOrgsToUpdate(), + OrgsToDelete: stageData.GetOrgsToDelete(), + Users: users, + } +} + +func getStagedUser(user *infra_res.User) *gwres.User { + stagedUser := &gwres.User{} + stagedUser.Username = user.Username + stagedUser.Email = user.Email + stagedUser.DisplayName = user.DisplayName + stagedUser.FirstName = user.FirstName + stagedUser.LastName = user.LastName + stagedUser.MiddleName = user.MiddleName + stagedUser.AutomateUsername = user.AutomateUsername + stagedUser.Connector = user.Connector + stagedUser.IsConflicting = user.IsConflicting + stagedUser.IsAdmin = user.IsAdmin + return stagedUser +} diff --git a/components/infra-proxy-service/integration_test/migrations.json b/components/infra-proxy-service/integration_test/migrations.json new file mode 100644 index 00000000000..f7d38269a63 --- /dev/null +++ b/components/infra-proxy-service/integration_test/migrations.json @@ -0,0 +1,98 @@ +{ + "meta": { + "server_id":"local_dev", + "migration_id": "1234" + }, + "parsed_result": { + "orgs": [ + { + "name":"org1", + "full_name":"org1_infra", + "action_ops":1 + }, + { + "name":"org2", + "full_name":"org2_infra", + "action_ops":2 + }, + { + "name":"org3", + "full_name":"org3_infra", + "action_ops":3 + }, + { + "name":"org4", + "full_name":"org4_infra", + "action_ops":4 + }, + { + "name":"org5", + "full_name":"org5_infra", + "action_ops":1 + } + ], + "users":[ + { + "username":"test1", + "email":"abc1@gmail.com" , + "display_name":"test1", + "first_name":"first1", + "last_name":"last1", + "middle_name":"middle1", + "automate_username":"test1", + "connector":"local", + "is_conflicting":true, + "is_admin":true + }, + { + "username":"test2", + "email":"abc2@gmail.com" , + "display_name":"test2", + "first_name":"first2", + "last_name":"last2", + "middle_name":"middle2", + "automate_username":"testldap2", + "connector":"ldap", + "is_conflicting":false, + "is_admin":false + }, + { + "username":"test3", + "email":"abc3@gmail.com" , + "display_name":"test3", + "first_name":"first3", + "last_name":"last3", + "middle_name":"middle3", + "automate_username":"test3", + "connector":"local", + "is_conflicting":false, + "is_admin":true + }, + { + "username":"test4", + "email":"abc4@gmail.com" , + "display_name":"test4", + "first_name":"first4", + "last_name":"last4", + "middle_name":"middle4", + "automate_username":"test4", + "connector":"local", + "is_conflicting":false, + "is_admin":false + }, + { + "username":"test5", + "email":"abc5@gmail.com" , + "display_name":"test5", + "first_name":"first5", + "last_name":"last5", + "middle_name":"middle5", + "automate_username":"test5", + "connector":"local", + "is_conflicting":false, + "is_admin":false + } + ], + "orgs_users_associations":[] + } +} diff --git a/components/infra-proxy-service/integration_test/migrations_test.go b/components/infra-proxy-service/integration_test/migrations_test.go new file mode 100644 index 00000000000..1aad5de1612 --- /dev/null +++ b/components/infra-proxy-service/integration_test/migrations_test.go @@ -0,0 +1,26 @@ +package integration_test + +import ( + "io/ioutil" + "os" + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestStorageStagedDataLoadSampleData(t *testing.T) { + + t.Run("Store the staged data from migrations.json", func(t *testing.T) { + + jsonFile, err := os.Open("./migrations.json") + assert.NoError(t, err) + + // Read data from migrations.json + byteValue, err := ioutil.ReadAll(jsonFile) + assert.NoError(t, err) + + err = infraProxyMigration.StoreStagedData(ctx, "1234", byteValue) + assert.NoError(t, err) + + }) +} diff --git a/components/infra-proxy-service/integration_test/suite_test.go b/components/infra-proxy-service/integration_test/suite_test.go index 5e3b142cdf7..99dd2a3e59c 100644 --- a/components/infra-proxy-service/integration_test/suite_test.go +++ b/components/infra-proxy-service/integration_test/suite_test.go @@ -4,6 +4,8 @@ import ( "context" "github.com/chef/automate/components/infra-proxy-service/config" + "github.com/chef/automate/components/infra-proxy-service/migrations" + "github.com/chef/automate/components/infra-proxy-service/server" ) @@ -15,8 +17,9 @@ var ( // ``` // res, err := infraProxy.GetOrgs(ctx, &req) // ``` - infraProxy *server.Server - ctx = context.Background() + infraProxy *server.Server + infraProxyMigration *migrations.MigrationServer + ctx = context.Background() ) type Suite struct{} @@ -35,6 +38,12 @@ func (s *Suite) GlobalSetup() error { return err } + // set global infraProxyMigration + infraProxyMigration, err = newInfraProxyMigrationServer() + if err != nil { + return err + } + // Add role records addRoles(totalRecords) @@ -64,3 +73,15 @@ func newInfraProxyServer() (*server.Server, error) { return gRPC, nil } + +// newInfraProxyMigrationServer initializes a InfraProxyMigrationServer with the default config +func newInfraProxyMigrationServer() (*migrations.MigrationServer, error) { + service, err := config.ConfigFromViper(cFile) + if err != nil { + return nil, err + } + + gRPC := migrations.NewMigrationServer(service) + + return gRPC, nil +} diff --git a/components/infra-proxy-service/migrations/migrations.go b/components/infra-proxy-service/migrations/migrations.go index eec78ac17ce..c4a6c9864db 100644 --- a/components/infra-proxy-service/migrations/migrations.go +++ b/components/infra-proxy-service/migrations/migrations.go @@ -4,7 +4,6 @@ import ( "bytes" "context" "fmt" - "github.com/chef/automate/components/infra-proxy-service/migrations/pipeline" "io" "os" "path" @@ -13,6 +12,9 @@ import ( "github.com/chef/automate/api/interservice/infra_proxy/migrations/response" "github.com/chef/automate/api/interservice/infra_proxy/migrations/service" "github.com/chef/automate/components/infra-proxy-service/constants" + "github.com/chef/automate/components/infra-proxy-service/migrations/pipeline" + pipeline_model "github.com/chef/automate/components/infra-proxy-service/pipeline" + "github.com/chef/automate/components/infra-proxy-service/validation" "github.com/gofrs/uuid" log "github.com/sirupsen/logrus" @@ -88,7 +90,7 @@ func (s *MigrationServer) UploadFile(stream service.MigrationDataService_UploadF } // GetMigrationStatus fetch migration status against migration id -func (s *MigrationServer) GetMigrationStatus(ctx context.Context, req *request.GetMigrationStatus) (*response.GetMigrationStatus, error) { +func (s *MigrationServer) GetMigrationStatus(ctx context.Context, req *request.GetMigrationStatusRequest) (*response.GetMigrationStatusResponse, error) { ctx, cancel := context.WithCancel(ctx) defer cancel() @@ -108,7 +110,7 @@ func (s *MigrationServer) GetMigrationStatus(ctx context.Context, req *request.G return nil, err } - return &response.GetMigrationStatus{ + return &response.GetMigrationStatusResponse{ MigrationId: migration.MigrationID, MigrationType: migration.MigrationType, MigrationStatus: migration.MigrationStatus, @@ -167,7 +169,7 @@ func createResponseWithErrors(err error, migrationId string) *response.UploadZip } // CancelMigration cancle the ongoing migration -func (s *MigrationServer) CancelMigration(ctx context.Context, req *request.CancelMigrationRequest) (*response.CancelMigrationResponce, error) { +func (s *MigrationServer) CancelMigration(ctx context.Context, req *request.CancelMigrationRequest) (*response.CancelMigrationResponse, error) { // Validate all request fields are required err := validation.New(validation.Options{ Target: "server", @@ -209,8 +211,85 @@ func (s *MigrationServer) CancelMigration(ctx context.Context, req *request.Canc errors := []string{err.Error()} - return &response.CancelMigrationResponce{ + return &response.CancelMigrationResponse{ Success: true, Errors: errors, }, nil } + +// GetStagedData fetch parsed data from db +func (s *MigrationServer) GetStagedData(ctx context.Context, req *request.GetStagedDataRequest) (*response.GetStagedDataResponse, error) { + ctx, cancel := context.WithCancel(ctx) + defer cancel() + + // Validate all request fields are required + err := validation.New(validation.Options{ + Target: "server", + Request: *req, + RequiredDefault: true, + }).Validate() + + if err != nil { + return nil, err + } + + migrationStage, err := s.service.Migration.GetMigrationStage(ctx, req.MigrationId) + if err != nil { + return nil, err + } + + return &response.GetStagedDataResponse{ + MigrationId: migrationStage.MigrationID, + StagedData: getStagedData(migrationStage.StagedData), + }, nil +} + +func getStagedData(stagedResult pipeline_model.Result) *response.StagedData { + stageData := &response.StagedData{} + for _, org := range stagedResult.ParsedResult.Orgs { + switch org.ActionOps { + case pipeline_model.Insert: + stageData.OrgsToMigrate++ + case pipeline_model.Delete: + stageData.OrgsToDelete++ + case pipeline_model.Update: + stageData.OrgsToUpdate++ + case pipeline_model.Skip: + stageData.OrgsToSkip++ + default: + } + } + users := []*response.User{} + for _, user := range stagedResult.ParsedResult.Users { + users = append(users, getStagedUser(user)) + } + stageData.Users = users + return stageData +} + +func getStagedUser(user pipeline_model.User) *response.User { + stagedUser := &response.User{} + stagedUser.Username = user.Username + stagedUser.Email = user.Email + stagedUser.DisplayName = user.DisplayName + stagedUser.FirstName = user.FirstName + stagedUser.LastName = user.LastName + stagedUser.MiddleName = user.MiddleName + stagedUser.AutomateUsername = user.AutomateUsername + stagedUser.Connector = user.Connector + stagedUser.IsConflicting = user.IsConflicting + stagedUser.IsAdmin = user.IsAdmin + return stagedUser +} + +// StoreStagedData stores staged data in db +// This function is used for the sample storage of staged data +func (s *MigrationServer) StoreStagedData(ctx context.Context, migrationId string, stagedData interface{}) error { + + _, err := s.service.Migration.StoreMigrationStage(ctx, migrationId, stagedData) + if err != nil { + return err + } + + return nil +} diff --git a/components/infra-proxy-service/migrations/migrations_test.go b/components/infra-proxy-service/migrations/migrations_test.go index 4f14b4e8b2e..c1ffedeb39d 100644 --- a/components/infra-proxy-service/migrations/migrations_test.go +++ b/components/infra-proxy-service/migrations/migrations_test.go @@ -6,6 +6,7 @@ import ( "testing" "github.com/chef/automate/api/external/infra_proxy/migrations/request" + "github.com/chef/automate/api/external/infra_proxy/migrations/response" "github.com/golang/mock/gomock" @@ -19,18 +20,20 @@ func TestMigrations(t *testing.T) { _, serviceRef, _, close, _, _ := test.SetupInfraProxyService(ctx, t) infraMigrationMockClient := infra_migrations.NewMockInfraProxyMigrationClient(gomock.NewController(t)) + var migrationID = "Fake id" + defer close() t.Run("GetMigrationStatus", func(t *testing.T) { test.ResetState(ctx, t, serviceRef) - res := &response.GetMigrationStatus{ - MigrationId: "Fake id", + res := &response.GetMigrationStatusResponse{ + MigrationId: migrationID, MigrationType: "Migration Completed", MigrationStatus: "Failed", } - req := request.GetMigrationStatus{ - MigrationId: "Fake id", + req := request.GetMigrationStatusRequest{ + MigrationId: migrationID, } t.Run("when a migration id which exist in migration table is submitted, then return the latest status.", func(t *testing.T) { infraMigrationMockClient.EXPECT().GetMigrationStatus(gomock.Any(), req, gomock.Any()).Return(res, nil) @@ -42,4 +45,42 @@ func TestMigrations(t *testing.T) { }) }) + + t.Run("GetStagedData", func(t *testing.T) { + test.ResetState(ctx, t, serviceRef) + + res := &response.GetStagedDataResponse{ + MigrationId: migrationID, + StagedData: &response.StagedData{ + OrgsToMigrate: 2, + OrgsToSkip: 1, + OrgsToUpdate: 1, + OrgsToDelete: 1, + Users: []*response.User{ + { + Username: "test1", + Email: "abc1@gmail.com", + DisplayName: "test1", + FirstName: "first1", + LastName: "last1", + MiddleName: "middle1", + AutomateUsername: "test1", + Connector: "local", + IsConflicting: true, + IsAdmin: true, + }, + }, + }, + } + req := request.GetStagedDataRequest{ + MigrationId: migrationID, + } + t.Run("when a migration id which exist in staged table is submitted, then return the staged data", func(t *testing.T) { + infraMigrationMockClient.EXPECT().GetStagedData(gomock.Any(), req, gomock.Any()).Return(res, nil) + }) + + t.Run("when a migration id is not exist in staged table is submitted, then return an error", func(t *testing.T) { + infraMigrationMockClient.EXPECT().GetStagedData(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil, errors.New("sql: no rows in result set")) + }) + }) } diff --git a/components/infra-proxy-service/migrations/pipeline/models.go b/components/infra-proxy-service/migrations/pipeline/models.go index 2252fc912fc..b730e76df52 100644 --- a/components/infra-proxy-service/migrations/pipeline/models.go +++ b/components/infra-proxy-service/migrations/pipeline/models.go @@ -96,7 +96,7 @@ type Org struct { FullName string `json:"full_name"` // ActionOps for Insert Skip Update and Delete - ActionOps ActionOps `json:"guid"` + ActionOps ActionOps `json:"action_ops"` } type User struct { diff --git a/components/infra-proxy-service/pipeline/models.go b/components/infra-proxy-service/pipeline/models.go index c76d3f5f9c6..b730e76df52 100644 --- a/components/infra-proxy-service/pipeline/models.go +++ b/components/infra-proxy-service/pipeline/models.go @@ -27,6 +27,12 @@ type Meta struct { // UnzipFolder for unzipped folder's location UnzipFolder string `json:"unzip_folder"` + + // Chef Infra Server ID + ServerID string `json:"server_id"` + + // Migration ID + MigrationID string `json:"migration_id"` } type StageResult struct { @@ -90,7 +96,7 @@ type Org struct { FullName string `json:"full_name"` // ActionOps for Insert Skip Update and Delete - ActionOps ActionOps `json:"guid"` + ActionOps ActionOps `json:"action_ops"` } type User struct { @@ -113,3 +119,9 @@ type User struct { // IsAdmin (user is admin or not) IsAdmin bool `json:"is_admin"` } + +type OrgJson struct { + Name string `json:"name"` + FullName string `json:"full_name"` + Guid string `json:"guid"` +} diff --git a/components/infra-proxy-service/storage/postgres/migration/sql/07_migration.up.sql b/components/infra-proxy-service/storage/postgres/migration/sql/07_migration.up.sql index 9eb85314247..92df01820c4 100644 --- a/components/infra-proxy-service/storage/postgres/migration/sql/07_migration.up.sql +++ b/components/infra-proxy-service/storage/postgres/migration/sql/07_migration.up.sql @@ -93,7 +93,7 @@ LANGUAGE plpgsql; -- Create table migration_stage CREATE TABLE IF NOT EXISTS migration_stage ( id SERIAL PRIMARY KEY, - migration_id TEXT NOT NULL, + migration_id TEXT NOT NULL UNIQUE, parsed_data json NOT NULL DEFAULT '{}', created_at TIMESTAMPTZ NOT NULL DEFAULT now(), updated_at TIMESTAMPTZ NOT NULL DEFAULT now() diff --git a/components/infra-proxy-service/storage/postgres/migrations.go b/components/infra-proxy-service/storage/postgres/migrations.go index 4b9d56e8f3d..d81078fd36c 100644 --- a/components/infra-proxy-service/storage/postgres/migrations.go +++ b/components/infra-proxy-service/storage/postgres/migrations.go @@ -260,8 +260,8 @@ func (p *postgres) GetMigrationStatus(ctx context.Context, migrationId string) ( //StoreMigrationStage Inserts an entry to the migration_stage // To use this function, make sure that you should pass the serialized parsed data in []byte -func (p *postgres) StoreMigrationStage(ctx context.Context, migrationId string, parsedData interface{}) (storage.MigrationStage, error) { - return p.insertMigrationStage(ctx, migrationId, parsedData) +func (p *postgres) StoreMigrationStage(ctx context.Context, migrationId string, stagedData interface{}) (storage.MigrationStage, error) { + return p.insertMigrationStage(ctx, migrationId, stagedData) } //GetMigrationStage Get entry to the migration_stage @@ -275,12 +275,12 @@ func (p *postgres) DeleteMigrationStage(ctx context.Context, migrationId string) } //insertMigrationStage Inserts an entry to the migration_stage -func (p *postgres) insertMigrationStage(ctx context.Context, migrationId string, parsedData interface{}) (storage.MigrationStage, error) { +func (p *postgres) insertMigrationStage(ctx context.Context, migrationId string, StoreMigrationStage interface{}) (storage.MigrationStage, error) { var m storage.MigrationStage var mByte []byte var ok bool - if mByte, ok = parsedData.([]byte); !ok { + if mByte, ok = StoreMigrationStage.([]byte); !ok { return m, errors.New("Cannot parse the data") } query := "SELECT insert_migration_stage($1, $2)" diff --git a/components/infra-proxy-service/storage/storage.go b/components/infra-proxy-service/storage/storage.go index 2f04acd67f2..fdb2040e8d3 100644 --- a/components/infra-proxy-service/storage/storage.go +++ b/components/infra-proxy-service/storage/storage.go @@ -4,6 +4,8 @@ import ( "context" "errors" "time" + + "github.com/chef/automate/components/infra-proxy-service/pipeline" ) // Storage is the interface provided by our various storage backends. @@ -69,7 +71,7 @@ type MigrationStorage interface { CancelMigration(ctx context.Context, migrationId, serverId string, totalSucceeded, totalSkipped, totalFailed int64) (Migration, error) FailedCancelMigration(ctx context.Context, migrationId, serverId, message string, totalSucceeded, totalSkipped, totalFailed int64) (Migration, error) - StoreMigrationStage(ctx context.Context, migrationId string, parsedData interface{}) (MigrationStage, error) + StoreMigrationStage(ctx context.Context, migrationId string, stagedData interface{}) (MigrationStage, error) GetMigrationStage(ctx context.Context, migrationId string) (MigrationStage, error) DeleteMigrationStage(ctx context.Context, migrationId string) (MigrationStage, error) @@ -134,11 +136,11 @@ type Migration struct { UpdatedTimestamp time.Time `json:"updated_timestamp"` } type MigrationStage struct { - ID string `json:"id"` - MigrationID string `json:"migration_id"` - ParsedData interface{} `json:"parsed_data"` - CreatedAt time.Time `json:"created_at"` - UpdatedAt time.Time `json:"updated_at"` + ID string `json:"id"` + MigrationID string `json:"migration_id"` + StagedData pipeline.Result `json:"parsed_data"` + CreatedAt time.Time `json:"created_at"` + UpdatedAt time.Time `json:"updated_at"` } type MigrationStatus struct {