From 62cb0642013a2c0b6a828d1c3a66bbcf30c8f72d Mon Sep 17 00:00:00 2001 From: Dave Augustus <95467821+dave-augustus@users.noreply.github.com> Date: Mon, 4 Apr 2022 13:40:28 +0530 Subject: [PATCH] Automate API needs to handle sync status (#6860) * Sync status Signed-off-by: Pappu Kumar * Sync migration time Signed-off-by: Pappu Kumar --- .../infra_proxy/infra_proxy.swagger.json | 5 + .../infra_proxy/response/servers.pb.go | 193 +++--- .../infra_proxy/response/servers.proto | 4 + .../authz/policy.pb.client_mock.go | 618 ++++++++++++++++++ .../infra_proxy/response/servers.pb.go | 207 +++--- .../infra_proxy/response/servers.proto | 4 + .../api/infra_proxy.pb.swagger.go | 5 + .../handler/infra_proxy/servers.go | 18 +- .../server/automate_infra_server_users.go | 18 +- .../infra-proxy-service/server/servers.go | 30 +- .../storage/postgres/migrations.go | 33 + .../infra-proxy-service/storage/storage.go | 2 + 12 files changed, 930 insertions(+), 207 deletions(-) create mode 100644 api/interservice/authz/policy.pb.client_mock.go diff --git a/api/external/infra_proxy/infra_proxy.swagger.json b/api/external/infra_proxy/infra_proxy.swagger.json index 01cccab938b..2206dd21e33 100644 --- a/api/external/infra_proxy/infra_proxy.swagger.json +++ b/api/external/infra_proxy/infra_proxy.swagger.json @@ -4848,6 +4848,11 @@ "migration_status": { "type": "string", "title": "Migration Id for active Chef Infra server migration" + }, + "last_migration_time": { + "type": "string", + "format": "date-time", + "title": "Last successfull migration or last sync status" } } }, diff --git a/api/external/infra_proxy/response/servers.pb.go b/api/external/infra_proxy/response/servers.pb.go index 41619aca8b1..148a7aef74d 100644 --- a/api/external/infra_proxy/response/servers.pb.go +++ b/api/external/infra_proxy/response/servers.pb.go @@ -10,6 +10,7 @@ import ( proto "github.com/golang/protobuf/proto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" reflect "reflect" sync "sync" ) @@ -286,6 +287,8 @@ type Server struct { MigrationType string `protobuf:"bytes,8,opt,name=migration_type,json=migrationType,proto3" json:"migration_type,omitempty"` //Migration Id for active Chef Infra server migration MigrationStatus string `protobuf:"bytes,9,opt,name=migration_status,json=migrationStatus,proto3" json:"migration_status,omitempty"` + // Last successfull migration or last sync status + LastMigrationTime *timestamppb.Timestamp `protobuf:"bytes,10,opt,name=last_migration_time,json=lastMigrationTime,proto3" json:"last_migration_time,omitempty"` } func (x *Server) Reset() { @@ -376,6 +379,13 @@ func (x *Server) GetMigrationStatus() string { return "" } +func (x *Server) GetLastMigrationTime() *timestamppb.Timestamp { + if x != nil { + return x.LastMigrationTime + } + return nil +} + type GetServerStatus struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -545,81 +555,88 @@ var file_external_infra_proxy_response_servers_proto_rawDesc = []byte{ 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x26, 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, 0x72, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x56, 0x0a, 0x0c, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, - 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x46, 0x0a, 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 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, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x53, - 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x22, 0x56, 0x0a, - 0x0c, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x46, 0x0a, - 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x56, 0x0a, 0x0c, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x46, 0x0a, 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 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, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, + 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x22, 0x56, + 0x0a, 0x0c, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x46, + 0x0a, 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, + 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, 0x72, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x06, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x22, 0x56, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x46, 0x0a, 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 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, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, + 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x22, 0x56, + 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x12, 0x48, 0x0a, 0x07, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2e, 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, 0x72, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x06, 0x73, - 0x65, 0x72, 0x76, 0x65, 0x72, 0x22, 0x56, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, - 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x46, 0x0a, 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 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, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x53, - 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x22, 0x56, 0x0a, - 0x0a, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x12, 0x48, 0x0a, 0x07, 0x73, - 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x63, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x07, 0x73, + 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x22, 0x53, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, + 0x76, 0x65, 0x72, 0x12, 0x46, 0x0a, 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x2e, 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, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x53, 0x65, 0x72, + 0x76, 0x65, 0x72, 0x52, 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x22, 0xbf, 0x02, 0x0a, 0x06, + 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x71, + 0x64, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x66, 0x71, 0x64, 0x6e, 0x12, 0x1d, + 0x0a, 0x0a, 0x69, 0x70, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x09, 0x69, 0x70, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1d, 0x0a, + 0x0a, 0x6f, 0x72, 0x67, 0x73, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x09, 0x6f, 0x72, 0x67, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x21, 0x0a, 0x0c, + 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x07, 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, 0x08, 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, 0x09, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0f, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x12, 0x4a, 0x0a, 0x13, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x11, 0x6c, 0x61, 0x73, 0x74, + 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x69, 0x6d, 0x65, 0x22, 0xe5, 0x02, + 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x64, 0x0a, 0x09, 0x75, 0x70, 0x73, + 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x46, 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, 0x72, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x07, 0x73, 0x65, - 0x72, 0x76, 0x65, 0x72, 0x73, 0x22, 0x53, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, - 0x65, 0x72, 0x12, 0x46, 0x0a, 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x2e, 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, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x53, 0x65, 0x72, 0x76, - 0x65, 0x72, 0x52, 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x22, 0xf3, 0x01, 0x0a, 0x06, 0x53, - 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x71, 0x64, - 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x66, 0x71, 0x64, 0x6e, 0x12, 0x1d, 0x0a, - 0x0a, 0x69, 0x70, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x09, 0x69, 0x70, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1d, 0x0a, 0x0a, - 0x6f, 0x72, 0x67, 0x73, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x09, 0x6f, 0x72, 0x67, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x6d, - 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x07, 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, 0x08, 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, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0f, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x22, 0xe5, 0x02, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, - 0x61, 0x74, 0x75, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x64, 0x0a, 0x09, - 0x75, 0x70, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x46, 0x2e, 0x63, 0x68, 0x65, 0x66, 0x2e, 0x61, 0x75, 0x74, 0x6f, 0x6d, 0x61, 0x74, 0x65, 0x2e, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x55, 0x70, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x45, + 0x6e, 0x74, 0x72, 0x79, 0x52, 0x09, 0x75, 0x70, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x12, + 0x5b, 0x0a, 0x06, 0x6b, 0x65, 0x79, 0x67, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x43, 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, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, - 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x55, 0x70, 0x73, 0x74, 0x72, 0x65, 0x61, - 0x6d, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x09, 0x75, 0x70, 0x73, 0x74, 0x72, 0x65, 0x61, - 0x6d, 0x73, 0x12, 0x5b, 0x0a, 0x06, 0x6b, 0x65, 0x79, 0x67, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x43, 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, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x53, - 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x4b, 0x65, 0x79, 0x67, - 0x65, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x6b, 0x65, 0x79, 0x67, 0x65, 0x6e, 0x1a, - 0x3c, 0x0a, 0x0e, 0x55, 0x70, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x45, 0x6e, 0x74, 0x72, - 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, - 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x39, 0x0a, - 0x0b, 0x4b, 0x65, 0x79, 0x67, 0x65, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, - 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x3e, 0x0a, 0x10, 0x56, 0x61, 0x6c, 0x69, - 0x64, 0x61, 0x74, 0x65, 0x57, 0x65, 0x62, 0x75, 0x69, 0x4b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x10, 0x0a, 0x0e, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x57, 0x65, 0x62, 0x75, 0x69, 0x4b, 0x65, 0x79, 0x42, 0x3c, 0x5a, 0x3a, 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, - 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x4b, 0x65, 0x79, 0x67, 0x65, 0x6e, 0x45, + 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x6b, 0x65, 0x79, 0x67, 0x65, 0x6e, 0x1a, 0x3c, 0x0a, 0x0e, + 0x55, 0x70, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, + 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, + 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x39, 0x0a, 0x0b, 0x4b, 0x65, + 0x79, 0x67, 0x65, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x3e, 0x0a, 0x10, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, + 0x65, 0x57, 0x65, 0x62, 0x75, 0x69, 0x4b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x12, + 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, + 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x10, 0x0a, 0x0e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x57, + 0x65, 0x62, 0x75, 0x69, 0x4b, 0x65, 0x79, 0x42, 0x3c, 0x5a, 0x3a, 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, 0x72, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -636,17 +653,18 @@ func file_external_infra_proxy_response_servers_proto_rawDescGZIP() []byte { var file_external_infra_proxy_response_servers_proto_msgTypes = make([]protoimpl.MessageInfo, 11) var file_external_infra_proxy_response_servers_proto_goTypes = []interface{}{ - (*CreateServer)(nil), // 0: chef.automate.api.infra_proxy.response.CreateServer - (*DeleteServer)(nil), // 1: chef.automate.api.infra_proxy.response.DeleteServer - (*UpdateServer)(nil), // 2: chef.automate.api.infra_proxy.response.UpdateServer - (*GetServers)(nil), // 3: chef.automate.api.infra_proxy.response.GetServers - (*GetServer)(nil), // 4: chef.automate.api.infra_proxy.response.GetServer - (*Server)(nil), // 5: chef.automate.api.infra_proxy.response.Server - (*GetServerStatus)(nil), // 6: chef.automate.api.infra_proxy.response.GetServerStatus - (*ValidateWebuiKey)(nil), // 7: chef.automate.api.infra_proxy.response.ValidateWebuiKey - (*UpdateWebuiKey)(nil), // 8: chef.automate.api.infra_proxy.response.UpdateWebuiKey - nil, // 9: chef.automate.api.infra_proxy.response.GetServerStatus.UpstreamsEntry - nil, // 10: chef.automate.api.infra_proxy.response.GetServerStatus.KeygenEntry + (*CreateServer)(nil), // 0: chef.automate.api.infra_proxy.response.CreateServer + (*DeleteServer)(nil), // 1: chef.automate.api.infra_proxy.response.DeleteServer + (*UpdateServer)(nil), // 2: chef.automate.api.infra_proxy.response.UpdateServer + (*GetServers)(nil), // 3: chef.automate.api.infra_proxy.response.GetServers + (*GetServer)(nil), // 4: chef.automate.api.infra_proxy.response.GetServer + (*Server)(nil), // 5: chef.automate.api.infra_proxy.response.Server + (*GetServerStatus)(nil), // 6: chef.automate.api.infra_proxy.response.GetServerStatus + (*ValidateWebuiKey)(nil), // 7: chef.automate.api.infra_proxy.response.ValidateWebuiKey + (*UpdateWebuiKey)(nil), // 8: chef.automate.api.infra_proxy.response.UpdateWebuiKey + nil, // 9: chef.automate.api.infra_proxy.response.GetServerStatus.UpstreamsEntry + nil, // 10: chef.automate.api.infra_proxy.response.GetServerStatus.KeygenEntry + (*timestamppb.Timestamp)(nil), // 11: google.protobuf.Timestamp } var file_external_infra_proxy_response_servers_proto_depIdxs = []int32{ 5, // 0: chef.automate.api.infra_proxy.response.CreateServer.server:type_name -> chef.automate.api.infra_proxy.response.Server @@ -654,13 +672,14 @@ var file_external_infra_proxy_response_servers_proto_depIdxs = []int32{ 5, // 2: chef.automate.api.infra_proxy.response.UpdateServer.server:type_name -> chef.automate.api.infra_proxy.response.Server 5, // 3: chef.automate.api.infra_proxy.response.GetServers.servers:type_name -> chef.automate.api.infra_proxy.response.Server 5, // 4: chef.automate.api.infra_proxy.response.GetServer.server:type_name -> chef.automate.api.infra_proxy.response.Server - 9, // 5: chef.automate.api.infra_proxy.response.GetServerStatus.upstreams:type_name -> chef.automate.api.infra_proxy.response.GetServerStatus.UpstreamsEntry - 10, // 6: chef.automate.api.infra_proxy.response.GetServerStatus.keygen:type_name -> chef.automate.api.infra_proxy.response.GetServerStatus.KeygenEntry - 7, // [7:7] is the sub-list for method output_type - 7, // [7:7] is the sub-list for method input_type - 7, // [7:7] is the sub-list for extension type_name - 7, // [7:7] is the sub-list for extension extendee - 0, // [0:7] is the sub-list for field type_name + 11, // 5: chef.automate.api.infra_proxy.response.Server.last_migration_time:type_name -> google.protobuf.Timestamp + 9, // 6: chef.automate.api.infra_proxy.response.GetServerStatus.upstreams:type_name -> chef.automate.api.infra_proxy.response.GetServerStatus.UpstreamsEntry + 10, // 7: chef.automate.api.infra_proxy.response.GetServerStatus.keygen:type_name -> chef.automate.api.infra_proxy.response.GetServerStatus.KeygenEntry + 8, // [8:8] is the sub-list for method output_type + 8, // [8:8] is the sub-list for method input_type + 8, // [8:8] is the sub-list for extension type_name + 8, // [8:8] is the sub-list for extension extendee + 0, // [0:8] is the sub-list for field type_name } func init() { file_external_infra_proxy_response_servers_proto_init() } diff --git a/api/external/infra_proxy/response/servers.proto b/api/external/infra_proxy/response/servers.proto index 5fe9de539c3..c757c859f1d 100644 --- a/api/external/infra_proxy/response/servers.proto +++ b/api/external/infra_proxy/response/servers.proto @@ -3,6 +3,8 @@ syntax = "proto3"; package chef.automate.api.infra_proxy.response; option go_package = "github.com/chef/automate/api/external/infra_proxy/response"; +import "google/protobuf/timestamp.proto"; + message CreateServer { // Chef Infra Server. Server server = 1; @@ -45,6 +47,8 @@ message Server { string migration_type =8; //Migration Id for active Chef Infra server migration string migration_status =9; + // Last successfull migration or last sync status + google.protobuf.Timestamp last_migration_time = 10; } message GetServerStatus { diff --git a/api/interservice/authz/policy.pb.client_mock.go b/api/interservice/authz/policy.pb.client_mock.go new file mode 100644 index 00000000000..1fc8bbc25a7 --- /dev/null +++ b/api/interservice/authz/policy.pb.client_mock.go @@ -0,0 +1,618 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: authz/policy.pb.go + +// Package authz is a generated GoMock package. +package authz + +import ( + context "context" + gomock "github.com/golang/mock/gomock" + grpc "google.golang.org/grpc" + reflect "reflect" +) + +// MockPoliciesServiceClient is a mock of PoliciesServiceClient interface +type MockPoliciesServiceClient struct { + ctrl *gomock.Controller + recorder *MockPoliciesServiceClientMockRecorder +} + +// MockPoliciesServiceClientMockRecorder is the mock recorder for MockPoliciesServiceClient +type MockPoliciesServiceClientMockRecorder struct { + mock *MockPoliciesServiceClient +} + +// NewMockPoliciesServiceClient creates a new mock instance +func NewMockPoliciesServiceClient(ctrl *gomock.Controller) *MockPoliciesServiceClient { + mock := &MockPoliciesServiceClient{ctrl: ctrl} + mock.recorder = &MockPoliciesServiceClientMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use +func (m *MockPoliciesServiceClient) EXPECT() *MockPoliciesServiceClientMockRecorder { + return m.recorder +} + +// ReplacePolicyMembers mocks base method +func (m *MockPoliciesServiceClient) ReplacePolicyMembers(ctx context.Context, in *ReplacePolicyMembersReq, opts ...grpc.CallOption) (*ReplacePolicyMembersResp, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, in} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ReplacePolicyMembers", varargs...) + ret0, _ := ret[0].(*ReplacePolicyMembersResp) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ReplacePolicyMembers indicates an expected call of ReplacePolicyMembers +func (mr *MockPoliciesServiceClientMockRecorder) ReplacePolicyMembers(ctx, in interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, in}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReplacePolicyMembers", reflect.TypeOf((*MockPoliciesServiceClient)(nil).ReplacePolicyMembers), varargs...) +} + +// CreatePolicy mocks base method +func (m *MockPoliciesServiceClient) CreatePolicy(ctx context.Context, in *CreatePolicyReq, opts ...grpc.CallOption) (*Policy, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, in} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "CreatePolicy", varargs...) + ret0, _ := ret[0].(*Policy) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreatePolicy indicates an expected call of CreatePolicy +func (mr *MockPoliciesServiceClientMockRecorder) CreatePolicy(ctx, in interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, in}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreatePolicy", reflect.TypeOf((*MockPoliciesServiceClient)(nil).CreatePolicy), varargs...) +} + +// DeletePolicy mocks base method +func (m *MockPoliciesServiceClient) DeletePolicy(ctx context.Context, in *DeletePolicyReq, opts ...grpc.CallOption) (*DeletePolicyResp, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, in} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DeletePolicy", varargs...) + ret0, _ := ret[0].(*DeletePolicyResp) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeletePolicy indicates an expected call of DeletePolicy +func (mr *MockPoliciesServiceClientMockRecorder) DeletePolicy(ctx, in interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, in}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeletePolicy", reflect.TypeOf((*MockPoliciesServiceClient)(nil).DeletePolicy), varargs...) +} + +// ListPolicies mocks base method +func (m *MockPoliciesServiceClient) ListPolicies(ctx context.Context, in *ListPoliciesReq, opts ...grpc.CallOption) (*ListPoliciesResp, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, in} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListPolicies", varargs...) + ret0, _ := ret[0].(*ListPoliciesResp) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListPolicies indicates an expected call of ListPolicies +func (mr *MockPoliciesServiceClientMockRecorder) ListPolicies(ctx, in interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, in}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListPolicies", reflect.TypeOf((*MockPoliciesServiceClient)(nil).ListPolicies), varargs...) +} + +// GetPolicy mocks base method +func (m *MockPoliciesServiceClient) GetPolicy(ctx context.Context, in *GetPolicyReq, opts ...grpc.CallOption) (*Policy, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, in} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "GetPolicy", varargs...) + ret0, _ := ret[0].(*Policy) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetPolicy indicates an expected call of GetPolicy +func (mr *MockPoliciesServiceClientMockRecorder) GetPolicy(ctx, in interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, in}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPolicy", reflect.TypeOf((*MockPoliciesServiceClient)(nil).GetPolicy), varargs...) +} + +// UpdatePolicy mocks base method +func (m *MockPoliciesServiceClient) UpdatePolicy(ctx context.Context, in *UpdatePolicyReq, opts ...grpc.CallOption) (*Policy, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, in} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "UpdatePolicy", varargs...) + ret0, _ := ret[0].(*Policy) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UpdatePolicy indicates an expected call of UpdatePolicy +func (mr *MockPoliciesServiceClientMockRecorder) UpdatePolicy(ctx, in interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, in}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdatePolicy", reflect.TypeOf((*MockPoliciesServiceClient)(nil).UpdatePolicy), varargs...) +} + +// GetPolicyVersion mocks base method +func (m *MockPoliciesServiceClient) GetPolicyVersion(ctx context.Context, in *GetPolicyVersionReq, opts ...grpc.CallOption) (*GetPolicyVersionResp, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, in} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "GetPolicyVersion", varargs...) + ret0, _ := ret[0].(*GetPolicyVersionResp) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetPolicyVersion indicates an expected call of GetPolicyVersion +func (mr *MockPoliciesServiceClientMockRecorder) GetPolicyVersion(ctx, in interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, in}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPolicyVersion", reflect.TypeOf((*MockPoliciesServiceClient)(nil).GetPolicyVersion), varargs...) +} + +// CreateRole mocks base method +func (m *MockPoliciesServiceClient) CreateRole(ctx context.Context, in *CreateRoleReq, opts ...grpc.CallOption) (*Role, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, in} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "CreateRole", varargs...) + ret0, _ := ret[0].(*Role) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateRole indicates an expected call of CreateRole +func (mr *MockPoliciesServiceClientMockRecorder) CreateRole(ctx, in interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, in}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateRole", reflect.TypeOf((*MockPoliciesServiceClient)(nil).CreateRole), varargs...) +} + +// ListRoles mocks base method +func (m *MockPoliciesServiceClient) ListRoles(ctx context.Context, in *ListRolesReq, opts ...grpc.CallOption) (*ListRolesResp, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, in} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListRoles", varargs...) + ret0, _ := ret[0].(*ListRolesResp) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListRoles indicates an expected call of ListRoles +func (mr *MockPoliciesServiceClientMockRecorder) ListRoles(ctx, in interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, in}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListRoles", reflect.TypeOf((*MockPoliciesServiceClient)(nil).ListRoles), varargs...) +} + +// GetRole mocks base method +func (m *MockPoliciesServiceClient) GetRole(ctx context.Context, in *GetRoleReq, opts ...grpc.CallOption) (*Role, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, in} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "GetRole", varargs...) + ret0, _ := ret[0].(*Role) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetRole indicates an expected call of GetRole +func (mr *MockPoliciesServiceClientMockRecorder) GetRole(ctx, in interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, in}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetRole", reflect.TypeOf((*MockPoliciesServiceClient)(nil).GetRole), varargs...) +} + +// DeleteRole mocks base method +func (m *MockPoliciesServiceClient) DeleteRole(ctx context.Context, in *DeleteRoleReq, opts ...grpc.CallOption) (*DeleteRoleResp, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, in} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DeleteRole", varargs...) + ret0, _ := ret[0].(*DeleteRoleResp) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteRole indicates an expected call of DeleteRole +func (mr *MockPoliciesServiceClientMockRecorder) DeleteRole(ctx, in interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, in}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteRole", reflect.TypeOf((*MockPoliciesServiceClient)(nil).DeleteRole), varargs...) +} + +// UpdateRole mocks base method +func (m *MockPoliciesServiceClient) UpdateRole(ctx context.Context, in *UpdateRoleReq, opts ...grpc.CallOption) (*Role, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, in} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "UpdateRole", varargs...) + ret0, _ := ret[0].(*Role) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UpdateRole indicates an expected call of UpdateRole +func (mr *MockPoliciesServiceClientMockRecorder) UpdateRole(ctx, in interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, in}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateRole", reflect.TypeOf((*MockPoliciesServiceClient)(nil).UpdateRole), varargs...) +} + +// ListPolicyMembers mocks base method +func (m *MockPoliciesServiceClient) ListPolicyMembers(ctx context.Context, in *ListPolicyMembersReq, opts ...grpc.CallOption) (*ListPolicyMembersResp, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, in} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListPolicyMembers", varargs...) + ret0, _ := ret[0].(*ListPolicyMembersResp) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListPolicyMembers indicates an expected call of ListPolicyMembers +func (mr *MockPoliciesServiceClientMockRecorder) ListPolicyMembers(ctx, in interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, in}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListPolicyMembers", reflect.TypeOf((*MockPoliciesServiceClient)(nil).ListPolicyMembers), varargs...) +} + +// RemovePolicyMembers mocks base method +func (m *MockPoliciesServiceClient) RemovePolicyMembers(ctx context.Context, in *RemovePolicyMembersReq, opts ...grpc.CallOption) (*RemovePolicyMembersResp, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, in} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "RemovePolicyMembers", varargs...) + ret0, _ := ret[0].(*RemovePolicyMembersResp) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// RemovePolicyMembers indicates an expected call of RemovePolicyMembers +func (mr *MockPoliciesServiceClientMockRecorder) RemovePolicyMembers(ctx, in interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, in}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemovePolicyMembers", reflect.TypeOf((*MockPoliciesServiceClient)(nil).RemovePolicyMembers), varargs...) +} + +// AddPolicyMembers mocks base method +func (m *MockPoliciesServiceClient) AddPolicyMembers(ctx context.Context, in *AddPolicyMembersReq, opts ...grpc.CallOption) (*AddPolicyMembersResp, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, in} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "AddPolicyMembers", varargs...) + ret0, _ := ret[0].(*AddPolicyMembersResp) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// AddPolicyMembers indicates an expected call of AddPolicyMembers +func (mr *MockPoliciesServiceClientMockRecorder) AddPolicyMembers(ctx, in interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, in}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddPolicyMembers", reflect.TypeOf((*MockPoliciesServiceClient)(nil).AddPolicyMembers), varargs...) +} + +// PurgeSubjectFromPolicies mocks base method +func (m *MockPoliciesServiceClient) PurgeSubjectFromPolicies(ctx context.Context, in *PurgeSubjectFromPoliciesReq, opts ...grpc.CallOption) (*PurgeSubjectFromPoliciesResp, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, in} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "PurgeSubjectFromPolicies", varargs...) + ret0, _ := ret[0].(*PurgeSubjectFromPoliciesResp) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// PurgeSubjectFromPolicies indicates an expected call of PurgeSubjectFromPolicies +func (mr *MockPoliciesServiceClientMockRecorder) PurgeSubjectFromPolicies(ctx, in interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, in}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PurgeSubjectFromPolicies", reflect.TypeOf((*MockPoliciesServiceClient)(nil).PurgeSubjectFromPolicies), varargs...) +} + +// MockPoliciesServiceServer is a mock of PoliciesServiceServer interface +type MockPoliciesServiceServer struct { + ctrl *gomock.Controller + recorder *MockPoliciesServiceServerMockRecorder +} + +// MockPoliciesServiceServerMockRecorder is the mock recorder for MockPoliciesServiceServer +type MockPoliciesServiceServerMockRecorder struct { + mock *MockPoliciesServiceServer +} + +// NewMockPoliciesServiceServer creates a new mock instance +func NewMockPoliciesServiceServer(ctrl *gomock.Controller) *MockPoliciesServiceServer { + mock := &MockPoliciesServiceServer{ctrl: ctrl} + mock.recorder = &MockPoliciesServiceServerMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use +func (m *MockPoliciesServiceServer) EXPECT() *MockPoliciesServiceServerMockRecorder { + return m.recorder +} + +// ReplacePolicyMembers mocks base method +func (m *MockPoliciesServiceServer) ReplacePolicyMembers(arg0 context.Context, arg1 *ReplacePolicyMembersReq) (*ReplacePolicyMembersResp, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ReplacePolicyMembers", arg0, arg1) + ret0, _ := ret[0].(*ReplacePolicyMembersResp) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ReplacePolicyMembers indicates an expected call of ReplacePolicyMembers +func (mr *MockPoliciesServiceServerMockRecorder) ReplacePolicyMembers(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReplacePolicyMembers", reflect.TypeOf((*MockPoliciesServiceServer)(nil).ReplacePolicyMembers), arg0, arg1) +} + +// CreatePolicy mocks base method +func (m *MockPoliciesServiceServer) CreatePolicy(arg0 context.Context, arg1 *CreatePolicyReq) (*Policy, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreatePolicy", arg0, arg1) + ret0, _ := ret[0].(*Policy) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreatePolicy indicates an expected call of CreatePolicy +func (mr *MockPoliciesServiceServerMockRecorder) CreatePolicy(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreatePolicy", reflect.TypeOf((*MockPoliciesServiceServer)(nil).CreatePolicy), arg0, arg1) +} + +// DeletePolicy mocks base method +func (m *MockPoliciesServiceServer) DeletePolicy(arg0 context.Context, arg1 *DeletePolicyReq) (*DeletePolicyResp, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeletePolicy", arg0, arg1) + ret0, _ := ret[0].(*DeletePolicyResp) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeletePolicy indicates an expected call of DeletePolicy +func (mr *MockPoliciesServiceServerMockRecorder) DeletePolicy(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeletePolicy", reflect.TypeOf((*MockPoliciesServiceServer)(nil).DeletePolicy), arg0, arg1) +} + +// ListPolicies mocks base method +func (m *MockPoliciesServiceServer) ListPolicies(arg0 context.Context, arg1 *ListPoliciesReq) (*ListPoliciesResp, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListPolicies", arg0, arg1) + ret0, _ := ret[0].(*ListPoliciesResp) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListPolicies indicates an expected call of ListPolicies +func (mr *MockPoliciesServiceServerMockRecorder) ListPolicies(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListPolicies", reflect.TypeOf((*MockPoliciesServiceServer)(nil).ListPolicies), arg0, arg1) +} + +// GetPolicy mocks base method +func (m *MockPoliciesServiceServer) GetPolicy(arg0 context.Context, arg1 *GetPolicyReq) (*Policy, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetPolicy", arg0, arg1) + ret0, _ := ret[0].(*Policy) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetPolicy indicates an expected call of GetPolicy +func (mr *MockPoliciesServiceServerMockRecorder) GetPolicy(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPolicy", reflect.TypeOf((*MockPoliciesServiceServer)(nil).GetPolicy), arg0, arg1) +} + +// UpdatePolicy mocks base method +func (m *MockPoliciesServiceServer) UpdatePolicy(arg0 context.Context, arg1 *UpdatePolicyReq) (*Policy, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdatePolicy", arg0, arg1) + ret0, _ := ret[0].(*Policy) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UpdatePolicy indicates an expected call of UpdatePolicy +func (mr *MockPoliciesServiceServerMockRecorder) UpdatePolicy(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdatePolicy", reflect.TypeOf((*MockPoliciesServiceServer)(nil).UpdatePolicy), arg0, arg1) +} + +// GetPolicyVersion mocks base method +func (m *MockPoliciesServiceServer) GetPolicyVersion(arg0 context.Context, arg1 *GetPolicyVersionReq) (*GetPolicyVersionResp, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetPolicyVersion", arg0, arg1) + ret0, _ := ret[0].(*GetPolicyVersionResp) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetPolicyVersion indicates an expected call of GetPolicyVersion +func (mr *MockPoliciesServiceServerMockRecorder) GetPolicyVersion(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPolicyVersion", reflect.TypeOf((*MockPoliciesServiceServer)(nil).GetPolicyVersion), arg0, arg1) +} + +// CreateRole mocks base method +func (m *MockPoliciesServiceServer) CreateRole(arg0 context.Context, arg1 *CreateRoleReq) (*Role, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CreateRole", arg0, arg1) + ret0, _ := ret[0].(*Role) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateRole indicates an expected call of CreateRole +func (mr *MockPoliciesServiceServerMockRecorder) CreateRole(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateRole", reflect.TypeOf((*MockPoliciesServiceServer)(nil).CreateRole), arg0, arg1) +} + +// ListRoles mocks base method +func (m *MockPoliciesServiceServer) ListRoles(arg0 context.Context, arg1 *ListRolesReq) (*ListRolesResp, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListRoles", arg0, arg1) + ret0, _ := ret[0].(*ListRolesResp) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListRoles indicates an expected call of ListRoles +func (mr *MockPoliciesServiceServerMockRecorder) ListRoles(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListRoles", reflect.TypeOf((*MockPoliciesServiceServer)(nil).ListRoles), arg0, arg1) +} + +// GetRole mocks base method +func (m *MockPoliciesServiceServer) GetRole(arg0 context.Context, arg1 *GetRoleReq) (*Role, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetRole", arg0, arg1) + ret0, _ := ret[0].(*Role) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetRole indicates an expected call of GetRole +func (mr *MockPoliciesServiceServerMockRecorder) GetRole(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetRole", reflect.TypeOf((*MockPoliciesServiceServer)(nil).GetRole), arg0, arg1) +} + +// DeleteRole mocks base method +func (m *MockPoliciesServiceServer) DeleteRole(arg0 context.Context, arg1 *DeleteRoleReq) (*DeleteRoleResp, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteRole", arg0, arg1) + ret0, _ := ret[0].(*DeleteRoleResp) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteRole indicates an expected call of DeleteRole +func (mr *MockPoliciesServiceServerMockRecorder) DeleteRole(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteRole", reflect.TypeOf((*MockPoliciesServiceServer)(nil).DeleteRole), arg0, arg1) +} + +// UpdateRole mocks base method +func (m *MockPoliciesServiceServer) UpdateRole(arg0 context.Context, arg1 *UpdateRoleReq) (*Role, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateRole", arg0, arg1) + ret0, _ := ret[0].(*Role) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UpdateRole indicates an expected call of UpdateRole +func (mr *MockPoliciesServiceServerMockRecorder) UpdateRole(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateRole", reflect.TypeOf((*MockPoliciesServiceServer)(nil).UpdateRole), arg0, arg1) +} + +// ListPolicyMembers mocks base method +func (m *MockPoliciesServiceServer) ListPolicyMembers(arg0 context.Context, arg1 *ListPolicyMembersReq) (*ListPolicyMembersResp, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListPolicyMembers", arg0, arg1) + ret0, _ := ret[0].(*ListPolicyMembersResp) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListPolicyMembers indicates an expected call of ListPolicyMembers +func (mr *MockPoliciesServiceServerMockRecorder) ListPolicyMembers(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListPolicyMembers", reflect.TypeOf((*MockPoliciesServiceServer)(nil).ListPolicyMembers), arg0, arg1) +} + +// RemovePolicyMembers mocks base method +func (m *MockPoliciesServiceServer) RemovePolicyMembers(arg0 context.Context, arg1 *RemovePolicyMembersReq) (*RemovePolicyMembersResp, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RemovePolicyMembers", arg0, arg1) + ret0, _ := ret[0].(*RemovePolicyMembersResp) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// RemovePolicyMembers indicates an expected call of RemovePolicyMembers +func (mr *MockPoliciesServiceServerMockRecorder) RemovePolicyMembers(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemovePolicyMembers", reflect.TypeOf((*MockPoliciesServiceServer)(nil).RemovePolicyMembers), arg0, arg1) +} + +// AddPolicyMembers mocks base method +func (m *MockPoliciesServiceServer) AddPolicyMembers(arg0 context.Context, arg1 *AddPolicyMembersReq) (*AddPolicyMembersResp, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "AddPolicyMembers", arg0, arg1) + ret0, _ := ret[0].(*AddPolicyMembersResp) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// AddPolicyMembers indicates an expected call of AddPolicyMembers +func (mr *MockPoliciesServiceServerMockRecorder) AddPolicyMembers(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddPolicyMembers", reflect.TypeOf((*MockPoliciesServiceServer)(nil).AddPolicyMembers), arg0, arg1) +} + +// PurgeSubjectFromPolicies mocks base method +func (m *MockPoliciesServiceServer) PurgeSubjectFromPolicies(arg0 context.Context, arg1 *PurgeSubjectFromPoliciesReq) (*PurgeSubjectFromPoliciesResp, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "PurgeSubjectFromPolicies", arg0, arg1) + ret0, _ := ret[0].(*PurgeSubjectFromPoliciesResp) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// PurgeSubjectFromPolicies indicates an expected call of PurgeSubjectFromPolicies +func (mr *MockPoliciesServiceServerMockRecorder) PurgeSubjectFromPolicies(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PurgeSubjectFromPolicies", reflect.TypeOf((*MockPoliciesServiceServer)(nil).PurgeSubjectFromPolicies), arg0, arg1) +} diff --git a/api/interservice/infra_proxy/response/servers.pb.go b/api/interservice/infra_proxy/response/servers.pb.go index 0b24eac8b01..dbd36c97eed 100644 --- a/api/interservice/infra_proxy/response/servers.pb.go +++ b/api/interservice/infra_proxy/response/servers.pb.go @@ -10,6 +10,7 @@ import ( proto "github.com/golang/protobuf/proto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" reflect "reflect" sync "sync" ) @@ -286,6 +287,8 @@ type Server struct { MigrationType string `protobuf:"bytes,8,opt,name=migration_type,json=migrationType,proto3" json:"migration_type,omitempty" toml:"migration_type,omitempty" mapstructure:"migration_type,omitempty"` //Migration type for active Chef Infra server migration MigrationStatus string `protobuf:"bytes,9,opt,name=migration_status,json=migrationStatus,proto3" json:"migration_status,omitempty" toml:"migration_status,omitempty" mapstructure:"migration_status,omitempty"` + // Last successfull migration or last sync status + LastMigrationTime *timestamppb.Timestamp `protobuf:"bytes,10,opt,name=last_migration_time,json=lastMigrationTime,proto3" json:"last_migration_time,omitempty" toml:"last_migration_time,omitempty" mapstructure:"last_migration_time,omitempty"` } func (x *Server) Reset() { @@ -376,6 +379,13 @@ func (x *Server) GetMigrationStatus() string { return "" } +func (x *Server) GetLastMigrationTime() *timestamppb.Timestamp { + if x != nil { + return x.LastMigrationTime + } + return nil +} + type GetServerStatus struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -545,83 +555,90 @@ var file_interservice_infra_proxy_response_servers_proto_rawDesc = []byte{ 0x6e, 0x73, 0x65, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x29, 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, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x59, 0x0a, 0x0c, - 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x49, 0x0a, 0x06, - 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x31, 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, - 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, - 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x22, 0x59, 0x0a, 0x0c, 0x44, 0x65, 0x6c, 0x65, 0x74, - 0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x49, 0x0a, 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, - 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x31, 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, 0x72, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x06, 0x73, 0x65, 0x72, 0x76, - 0x65, 0x72, 0x22, 0x59, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x65, 0x72, 0x76, - 0x65, 0x72, 0x12, 0x49, 0x0a, 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x31, 0x2e, 0x63, 0x68, 0x65, 0x66, 0x2e, 0x61, 0x75, 0x74, 0x6f, 0x6d, 0x61, + 0x6f, 0x78, 0x79, 0x2e, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x1f, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, + 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x59, 0x0a, + 0x0c, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x49, 0x0a, + 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x31, 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, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x52, 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x22, 0x59, 0x0a, 0x0c, 0x44, 0x65, 0x6c, 0x65, + 0x74, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x49, 0x0a, 0x06, 0x73, 0x65, 0x72, 0x76, + 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x31, 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, 0x72, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x06, 0x73, 0x65, 0x72, + 0x76, 0x65, 0x72, 0x22, 0x59, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x65, 0x72, + 0x76, 0x65, 0x72, 0x12, 0x49, 0x0a, 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x31, 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, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, + 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x22, 0x59, + 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x12, 0x4b, 0x0a, 0x07, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x31, 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, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x22, 0x56, 0x0a, 0x09, 0x47, 0x65, 0x74, + 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x49, 0x0a, 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x31, 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, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, + 0x72, 0x22, 0xbf, 0x02, 0x0a, 0x06, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x12, 0x12, 0x0a, 0x04, 0x66, 0x71, 0x64, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x66, 0x71, 0x64, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x69, 0x70, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x69, 0x70, 0x41, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x6f, 0x72, 0x67, 0x73, 0x5f, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x6f, 0x72, 0x67, 0x73, 0x43, 0x6f, 0x75, + 0x6e, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, + 0x69, 0x64, 0x18, 0x07, 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, 0x08, 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, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x4a, 0x0a, 0x13, 0x6c, 0x61, 0x73, 0x74, 0x5f, + 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x0a, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, + 0x52, 0x11, 0x6c, 0x61, 0x73, 0x74, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, + 0x69, 0x6d, 0x65, 0x22, 0xeb, 0x02, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, + 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, + 0x67, 0x0a, 0x09, 0x75, 0x70, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x03, + 0x28, 0x0b, 0x32, 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, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x53, - 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x22, 0x59, 0x0a, - 0x0a, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x12, 0x4b, 0x0a, 0x07, 0x73, - 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x31, 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, - 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, - 0x07, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x22, 0x56, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x53, - 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x49, 0x0a, 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x31, 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, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, - 0x22, 0xf3, 0x01, 0x0a, 0x06, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, - 0x12, 0x0a, 0x04, 0x66, 0x71, 0x64, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x66, - 0x71, 0x64, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x69, 0x70, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x69, 0x70, 0x41, 0x64, 0x64, 0x72, 0x65, - 0x73, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x6f, 0x72, 0x67, 0x73, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x6f, 0x72, 0x67, 0x73, 0x43, 0x6f, 0x75, 0x6e, - 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, - 0x64, 0x18, 0x07, 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, 0x08, 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, - 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0xeb, 0x02, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x53, 0x65, - 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, - 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x12, 0x67, 0x0a, 0x09, 0x75, 0x70, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x18, - 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 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, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x2e, 0x55, 0x70, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, - 0x52, 0x09, 0x75, 0x70, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x12, 0x5e, 0x0a, 0x06, 0x6b, - 0x65, 0x79, 0x67, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x46, 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, 0x72, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, - 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x4b, 0x65, 0x79, 0x67, 0x65, 0x6e, 0x45, 0x6e, - 0x74, 0x72, 0x79, 0x52, 0x06, 0x6b, 0x65, 0x79, 0x67, 0x65, 0x6e, 0x1a, 0x3c, 0x0a, 0x0e, 0x55, - 0x70, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, - 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, - 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x39, 0x0a, 0x0b, 0x4b, 0x65, 0x79, - 0x67, 0x65, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x3a, 0x02, 0x38, 0x01, 0x22, 0x3e, 0x0a, 0x10, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, - 0x57, 0x65, 0x62, 0x75, 0x69, 0x4b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x69, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x12, 0x14, - 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, - 0x72, 0x72, 0x6f, 0x72, 0x22, 0x10, 0x0a, 0x0e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x57, 0x65, - 0x62, 0x75, 0x69, 0x4b, 0x65, 0x79, 0x42, 0x40, 0x5a, 0x3e, 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, - 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x47, + 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x55, + 0x70, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x09, 0x75, + 0x70, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x12, 0x5e, 0x0a, 0x06, 0x6b, 0x65, 0x79, 0x67, + 0x65, 0x6e, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x46, 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, 0x72, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x2e, 0x4b, 0x65, 0x79, 0x67, 0x65, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, + 0x52, 0x06, 0x6b, 0x65, 0x79, 0x67, 0x65, 0x6e, 0x1a, 0x3c, 0x0a, 0x0e, 0x55, 0x70, 0x73, 0x74, + 0x72, 0x65, 0x61, 0x6d, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x39, 0x0a, 0x0b, 0x4b, 0x65, 0x79, 0x67, 0x65, 0x6e, + 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, + 0x01, 0x22, 0x3e, 0x0a, 0x10, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x57, 0x65, 0x62, + 0x75, 0x69, 0x4b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x65, + 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, + 0x72, 0x22, 0x10, 0x0a, 0x0e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x57, 0x65, 0x62, 0x75, 0x69, + 0x4b, 0x65, 0x79, 0x42, 0x40, 0x5a, 0x3e, 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, 0x72, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -638,17 +655,18 @@ func file_interservice_infra_proxy_response_servers_proto_rawDescGZIP() []byte { var file_interservice_infra_proxy_response_servers_proto_msgTypes = make([]protoimpl.MessageInfo, 11) var file_interservice_infra_proxy_response_servers_proto_goTypes = []interface{}{ - (*CreateServer)(nil), // 0: chef.automate.domain.infra_proxy.response.CreateServer - (*DeleteServer)(nil), // 1: chef.automate.domain.infra_proxy.response.DeleteServer - (*UpdateServer)(nil), // 2: chef.automate.domain.infra_proxy.response.UpdateServer - (*GetServers)(nil), // 3: chef.automate.domain.infra_proxy.response.GetServers - (*GetServer)(nil), // 4: chef.automate.domain.infra_proxy.response.GetServer - (*Server)(nil), // 5: chef.automate.domain.infra_proxy.response.Server - (*GetServerStatus)(nil), // 6: chef.automate.domain.infra_proxy.response.GetServerStatus - (*ValidateWebuiKey)(nil), // 7: chef.automate.domain.infra_proxy.response.ValidateWebuiKey - (*UpdateWebuiKey)(nil), // 8: chef.automate.domain.infra_proxy.response.UpdateWebuiKey - nil, // 9: chef.automate.domain.infra_proxy.response.GetServerStatus.UpstreamsEntry - nil, // 10: chef.automate.domain.infra_proxy.response.GetServerStatus.KeygenEntry + (*CreateServer)(nil), // 0: chef.automate.domain.infra_proxy.response.CreateServer + (*DeleteServer)(nil), // 1: chef.automate.domain.infra_proxy.response.DeleteServer + (*UpdateServer)(nil), // 2: chef.automate.domain.infra_proxy.response.UpdateServer + (*GetServers)(nil), // 3: chef.automate.domain.infra_proxy.response.GetServers + (*GetServer)(nil), // 4: chef.automate.domain.infra_proxy.response.GetServer + (*Server)(nil), // 5: chef.automate.domain.infra_proxy.response.Server + (*GetServerStatus)(nil), // 6: chef.automate.domain.infra_proxy.response.GetServerStatus + (*ValidateWebuiKey)(nil), // 7: chef.automate.domain.infra_proxy.response.ValidateWebuiKey + (*UpdateWebuiKey)(nil), // 8: chef.automate.domain.infra_proxy.response.UpdateWebuiKey + nil, // 9: chef.automate.domain.infra_proxy.response.GetServerStatus.UpstreamsEntry + nil, // 10: chef.automate.domain.infra_proxy.response.GetServerStatus.KeygenEntry + (*timestamppb.Timestamp)(nil), // 11: google.protobuf.Timestamp } var file_interservice_infra_proxy_response_servers_proto_depIdxs = []int32{ 5, // 0: chef.automate.domain.infra_proxy.response.CreateServer.server:type_name -> chef.automate.domain.infra_proxy.response.Server @@ -656,13 +674,14 @@ var file_interservice_infra_proxy_response_servers_proto_depIdxs = []int32{ 5, // 2: chef.automate.domain.infra_proxy.response.UpdateServer.server:type_name -> chef.automate.domain.infra_proxy.response.Server 5, // 3: chef.automate.domain.infra_proxy.response.GetServers.servers:type_name -> chef.automate.domain.infra_proxy.response.Server 5, // 4: chef.automate.domain.infra_proxy.response.GetServer.server:type_name -> chef.automate.domain.infra_proxy.response.Server - 9, // 5: chef.automate.domain.infra_proxy.response.GetServerStatus.upstreams:type_name -> chef.automate.domain.infra_proxy.response.GetServerStatus.UpstreamsEntry - 10, // 6: chef.automate.domain.infra_proxy.response.GetServerStatus.keygen:type_name -> chef.automate.domain.infra_proxy.response.GetServerStatus.KeygenEntry - 7, // [7:7] is the sub-list for method output_type - 7, // [7:7] is the sub-list for method input_type - 7, // [7:7] is the sub-list for extension type_name - 7, // [7:7] is the sub-list for extension extendee - 0, // [0:7] is the sub-list for field type_name + 11, // 5: chef.automate.domain.infra_proxy.response.Server.last_migration_time:type_name -> google.protobuf.Timestamp + 9, // 6: chef.automate.domain.infra_proxy.response.GetServerStatus.upstreams:type_name -> chef.automate.domain.infra_proxy.response.GetServerStatus.UpstreamsEntry + 10, // 7: chef.automate.domain.infra_proxy.response.GetServerStatus.keygen:type_name -> chef.automate.domain.infra_proxy.response.GetServerStatus.KeygenEntry + 8, // [8:8] is the sub-list for method output_type + 8, // [8:8] is the sub-list for method input_type + 8, // [8:8] is the sub-list for extension type_name + 8, // [8:8] is the sub-list for extension extendee + 0, // [0:8] is the sub-list for field type_name } func init() { file_interservice_infra_proxy_response_servers_proto_init() } diff --git a/api/interservice/infra_proxy/response/servers.proto b/api/interservice/infra_proxy/response/servers.proto index 237b29e7920..ff913274ba0 100644 --- a/api/interservice/infra_proxy/response/servers.proto +++ b/api/interservice/infra_proxy/response/servers.proto @@ -3,6 +3,8 @@ syntax = "proto3"; package chef.automate.domain.infra_proxy.response; option go_package = "github.com/chef/automate/api/interservice/infra_proxy/response"; +import "google/protobuf/timestamp.proto"; + message CreateServer { // Chef Infra Server. Server server = 1; @@ -45,6 +47,8 @@ message Server { string migration_type =8; //Migration type for active Chef Infra server migration string migration_status =9; + // Last successfull migration or last sync status + google.protobuf.Timestamp last_migration_time = 10; } message GetServerStatus { diff --git a/components/automate-gateway/api/infra_proxy.pb.swagger.go b/components/automate-gateway/api/infra_proxy.pb.swagger.go index bcd3e2dd911..48a0bab7cb4 100644 --- a/components/automate-gateway/api/infra_proxy.pb.swagger.go +++ b/components/automate-gateway/api/infra_proxy.pb.swagger.go @@ -4851,6 +4851,11 @@ func init() { "migration_status": { "type": "string", "title": "Migration Id for active Chef Infra server migration" + }, + "last_migration_time": { + "type": "string", + "format": "date-time", + "title": "Last successfull migration or last sync status" } } }, diff --git a/components/automate-gateway/handler/infra_proxy/servers.go b/components/automate-gateway/handler/infra_proxy/servers.go index fe8999dd6ec..c56a3ed836d 100644 --- a/components/automate-gateway/handler/infra_proxy/servers.go +++ b/components/automate-gateway/handler/infra_proxy/servers.go @@ -33,6 +33,7 @@ func (a *InfraProxyServer) GetServer(ctx context.Context, r *gwreq.GetServer) (* if err != nil { return nil, err } + return &gwres.GetServer{ Server: fromUpstreamServer(res.Server), }, nil @@ -142,14 +143,15 @@ func (a *InfraProxyServer) UpdateWebuiKey(ctx context.Context, r *gwreq.UpdateWe func fromUpstreamServer(t *infra_res.Server) *gwres.Server { return &gwres.Server{ - Id: t.GetId(), - Name: t.GetName(), - Fqdn: t.GetFqdn(), - IpAddress: t.GetIpAddress(), - OrgsCount: t.GetOrgsCount(), - MigrationId: t.GetMigrationId(), - MigrationType: t.GetMigrationType(), - MigrationStatus: t.GetMigrationStatus(), + Id: t.GetId(), + Name: t.GetName(), + Fqdn: t.GetFqdn(), + IpAddress: t.GetIpAddress(), + OrgsCount: t.GetOrgsCount(), + MigrationId: t.GetMigrationId(), + MigrationType: t.GetMigrationType(), + MigrationStatus: t.GetMigrationStatus(), + LastMigrationTime: t.GetLastMigrationTime(), } } diff --git a/components/infra-proxy-service/server/automate_infra_server_users.go b/components/infra-proxy-service/server/automate_infra_server_users.go index ca4acb007e3..f29c49bc80c 100644 --- a/components/infra-proxy-service/server/automate_infra_server_users.go +++ b/components/infra-proxy-service/server/automate_infra_server_users.go @@ -122,13 +122,13 @@ func (s *Server) ResetInfraServerUserKey(ctx context.Context, req *request.Reset }).Validate() if err != nil { - log.Errorf("failed to validate for server id: %s, error: ", req.ServerId, err) + log.Errorf("failed to validate for server id: %s, error: %v", req.ServerId, err) return nil, err } server, err := s.service.Storage.GetServer(ctx, req.ServerId) if err != nil { - log.Error("cannot get the server for server id: %s, error: ", req.ServerId, err) + log.Errorf("cannot get the server for server id: %s, error: %v", req.ServerId, err) return nil, err } if server.CredentialID == "" { @@ -137,12 +137,12 @@ func (s *Server) ResetInfraServerUserKey(ctx context.Context, req *request.Reset // Get web ui key from secrets service secret, err := s.service.Secrets.Read(ctx, &secrets.Id{Id: server.CredentialID}) if err != nil { - log.Error("cannot read the secret for server id: %s, error: ", req.ServerId, err) + log.Errorf("cannot read the secret for server id: %s, error: %v", req.ServerId, err) return nil, err } c, err := s.createChefServerClient(ctx, req.ServerId, GetAdminKeyFrom(secret), "pivotal", true) if err != nil { - log.Error("cannot create a client for server id: %s, error: ", req.ServerId, err) + log.Errorf("cannot create a client for server id: %s, error: %v", req.ServerId, err) return nil, err } @@ -150,7 +150,7 @@ func (s *Server) ResetInfraServerUserKey(ctx context.Context, req *request.Reset _, err = c.client.Users.DeleteKey(req.UserName, "default") chefError, _ := chef.ChefError(err) if err != nil && chefError.StatusCode() != 404 { - log.Error("cannot connect to the chef server for server id: %s, error: ", req.ServerId, err) + log.Errorf("cannot connect to the chef server for server id: %s, error: %v", req.ServerId, err) return nil, ParseAPIError(err) } @@ -161,7 +161,7 @@ func (s *Server) ResetInfraServerUserKey(ctx context.Context, req *request.Reset CreateKey: true, }) if err != nil { - log.Error("cannot add key to the client for server id: %s, error: ", req.ServerId, err) + log.Errorf("cannot add key to the client for server id: %s, error: %v", req.ServerId, err) return nil, ParseAPIError(err) } @@ -169,18 +169,18 @@ func (s *Server) ResetInfraServerUserKey(ctx context.Context, req *request.Reset addReq, err := c.client.NewRequest("POST", fmt.Sprintf("users/%s/keys", req.UserName), body) if err != nil { - log.Error("cannot create a request for server id: %s, error: ", req.ServerId, err) + log.Errorf("cannot create a request for server id: %s, error: %v", req.ServerId, err) return nil, ParseAPIError(err) } res, err := c.client.Do(addReq, &chefKey) if res != nil { - log.Error("received nil response") + log.Errorf("received nil response") defer res.Body.Close() //nolint:errcheck } if err != nil { - log.Error("error occurred while sending a request for server id: %s, error: ", req.ServerId, err) + log.Errorf("error occurred while sending a request for server id: %s, error: %v", req.ServerId, err) return nil, ParseAPIError(err) } diff --git a/components/infra-proxy-service/server/servers.go b/components/infra-proxy-service/server/servers.go index 654a4514d64..cdc2bf3888a 100644 --- a/components/infra-proxy-service/server/servers.go +++ b/components/infra-proxy-service/server/servers.go @@ -6,6 +6,7 @@ import ( "io/ioutil" log "github.com/sirupsen/logrus" + "google.golang.org/protobuf/types/known/timestamppb" "github.com/chef/automate/api/external/common/query" secrets "github.com/chef/automate/api/external/secrets" @@ -179,10 +180,11 @@ func (s *Server) GetServer(ctx context.Context, req *request.GetServer) (*respon if err != nil { return nil, service.ParseStorageError(err, *req, "server") } - migration, err := s.service.Migration.GetActiveMigration(ctx, req.Id) + migration, err := s.service.Migration.GetLastSuccessfulMigration(ctx, req.Id) if err != nil { log.Errorf("Unable to fetch migration status for server id:%s", req.Id) } + resp := &response.GetServer{ Server: fromStorageServerWithMigrationDetails(server, migration), } @@ -392,14 +394,24 @@ func fromStorageToListServers(sl []storage.Server) []*response.Server { // Create a response.Server from a storage.Server with migration func fromStorageServerWithMigrationDetails(s storage.Server, m storage.MigrationStatus) *response.Server { + var timeStamp *timestamppb.Timestamp + + // If timestamp is zero send nil value + if m.Timestamp.IsZero() { + timeStamp = nil + } else { + timeStamp = timestamppb.New(m.Timestamp) + } + return &response.Server{ - Id: s.ID, - Name: s.Name, - Fqdn: s.Fqdn, - IpAddress: s.IPAddress, - OrgsCount: s.OrgsCount, - MigrationId: m.MigrationID, - MigrationType: m.MigrationType, - MigrationStatus: m.MigrationStatus, + Id: s.ID, + Name: s.Name, + Fqdn: s.Fqdn, + IpAddress: s.IPAddress, + OrgsCount: s.OrgsCount, + MigrationId: m.MigrationID, + MigrationType: m.MigrationType, + MigrationStatus: m.MigrationStatus, + LastMigrationTime: timeStamp, } } diff --git a/components/infra-proxy-service/storage/postgres/migrations.go b/components/infra-proxy-service/storage/postgres/migrations.go index 9f8f5fe4060..b51f86b2edf 100644 --- a/components/infra-proxy-service/storage/postgres/migrations.go +++ b/components/infra-proxy-service/storage/postgres/migrations.go @@ -4,6 +4,9 @@ import ( "context" "encoding/json" "errors" + "time" + + log "github.com/sirupsen/logrus" "github.com/chef/automate/components/infra-proxy-service/constants" "github.com/chef/automate/components/infra-proxy-service/storage" @@ -220,6 +223,36 @@ func (p *postgres) insertMigration(ctx context.Context, migrationId, serverId, m return m, nil } +//GetLastSuccessfulMigration gets the Migration ID and Migration Status for a server id +func (p *postgres) GetLastSuccessfulMigration(ctx context.Context, serverId string) (storage.MigrationStatus, error) { + var m storage.MigrationStatus + var updateTime string + query := `select m.migration_id,t.type,s.status_message, m.updated_timestamp + from migration m + join migration_type t on m.type_id=t.id + join migration_status s on m.status_id=s.id + and m.type_id=5000 + and m.server_id=$1 AND m.status_id=101 order by updated_timestamp desc FETCH FIRST ROW ONLY` + err := p.db.QueryRowContext(ctx, + query, serverId). + Scan(&m.MigrationID, &m.MigrationType, &m.MigrationStatus, &updateTime) + + if err != nil { + return storage.MigrationStatus{}, err + } + + // The string passed in Parse function is format + time, err := time.Parse("2006-01-02T15:04:05Z07:00", updateTime) + if err != nil { + log.Error("Unable to parse time", err) + } + + m.Timestamp = time + log.Printf("Timestamp: %+v", m.Timestamp) + + return m, nil +} + //GetActiveMigration gets the Migration ID and Migration Status for a server id func (p *postgres) GetActiveMigration(ctx context.Context, serverId string) (storage.MigrationStatus, error) { var m storage.MigrationStatus diff --git a/components/infra-proxy-service/storage/storage.go b/components/infra-proxy-service/storage/storage.go index 9662a7a3ea1..147b4ba0f54 100644 --- a/components/infra-proxy-service/storage/storage.go +++ b/components/infra-proxy-service/storage/storage.go @@ -82,6 +82,7 @@ type MigrationStorage interface { DeleteMigrationStage(ctx context.Context, migrationId string) (MigrationStage, error) GetActiveMigration(ctx context.Context, serverId string) (MigrationStatus, error) + GetLastSuccessfulMigration(ctx context.Context, serverId string) (MigrationStatus, error) GetMigrationStatus(ctx context.Context, migrationId string) (MigrationStatus, error) } @@ -177,6 +178,7 @@ type MigrationStatus struct { MigrationStatus string MigrationStatusID int64 MigrationTypeID int64 + Timestamp time.Time } // Errors returned from the backend