From e0c2f01fdfde74cd43b19fcdef7dff36f235eeb0 Mon Sep 17 00:00:00 2001 From: Michel Vocks Date: Wed, 18 Aug 2021 09:47:02 +0200 Subject: [PATCH 1/7] Initial commit --- cqproto/grpc.go | 68 +++- cqproto/internal/plugin.pb.go | 624 +++++++++++++++-------------- cqproto/internal/plugin.proto | 15 + cqproto/internal/plugin_grpc.pb.go | 245 +++++++++++ cqproto/provider.go | 18 +- go.mod | 4 +- go.sum | 20 + provider/provider.go | 16 +- provider/schema/execution.go | 130 +++++- provider/schema/execution_test.go | 28 +- provider/schema/resources_test.go | 6 +- 11 files changed, 828 insertions(+), 346 deletions(-) create mode 100644 cqproto/internal/plugin_grpc.pb.go diff --git a/cqproto/grpc.go b/cqproto/grpc.go index b8aa1396..a357702b 100644 --- a/cqproto/grpc.go +++ b/cqproto/grpc.go @@ -63,7 +63,8 @@ func (g GRPCClient) ConfigureProvider(ctx context.Context, request *ConfigurePro func (g GRPCClient) FetchResources(ctx context.Context, request *FetchResourcesRequest) (FetchResourcesStream, error) { res, err := g.client.FetchResources(ctx, &internal.FetchResources_Request{ - Resources: request.Resources, + Resources: request.Resources, + PartialFetchingEnabled: request.PartialFetchingEnabled, }) if err != nil { return nil, err @@ -81,9 +82,10 @@ func (g GRPCFetchResponseStream) Recv() (*FetchResourcesResponse, error) { return nil, err } return &FetchResourcesResponse{ - FinishedResources: resp.GetFinishedResources(), - ResourceCount: resp.GetResourceCount(), - Error: resp.GetError(), + FinishedResources: resp.GetFinishedResources(), + ResourceCount: resp.GetResourceCount(), + Error: resp.GetError(), + PartialFetchFailedResources: partialFetchFailedResourcesFromProto(resp.GetPartialFetchFailedResources()), }, nil } @@ -143,7 +145,7 @@ func (g *GRPCServer) ConfigureProvider(ctx context.Context, request *internal.Co func (g *GRPCServer) FetchResources(request *internal.FetchResources_Request, server internal.Provider_FetchResourcesServer) error { return g.Impl.FetchResources( server.Context(), - &FetchResourcesRequest{Resources: request.GetResources()}, + &FetchResourcesRequest{Resources: request.GetResources(), PartialFetchingEnabled: request.PartialFetchingEnabled}, &GRPCFetchResourcesServer{server: server}, ) } @@ -154,9 +156,10 @@ type GRPCFetchResourcesServer struct { func (g GRPCFetchResourcesServer) Send(response *FetchResourcesResponse) error { return g.server.Send(&internal.FetchResources_Response{ - FinishedResources: response.FinishedResources, - ResourceCount: response.ResourceCount, - Error: response.Error, + FinishedResources: response.FinishedResources, + ResourceCount: response.ResourceCount, + Error: response.Error, + PartialFetchFailedResources: partialFetchFailedResourcesToProto(response.PartialFetchFailedResources), }) } @@ -233,3 +236,52 @@ func tableToProto(in *schema.Table) *internal.Table { }, } } + +func partialFetchFailedResourcesFromProto(in []*internal.PartialFetchFailedResource) []*PartialFetchFailedResource { + if len(in) == 0 { + return nil + } + failedResources := make([]*PartialFetchFailedResource, len(in)) + for i, p := range in { + failedResources[i] = &PartialFetchFailedResource{ + TableName: p.TableName, + RootTableName: p.RootTableName, + RootPrimaryKeyValues: p.RootPrimaryKeyValues, + Error: p.Error, + } + } + return failedResources +} + +func partialFetchFailedResourcesToProto(in []*PartialFetchFailedResource) []*internal.PartialFetchFailedResource { + if len(in) == 0 { + return nil + } + failedResources := make([]*internal.PartialFetchFailedResource, len(in)) + for i, p := range in { + failedResources[i] = &internal.PartialFetchFailedResource{ + TableName: p.TableName, + RootTableName: p.RootTableName, + RootPrimaryKeyValues: p.RootPrimaryKeyValues, + Error: p.Error, + } + } + return failedResources +} + +// PartialFetchToCQProto converts schema partial fetch failed resources to cq-proto partial fetch resources +func PartialFetchToCQProto(in []schema.PartialFetchFailedResource) []*PartialFetchFailedResource { + if len(in) == 0 { + return nil + } + failedResources := make([]*PartialFetchFailedResource, len(in)) + for i, p := range in { + failedResources[i] = &PartialFetchFailedResource{ + TableName: p.TableName, + RootTableName: p.RootTableName, + RootPrimaryKeyValues: p.RootPrimaryKeyValues, + Error: p.Error, + } + } + return failedResources +} diff --git a/cqproto/internal/plugin.pb.go b/cqproto/internal/plugin.pb.go index b23e51d1..d9f91b78 100644 --- a/cqproto/internal/plugin.pb.go +++ b/cqproto/internal/plugin.pb.go @@ -1,21 +1,16 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.26.0 -// protoc v3.15.7 +// protoc v3.17.3 // source: internal/plugin.proto package internal import ( - context "context" - reflect "reflect" - sync "sync" - - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) const ( @@ -244,6 +239,81 @@ func (*FetchResources) Descriptor() ([]byte, []int) { return file_internal_plugin_proto_rawDescGZIP(), []int{1} } +type PartialFetchFailedResource struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // table name of the failed resource fetch + TableName string `protobuf:"bytes,1,opt,name=table_name,json=tableName,proto3" json:"table_name,omitempty"` + // root/parent table name + RootTableName string `protobuf:"bytes,2,opt,name=root_table_name,json=rootTableName,proto3" json:"root_table_name,omitempty"` + // root/parent primary key values + RootPrimaryKeyValues []string `protobuf:"bytes,3,rep,name=root_primary_key_values,json=rootPrimaryKeyValues,proto3" json:"root_primary_key_values,omitempty"` + // error message for this resource fetch failure + Error string `protobuf:"bytes,4,opt,name=error,proto3" json:"error,omitempty"` +} + +func (x *PartialFetchFailedResource) Reset() { + *x = PartialFetchFailedResource{} + if protoimpl.UnsafeEnabled { + mi := &file_internal_plugin_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PartialFetchFailedResource) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PartialFetchFailedResource) ProtoMessage() {} + +func (x *PartialFetchFailedResource) ProtoReflect() protoreflect.Message { + mi := &file_internal_plugin_proto_msgTypes[2] + 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 PartialFetchFailedResource.ProtoReflect.Descriptor instead. +func (*PartialFetchFailedResource) Descriptor() ([]byte, []int) { + return file_internal_plugin_proto_rawDescGZIP(), []int{2} +} + +func (x *PartialFetchFailedResource) GetTableName() string { + if x != nil { + return x.TableName + } + return "" +} + +func (x *PartialFetchFailedResource) GetRootTableName() string { + if x != nil { + return x.RootTableName + } + return "" +} + +func (x *PartialFetchFailedResource) GetRootPrimaryKeyValues() []string { + if x != nil { + return x.RootPrimaryKeyValues + } + return nil +} + +func (x *PartialFetchFailedResource) GetError() string { + if x != nil { + return x.Error + } + return "" +} + type GetProviderSchema struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -253,7 +323,7 @@ type GetProviderSchema struct { func (x *GetProviderSchema) Reset() { *x = GetProviderSchema{} if protoimpl.UnsafeEnabled { - mi := &file_internal_plugin_proto_msgTypes[2] + mi := &file_internal_plugin_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -266,7 +336,7 @@ func (x *GetProviderSchema) String() string { func (*GetProviderSchema) ProtoMessage() {} func (x *GetProviderSchema) ProtoReflect() protoreflect.Message { - mi := &file_internal_plugin_proto_msgTypes[2] + mi := &file_internal_plugin_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -279,7 +349,7 @@ func (x *GetProviderSchema) ProtoReflect() protoreflect.Message { // Deprecated: Use GetProviderSchema.ProtoReflect.Descriptor instead. func (*GetProviderSchema) Descriptor() ([]byte, []int) { - return file_internal_plugin_proto_rawDescGZIP(), []int{2} + return file_internal_plugin_proto_rawDescGZIP(), []int{3} } type GetProviderConfig struct { @@ -291,7 +361,7 @@ type GetProviderConfig struct { func (x *GetProviderConfig) Reset() { *x = GetProviderConfig{} if protoimpl.UnsafeEnabled { - mi := &file_internal_plugin_proto_msgTypes[3] + mi := &file_internal_plugin_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -304,7 +374,7 @@ func (x *GetProviderConfig) String() string { func (*GetProviderConfig) ProtoMessage() {} func (x *GetProviderConfig) ProtoReflect() protoreflect.Message { - mi := &file_internal_plugin_proto_msgTypes[3] + mi := &file_internal_plugin_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -317,7 +387,7 @@ func (x *GetProviderConfig) ProtoReflect() protoreflect.Message { // Deprecated: Use GetProviderConfig.ProtoReflect.Descriptor instead. func (*GetProviderConfig) Descriptor() ([]byte, []int) { - return file_internal_plugin_proto_rawDescGZIP(), []int{3} + return file_internal_plugin_proto_rawDescGZIP(), []int{4} } // Table is the definition of how a table is defined in a provider @@ -336,7 +406,7 @@ type Table struct { func (x *Table) Reset() { *x = Table{} if protoimpl.UnsafeEnabled { - mi := &file_internal_plugin_proto_msgTypes[4] + mi := &file_internal_plugin_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -349,7 +419,7 @@ func (x *Table) String() string { func (*Table) ProtoMessage() {} func (x *Table) ProtoReflect() protoreflect.Message { - mi := &file_internal_plugin_proto_msgTypes[4] + mi := &file_internal_plugin_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -362,7 +432,7 @@ func (x *Table) ProtoReflect() protoreflect.Message { // Deprecated: Use Table.ProtoReflect.Descriptor instead. func (*Table) Descriptor() ([]byte, []int) { - return file_internal_plugin_proto_rawDescGZIP(), []int{4} + return file_internal_plugin_proto_rawDescGZIP(), []int{5} } func (x *Table) GetName() string { @@ -411,7 +481,7 @@ type TableCreationOptions struct { func (x *TableCreationOptions) Reset() { *x = TableCreationOptions{} if protoimpl.UnsafeEnabled { - mi := &file_internal_plugin_proto_msgTypes[5] + mi := &file_internal_plugin_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -424,7 +494,7 @@ func (x *TableCreationOptions) String() string { func (*TableCreationOptions) ProtoMessage() {} func (x *TableCreationOptions) ProtoReflect() protoreflect.Message { - mi := &file_internal_plugin_proto_msgTypes[5] + mi := &file_internal_plugin_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -437,7 +507,7 @@ func (x *TableCreationOptions) ProtoReflect() protoreflect.Message { // Deprecated: Use TableCreationOptions.ProtoReflect.Descriptor instead. func (*TableCreationOptions) Descriptor() ([]byte, []int) { - return file_internal_plugin_proto_rawDescGZIP(), []int{5} + return file_internal_plugin_proto_rawDescGZIP(), []int{6} } func (x *TableCreationOptions) GetPrimaryKeys() []string { @@ -460,7 +530,7 @@ type Column struct { func (x *Column) Reset() { *x = Column{} if protoimpl.UnsafeEnabled { - mi := &file_internal_plugin_proto_msgTypes[6] + mi := &file_internal_plugin_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -473,7 +543,7 @@ func (x *Column) String() string { func (*Column) ProtoMessage() {} func (x *Column) ProtoReflect() protoreflect.Message { - mi := &file_internal_plugin_proto_msgTypes[6] + mi := &file_internal_plugin_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -486,7 +556,7 @@ func (x *Column) ProtoReflect() protoreflect.Message { // Deprecated: Use Column.ProtoReflect.Descriptor instead. func (*Column) Descriptor() ([]byte, []int) { - return file_internal_plugin_proto_rawDescGZIP(), []int{6} + return file_internal_plugin_proto_rawDescGZIP(), []int{7} } func (x *Column) GetName() string { @@ -522,7 +592,7 @@ type ConnectionDetails struct { func (x *ConnectionDetails) Reset() { *x = ConnectionDetails{} if protoimpl.UnsafeEnabled { - mi := &file_internal_plugin_proto_msgTypes[7] + mi := &file_internal_plugin_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -535,7 +605,7 @@ func (x *ConnectionDetails) String() string { func (*ConnectionDetails) ProtoMessage() {} func (x *ConnectionDetails) ProtoReflect() protoreflect.Message { - mi := &file_internal_plugin_proto_msgTypes[7] + mi := &file_internal_plugin_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -548,7 +618,7 @@ func (x *ConnectionDetails) ProtoReflect() protoreflect.Message { // Deprecated: Use ConnectionDetails.ProtoReflect.Descriptor instead. func (*ConnectionDetails) Descriptor() ([]byte, []int) { - return file_internal_plugin_proto_rawDescGZIP(), []int{7} + return file_internal_plugin_proto_rawDescGZIP(), []int{8} } func (x *ConnectionDetails) GetType() ConnectionType { @@ -585,7 +655,7 @@ type ConfigureProvider_Request struct { func (x *ConfigureProvider_Request) Reset() { *x = ConfigureProvider_Request{} if protoimpl.UnsafeEnabled { - mi := &file_internal_plugin_proto_msgTypes[8] + mi := &file_internal_plugin_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -598,7 +668,7 @@ func (x *ConfigureProvider_Request) String() string { func (*ConfigureProvider_Request) ProtoMessage() {} func (x *ConfigureProvider_Request) ProtoReflect() protoreflect.Message { - mi := &file_internal_plugin_proto_msgTypes[8] + mi := &file_internal_plugin_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -660,7 +730,7 @@ type ConfigureProvider_Response struct { func (x *ConfigureProvider_Response) Reset() { *x = ConfigureProvider_Response{} if protoimpl.UnsafeEnabled { - mi := &file_internal_plugin_proto_msgTypes[9] + mi := &file_internal_plugin_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -673,7 +743,7 @@ func (x *ConfigureProvider_Response) String() string { func (*ConfigureProvider_Response) ProtoMessage() {} func (x *ConfigureProvider_Response) ProtoReflect() protoreflect.Message { - mi := &file_internal_plugin_proto_msgTypes[9] + mi := &file_internal_plugin_proto_msgTypes[10] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -703,12 +773,14 @@ type FetchResources_Request struct { // list of resources provider is requested to fetch Resources []string `protobuf:"bytes,1,rep,name=resources,proto3" json:"resources,omitempty"` + // trigger to enable partial fetching + PartialFetchingEnabled bool `protobuf:"varint,2,opt,name=partial_fetching_enabled,json=partialFetchingEnabled,proto3" json:"partial_fetching_enabled,omitempty"` } func (x *FetchResources_Request) Reset() { *x = FetchResources_Request{} if protoimpl.UnsafeEnabled { - mi := &file_internal_plugin_proto_msgTypes[10] + mi := &file_internal_plugin_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -721,7 +793,7 @@ func (x *FetchResources_Request) String() string { func (*FetchResources_Request) ProtoMessage() {} func (x *FetchResources_Request) ProtoReflect() protoreflect.Message { - mi := &file_internal_plugin_proto_msgTypes[10] + mi := &file_internal_plugin_proto_msgTypes[11] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -744,6 +816,13 @@ func (x *FetchResources_Request) GetResources() []string { return nil } +func (x *FetchResources_Request) GetPartialFetchingEnabled() bool { + if x != nil { + return x.PartialFetchingEnabled + } + return false +} + type FetchResources_Response struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -755,12 +834,14 @@ type FetchResources_Response struct { ResourceCount uint64 `protobuf:"varint,2,opt,name=resource_count,json=resourceCount,proto3" json:"resource_count,omitempty"` // Error value if any, if returned the stream will be canceled Error string `protobuf:"bytes,3,opt,name=error,proto3" json:"error,omitempty"` + // list of resources where the fetching failed + PartialFetchFailedResources []*PartialFetchFailedResource `protobuf:"bytes,4,rep,name=partial_fetch_failed_resources,json=partialFetchFailedResources,proto3" json:"partial_fetch_failed_resources,omitempty"` } func (x *FetchResources_Response) Reset() { *x = FetchResources_Response{} if protoimpl.UnsafeEnabled { - mi := &file_internal_plugin_proto_msgTypes[11] + mi := &file_internal_plugin_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -773,7 +854,7 @@ func (x *FetchResources_Response) String() string { func (*FetchResources_Response) ProtoMessage() {} func (x *FetchResources_Response) ProtoReflect() protoreflect.Message { - mi := &file_internal_plugin_proto_msgTypes[11] + mi := &file_internal_plugin_proto_msgTypes[12] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -810,6 +891,13 @@ func (x *FetchResources_Response) GetError() string { return "" } +func (x *FetchResources_Response) GetPartialFetchFailedResources() []*PartialFetchFailedResource { + if x != nil { + return x.PartialFetchFailedResources + } + return nil +} + type GetProviderSchema_Request struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -819,7 +907,7 @@ type GetProviderSchema_Request struct { func (x *GetProviderSchema_Request) Reset() { *x = GetProviderSchema_Request{} if protoimpl.UnsafeEnabled { - mi := &file_internal_plugin_proto_msgTypes[13] + mi := &file_internal_plugin_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -832,7 +920,7 @@ func (x *GetProviderSchema_Request) String() string { func (*GetProviderSchema_Request) ProtoMessage() {} func (x *GetProviderSchema_Request) ProtoReflect() protoreflect.Message { - mi := &file_internal_plugin_proto_msgTypes[13] + mi := &file_internal_plugin_proto_msgTypes[14] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -845,7 +933,7 @@ func (x *GetProviderSchema_Request) ProtoReflect() protoreflect.Message { // Deprecated: Use GetProviderSchema_Request.ProtoReflect.Descriptor instead. func (*GetProviderSchema_Request) Descriptor() ([]byte, []int) { - return file_internal_plugin_proto_rawDescGZIP(), []int{2, 0} + return file_internal_plugin_proto_rawDescGZIP(), []int{3, 0} } type GetProviderSchema_Response struct { @@ -862,7 +950,7 @@ type GetProviderSchema_Response struct { func (x *GetProviderSchema_Response) Reset() { *x = GetProviderSchema_Response{} if protoimpl.UnsafeEnabled { - mi := &file_internal_plugin_proto_msgTypes[14] + mi := &file_internal_plugin_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -875,7 +963,7 @@ func (x *GetProviderSchema_Response) String() string { func (*GetProviderSchema_Response) ProtoMessage() {} func (x *GetProviderSchema_Response) ProtoReflect() protoreflect.Message { - mi := &file_internal_plugin_proto_msgTypes[14] + mi := &file_internal_plugin_proto_msgTypes[15] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -888,7 +976,7 @@ func (x *GetProviderSchema_Response) ProtoReflect() protoreflect.Message { // Deprecated: Use GetProviderSchema_Response.ProtoReflect.Descriptor instead. func (*GetProviderSchema_Response) Descriptor() ([]byte, []int) { - return file_internal_plugin_proto_rawDescGZIP(), []int{2, 1} + return file_internal_plugin_proto_rawDescGZIP(), []int{3, 1} } func (x *GetProviderSchema_Response) GetName() string { @@ -954,7 +1042,7 @@ func (x *GetProviderConfig_Request) ProtoReflect() protoreflect.Message { // Deprecated: Use GetProviderConfig_Request.ProtoReflect.Descriptor instead. func (*GetProviderConfig_Request) Descriptor() ([]byte, []int) { - return file_internal_plugin_proto_rawDescGZIP(), []int{3, 0} + return file_internal_plugin_proto_rawDescGZIP(), []int{4, 0} } type GetProviderConfig_Response struct { @@ -996,7 +1084,7 @@ func (x *GetProviderConfig_Response) ProtoReflect() protoreflect.Message { // Deprecated: Use GetProviderConfig_Response.ProtoReflect.Descriptor instead. func (*GetProviderConfig_Response) Descriptor() ([]byte, []int) { - return file_internal_plugin_proto_rawDescGZIP(), []int{3, 1} + return file_internal_plugin_proto_rawDescGZIP(), []int{4, 1} } func (x *GetProviderConfig_Response) GetName() string { @@ -1041,23 +1129,21 @@ var file_internal_plugin_proto_rawDesc = []byte{ 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x65, 0x78, 0x74, 0x72, 0x61, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x1a, 0x20, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0xaf, 0x02, 0x0a, 0x0e, - 0x46, 0x65, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x1a, 0x27, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0xd1, 0x03, 0x0a, 0x0e, + 0x46, 0x65, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x1a, 0x61, 0x0a, 0x07, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, - 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x1a, 0xf3, 0x01, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x64, 0x0a, 0x12, 0x66, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, - 0x5f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x35, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x46, 0x65, 0x74, 0x63, 0x68, 0x52, 0x65, - 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x2e, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x11, 0x66, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, - 0x64, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x72, 0x65, - 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x04, 0x52, 0x0d, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x43, 0x6f, 0x75, 0x6e, - 0x74, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x1a, 0x44, 0x0a, 0x16, 0x46, 0x69, 0x6e, 0x69, 0x73, + 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, 0x38, 0x0a, 0x18, 0x70, 0x61, 0x72, 0x74, 0x69, + 0x61, 0x6c, 0x5f, 0x66, 0x65, 0x74, 0x63, 0x68, 0x69, 0x6e, 0x67, 0x5f, 0x65, 0x6e, 0x61, 0x62, + 0x6c, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x16, 0x70, 0x61, 0x72, 0x74, 0x69, + 0x61, 0x6c, 0x46, 0x65, 0x74, 0x63, 0x68, 0x69, 0x6e, 0x67, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, + 0x64, 0x1a, 0xdb, 0x02, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x64, + 0x0a, 0x12, 0x66, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x5f, 0x72, 0x65, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2e, 0x46, 0x65, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x73, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, +<<<<<<< HEAD 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, 0x08, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x9c, 0x03, @@ -1167,6 +1253,132 @@ var file_internal_plugin_proto_rawDesc = []byte{ 0x63, 0x68, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x42, 0x0b, 0x5a, 0x09, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +======= + 0x79, 0x52, 0x11, 0x66, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x52, 0x65, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x72, 0x65, + 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x65, + 0x72, 0x72, 0x6f, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, + 0x72, 0x12, 0x66, 0x0a, 0x1e, 0x70, 0x61, 0x72, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x66, 0x65, 0x74, + 0x63, 0x68, 0x5f, 0x66, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x5f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2e, 0x50, 0x61, 0x72, 0x74, 0x69, 0x61, 0x6c, 0x46, 0x65, 0x74, 0x63, 0x68, 0x46, 0x61, + 0x69, 0x6c, 0x65, 0x64, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x1b, 0x70, 0x61, + 0x72, 0x74, 0x69, 0x61, 0x6c, 0x46, 0x65, 0x74, 0x63, 0x68, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, + 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x1a, 0x44, 0x0a, 0x16, 0x46, 0x69, 0x6e, + 0x69, 0x73, 0x68, 0x65, 0x64, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 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, 0x08, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, + 0xb0, 0x01, 0x0a, 0x1a, 0x50, 0x61, 0x72, 0x74, 0x69, 0x61, 0x6c, 0x46, 0x65, 0x74, 0x63, 0x68, + 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x1d, + 0x0a, 0x0a, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x09, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x26, 0x0a, + 0x0f, 0x72, 0x6f, 0x6f, 0x74, 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x72, 0x6f, 0x6f, 0x74, 0x54, 0x61, 0x62, 0x6c, + 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x35, 0x0a, 0x17, 0x72, 0x6f, 0x6f, 0x74, 0x5f, 0x70, 0x72, + 0x69, 0x6d, 0x61, 0x72, 0x79, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, + 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x14, 0x72, 0x6f, 0x6f, 0x74, 0x50, 0x72, 0x69, 0x6d, + 0x61, 0x72, 0x79, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x14, 0x0a, 0x05, + 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, + 0x6f, 0x72, 0x22, 0x8a, 0x02, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, + 0x65, 0x72, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x1a, 0x09, 0x0a, 0x07, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0xe9, 0x01, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x5e, + 0x0a, 0x0f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, + 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, + 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x53, 0x63, 0x68, 0x65, 0x6d, + 0x61, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0e, + 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x1a, 0x4f, + 0x0a, 0x13, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x61, 0x62, 0x6c, 0x65, 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, 0x22, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x54, + 0x61, 0x62, 0x6c, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, + 0x70, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x43, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x1a, 0x09, 0x0a, 0x07, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x50, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, + 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x22, 0xda, 0x01, 0x0a, 0x05, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, + 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x12, 0x27, 0x0a, 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f, 0x6c, 0x75, 0x6d, + 0x6e, 0x52, 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x12, 0x2a, 0x0a, 0x09, 0x72, 0x65, + 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x09, 0x72, 0x65, 0x6c, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x3a, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, + 0x54, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x48, 0x00, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x88, + 0x01, 0x01, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x38, + 0x0a, 0x14, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x50, 0x72, 0x69, 0x6d, 0x61, 0x72, + 0x79, 0x4b, 0x65, 0x79, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x50, 0x72, 0x69, + 0x6d, 0x61, 0x72, 0x79, 0x4b, 0x65, 0x79, 0x73, 0x22, 0x65, 0x0a, 0x06, 0x43, 0x6f, 0x6c, 0x75, + 0x6d, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, + 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x25, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x11, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, + 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, + 0x50, 0x0a, 0x11, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x74, + 0x61, 0x69, 0x6c, 0x73, 0x12, 0x29, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f, 0x6e, 0x6e, 0x65, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, + 0x10, 0x0a, 0x03, 0x64, 0x73, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x64, 0x73, + 0x6e, 0x2a, 0x97, 0x02, 0x0a, 0x0a, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x54, 0x79, 0x70, 0x65, + 0x12, 0x0b, 0x0a, 0x07, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x10, 0x00, 0x12, 0x08, 0x0a, + 0x04, 0x42, 0x4f, 0x4f, 0x4c, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x53, 0x4d, 0x41, 0x4c, 0x4c, + 0x49, 0x4e, 0x54, 0x10, 0x02, 0x12, 0x07, 0x0a, 0x03, 0x49, 0x4e, 0x54, 0x10, 0x03, 0x12, 0x0a, + 0x0a, 0x06, 0x42, 0x49, 0x47, 0x49, 0x4e, 0x54, 0x10, 0x04, 0x12, 0x09, 0x0a, 0x05, 0x46, 0x4c, + 0x4f, 0x41, 0x54, 0x10, 0x05, 0x12, 0x08, 0x0a, 0x04, 0x55, 0x55, 0x49, 0x44, 0x10, 0x06, 0x12, + 0x0a, 0x0a, 0x06, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x10, 0x07, 0x12, 0x0e, 0x0a, 0x0a, 0x42, + 0x59, 0x54, 0x45, 0x5f, 0x41, 0x52, 0x52, 0x41, 0x59, 0x10, 0x08, 0x12, 0x10, 0x0a, 0x0c, 0x53, + 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x41, 0x52, 0x52, 0x41, 0x59, 0x10, 0x09, 0x12, 0x0d, 0x0a, + 0x09, 0x49, 0x4e, 0x54, 0x5f, 0x41, 0x52, 0x52, 0x41, 0x59, 0x10, 0x0a, 0x12, 0x0d, 0x0a, 0x09, + 0x54, 0x49, 0x4d, 0x45, 0x53, 0x54, 0x41, 0x4d, 0x50, 0x10, 0x0b, 0x12, 0x08, 0x0a, 0x04, 0x4a, + 0x53, 0x4f, 0x4e, 0x10, 0x0c, 0x12, 0x0e, 0x0a, 0x0a, 0x55, 0x55, 0x49, 0x44, 0x5f, 0x41, 0x52, + 0x52, 0x41, 0x59, 0x10, 0x0d, 0x12, 0x08, 0x0a, 0x04, 0x49, 0x4e, 0x45, 0x54, 0x10, 0x0e, 0x12, + 0x0e, 0x0a, 0x0a, 0x49, 0x4e, 0x45, 0x54, 0x5f, 0x41, 0x52, 0x52, 0x41, 0x59, 0x10, 0x0f, 0x12, + 0x08, 0x0a, 0x04, 0x43, 0x49, 0x44, 0x52, 0x10, 0x10, 0x12, 0x0e, 0x0a, 0x0a, 0x43, 0x49, 0x44, + 0x52, 0x5f, 0x41, 0x52, 0x52, 0x41, 0x59, 0x10, 0x11, 0x12, 0x0c, 0x0a, 0x08, 0x4d, 0x41, 0x43, + 0x5f, 0x41, 0x44, 0x44, 0x52, 0x10, 0x12, 0x12, 0x12, 0x0a, 0x0e, 0x4d, 0x41, 0x43, 0x5f, 0x41, + 0x44, 0x44, 0x52, 0x5f, 0x41, 0x52, 0x52, 0x41, 0x59, 0x10, 0x13, 0x2a, 0x1e, 0x0a, 0x0e, 0x43, + 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0c, 0x0a, + 0x08, 0x50, 0x4f, 0x53, 0x54, 0x47, 0x52, 0x45, 0x53, 0x10, 0x00, 0x32, 0xeb, 0x02, 0x0a, 0x08, + 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x58, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x50, + 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x20, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, + 0x72, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x21, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x76, 0x69, + 0x64, 0x65, 0x72, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x58, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, + 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, + 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x58, 0x0a, 0x11, + 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x65, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, + 0x72, 0x12, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, + 0x75, 0x72, 0x65, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x75, 0x72, 0x65, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x2e, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x51, 0x0a, 0x0e, 0x46, 0x65, 0x74, 0x63, 0x68, 0x52, + 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2e, 0x46, 0x65, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, + 0x46, 0x65, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x42, 0x0b, 0x5a, 0x09, 0x2f, 0x69, 0x6e, + 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +>>>>>>> 7480648 (Initial commit) } var ( @@ -1188,6 +1400,7 @@ var file_internal_plugin_proto_goTypes = []interface{}{ (ConnectionType)(0), // 1: proto.ConnectionType (*ConfigureProvider)(nil), // 2: proto.ConfigureProvider (*FetchResources)(nil), // 3: proto.FetchResources +<<<<<<< HEAD (*GetProviderSchema)(nil), // 4: proto.GetProviderSchema (*GetProviderConfig)(nil), // 5: proto.GetProviderConfig (*Table)(nil), // 6: proto.Table @@ -1203,15 +1416,33 @@ var file_internal_plugin_proto_goTypes = []interface{}{ (*GetProviderSchema_Response)(nil), // 16: proto.GetProviderSchema.Response nil, // 17: proto.GetProviderSchema.Response.ResourceTablesEntry nil, // 18: proto.GetProviderSchema.Response.MigrationsEntry +======= + (*PartialFetchFailedResource)(nil), // 4: proto.PartialFetchFailedResource + (*GetProviderSchema)(nil), // 5: proto.GetProviderSchema + (*GetProviderConfig)(nil), // 6: proto.GetProviderConfig + (*Table)(nil), // 7: proto.Table + (*TableCreationOptions)(nil), // 8: proto.TableCreationOptions + (*Column)(nil), // 9: proto.Column + (*ConnectionDetails)(nil), // 10: proto.ConnectionDetails + (*ConfigureProvider_Request)(nil), // 11: proto.ConfigureProvider.Request + (*ConfigureProvider_Response)(nil), // 12: proto.ConfigureProvider.Response + (*FetchResources_Request)(nil), // 13: proto.FetchResources.Request + (*FetchResources_Response)(nil), // 14: proto.FetchResources.Response + nil, // 15: proto.FetchResources.Response.FinishedResourcesEntry + (*GetProviderSchema_Request)(nil), // 16: proto.GetProviderSchema.Request + (*GetProviderSchema_Response)(nil), // 17: proto.GetProviderSchema.Response + nil, // 18: proto.GetProviderSchema.Response.ResourceTablesEntry +>>>>>>> 7480648 (Initial commit) (*GetProviderConfig_Request)(nil), // 19: proto.GetProviderConfig.Request (*GetProviderConfig_Response)(nil), // 20: proto.GetProviderConfig.Response } var file_internal_plugin_proto_depIdxs = []int32{ - 8, // 0: proto.Table.columns:type_name -> proto.Column - 6, // 1: proto.Table.relations:type_name -> proto.Table - 7, // 2: proto.Table.options:type_name -> proto.TableCreationOptions + 9, // 0: proto.Table.columns:type_name -> proto.Column + 7, // 1: proto.Table.relations:type_name -> proto.Table + 8, // 2: proto.Table.options:type_name -> proto.TableCreationOptions 0, // 3: proto.Column.type:type_name -> proto.ColumnType 1, // 4: proto.ConnectionDetails.type:type_name -> proto.ConnectionType +<<<<<<< HEAD 9, // 5: proto.ConfigureProvider.Request.connection:type_name -> proto.ConnectionDetails 14, // 6: proto.FetchResources.Response.finished_resources:type_name -> proto.FetchResources.Response.FinishedResourcesEntry 17, // 7: proto.GetProviderSchema.Response.resource_tables:type_name -> proto.GetProviderSchema.Response.ResourceTablesEntry @@ -1225,6 +1456,21 @@ var file_internal_plugin_proto_depIdxs = []int32{ 20, // 15: proto.Provider.GetProviderConfig:output_type -> proto.GetProviderConfig.Response 11, // 16: proto.Provider.ConfigureProvider:output_type -> proto.ConfigureProvider.Response 13, // 17: proto.Provider.FetchResources:output_type -> proto.FetchResources.Response +======= + 10, // 5: proto.ConfigureProvider.Request.connection:type_name -> proto.ConnectionDetails + 15, // 6: proto.FetchResources.Response.finished_resources:type_name -> proto.FetchResources.Response.FinishedResourcesEntry + 4, // 7: proto.FetchResources.Response.partial_fetch_failed_resources:type_name -> proto.PartialFetchFailedResource + 18, // 8: proto.GetProviderSchema.Response.resource_tables:type_name -> proto.GetProviderSchema.Response.ResourceTablesEntry + 7, // 9: proto.GetProviderSchema.Response.ResourceTablesEntry.value:type_name -> proto.Table + 16, // 10: proto.Provider.GetProviderSchema:input_type -> proto.GetProviderSchema.Request + 19, // 11: proto.Provider.GetProviderConfig:input_type -> proto.GetProviderConfig.Request + 11, // 12: proto.Provider.ConfigureProvider:input_type -> proto.ConfigureProvider.Request + 13, // 13: proto.Provider.FetchResources:input_type -> proto.FetchResources.Request + 17, // 14: proto.Provider.GetProviderSchema:output_type -> proto.GetProviderSchema.Response + 20, // 15: proto.Provider.GetProviderConfig:output_type -> proto.GetProviderConfig.Response + 12, // 16: proto.Provider.ConfigureProvider:output_type -> proto.ConfigureProvider.Response + 14, // 17: proto.Provider.FetchResources:output_type -> proto.FetchResources.Response +>>>>>>> 7480648 (Initial commit) 14, // [14:18] is the sub-list for method output_type 10, // [10:14] is the sub-list for method input_type 10, // [10:10] is the sub-list for extension type_name @@ -1263,7 +1509,7 @@ func file_internal_plugin_proto_init() { } } file_internal_plugin_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetProviderSchema); i { + switch v := v.(*PartialFetchFailedResource); i { case 0: return &v.state case 1: @@ -1275,7 +1521,7 @@ func file_internal_plugin_proto_init() { } } file_internal_plugin_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetProviderConfig); i { + switch v := v.(*GetProviderSchema); i { case 0: return &v.state case 1: @@ -1287,7 +1533,7 @@ func file_internal_plugin_proto_init() { } } file_internal_plugin_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Table); i { + switch v := v.(*GetProviderConfig); i { case 0: return &v.state case 1: @@ -1299,7 +1545,7 @@ func file_internal_plugin_proto_init() { } } file_internal_plugin_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TableCreationOptions); i { + switch v := v.(*Table); i { case 0: return &v.state case 1: @@ -1311,7 +1557,7 @@ func file_internal_plugin_proto_init() { } } file_internal_plugin_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Column); i { + switch v := v.(*TableCreationOptions); i { case 0: return &v.state case 1: @@ -1323,7 +1569,7 @@ func file_internal_plugin_proto_init() { } } file_internal_plugin_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ConnectionDetails); i { + switch v := v.(*Column); i { case 0: return &v.state case 1: @@ -1335,7 +1581,7 @@ func file_internal_plugin_proto_init() { } } file_internal_plugin_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ConfigureProvider_Request); i { + switch v := v.(*ConnectionDetails); i { case 0: return &v.state case 1: @@ -1347,7 +1593,7 @@ func file_internal_plugin_proto_init() { } } file_internal_plugin_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ConfigureProvider_Response); i { + switch v := v.(*ConfigureProvider_Request); i { case 0: return &v.state case 1: @@ -1359,7 +1605,7 @@ func file_internal_plugin_proto_init() { } } file_internal_plugin_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FetchResources_Request); i { + switch v := v.(*ConfigureProvider_Response); i { case 0: return &v.state case 1: @@ -1371,6 +1617,18 @@ func file_internal_plugin_proto_init() { } } file_internal_plugin_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FetchResources_Request); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_internal_plugin_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FetchResources_Response); i { case 0: return &v.state @@ -1382,7 +1640,7 @@ func file_internal_plugin_proto_init() { return nil } } - file_internal_plugin_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + file_internal_plugin_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetProviderSchema_Request); i { case 0: return &v.state @@ -1394,7 +1652,7 @@ func file_internal_plugin_proto_init() { return nil } } - file_internal_plugin_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + file_internal_plugin_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetProviderSchema_Response); i { case 0: return &v.state @@ -1431,7 +1689,7 @@ func file_internal_plugin_proto_init() { } } } - file_internal_plugin_proto_msgTypes[4].OneofWrappers = []interface{}{} + file_internal_plugin_proto_msgTypes[5].OneofWrappers = []interface{}{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ @@ -1452,227 +1710,3 @@ func file_internal_plugin_proto_init() { file_internal_plugin_proto_goTypes = nil file_internal_plugin_proto_depIdxs = nil } - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConnInterface - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion6 - -// ProviderClient is the client API for Provider service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type ProviderClient interface { - // Information about what a provider supports/expects - GetProviderSchema(ctx context.Context, in *GetProviderSchema_Request, opts ...grpc.CallOption) (*GetProviderSchema_Response, error) - // Gets a provider's configuration example - GetProviderConfig(ctx context.Context, in *GetProviderConfig_Request, opts ...grpc.CallOption) (*GetProviderConfig_Response, error) - // One-time initialization, called before other functions below - ConfigureProvider(ctx context.Context, in *ConfigureProvider_Request, opts ...grpc.CallOption) (*ConfigureProvider_Response, error) - // Fetch Provider Resources - FetchResources(ctx context.Context, in *FetchResources_Request, opts ...grpc.CallOption) (Provider_FetchResourcesClient, error) -} - -type providerClient struct { - cc grpc.ClientConnInterface -} - -func NewProviderClient(cc grpc.ClientConnInterface) ProviderClient { - return &providerClient{cc} -} - -func (c *providerClient) GetProviderSchema(ctx context.Context, in *GetProviderSchema_Request, opts ...grpc.CallOption) (*GetProviderSchema_Response, error) { - out := new(GetProviderSchema_Response) - err := c.cc.Invoke(ctx, "/proto.Provider/GetProviderSchema", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) GetProviderConfig(ctx context.Context, in *GetProviderConfig_Request, opts ...grpc.CallOption) (*GetProviderConfig_Response, error) { - out := new(GetProviderConfig_Response) - err := c.cc.Invoke(ctx, "/proto.Provider/GetProviderConfig", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) ConfigureProvider(ctx context.Context, in *ConfigureProvider_Request, opts ...grpc.CallOption) (*ConfigureProvider_Response, error) { - out := new(ConfigureProvider_Response) - err := c.cc.Invoke(ctx, "/proto.Provider/ConfigureProvider", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) FetchResources(ctx context.Context, in *FetchResources_Request, opts ...grpc.CallOption) (Provider_FetchResourcesClient, error) { - stream, err := c.cc.NewStream(ctx, &_Provider_serviceDesc.Streams[0], "/proto.Provider/FetchResources", opts...) - if err != nil { - return nil, err - } - x := &providerFetchResourcesClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type Provider_FetchResourcesClient interface { - Recv() (*FetchResources_Response, error) - grpc.ClientStream -} - -type providerFetchResourcesClient struct { - grpc.ClientStream -} - -func (x *providerFetchResourcesClient) Recv() (*FetchResources_Response, error) { - m := new(FetchResources_Response) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -// ProviderServer is the server API for Provider service. -type ProviderServer interface { - // Information about what a provider supports/expects - GetProviderSchema(context.Context, *GetProviderSchema_Request) (*GetProviderSchema_Response, error) - // Gets a provider's configuration example - GetProviderConfig(context.Context, *GetProviderConfig_Request) (*GetProviderConfig_Response, error) - // One-time initialization, called before other functions below - ConfigureProvider(context.Context, *ConfigureProvider_Request) (*ConfigureProvider_Response, error) - // Fetch Provider Resources - FetchResources(*FetchResources_Request, Provider_FetchResourcesServer) error -} - -// UnimplementedProviderServer can be embedded to have forward compatible implementations. -type UnimplementedProviderServer struct { -} - -func (*UnimplementedProviderServer) GetProviderSchema(context.Context, *GetProviderSchema_Request) (*GetProviderSchema_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetProviderSchema not implemented") -} -func (*UnimplementedProviderServer) GetProviderConfig(context.Context, *GetProviderConfig_Request) (*GetProviderConfig_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetProviderConfig not implemented") -} -func (*UnimplementedProviderServer) ConfigureProvider(context.Context, *ConfigureProvider_Request) (*ConfigureProvider_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method ConfigureProvider not implemented") -} -func (*UnimplementedProviderServer) FetchResources(*FetchResources_Request, Provider_FetchResourcesServer) error { - return status.Errorf(codes.Unimplemented, "method FetchResources not implemented") -} - -func RegisterProviderServer(s *grpc.Server, srv ProviderServer) { - s.RegisterService(&_Provider_serviceDesc, srv) -} - -func _Provider_GetProviderSchema_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetProviderSchema_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).GetProviderSchema(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.Provider/GetProviderSchema", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).GetProviderSchema(ctx, req.(*GetProviderSchema_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_GetProviderConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetProviderConfig_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).GetProviderConfig(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.Provider/GetProviderConfig", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).GetProviderConfig(ctx, req.(*GetProviderConfig_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_ConfigureProvider_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ConfigureProvider_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).ConfigureProvider(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.Provider/ConfigureProvider", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).ConfigureProvider(ctx, req.(*ConfigureProvider_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_FetchResources_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(FetchResources_Request) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(ProviderServer).FetchResources(m, &providerFetchResourcesServer{stream}) -} - -type Provider_FetchResourcesServer interface { - Send(*FetchResources_Response) error - grpc.ServerStream -} - -type providerFetchResourcesServer struct { - grpc.ServerStream -} - -func (x *providerFetchResourcesServer) Send(m *FetchResources_Response) error { - return x.ServerStream.SendMsg(m) -} - -var _Provider_serviceDesc = grpc.ServiceDesc{ - ServiceName: "proto.Provider", - HandlerType: (*ProviderServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "GetProviderSchema", - Handler: _Provider_GetProviderSchema_Handler, - }, - { - MethodName: "GetProviderConfig", - Handler: _Provider_GetProviderConfig_Handler, - }, - { - MethodName: "ConfigureProvider", - Handler: _Provider_ConfigureProvider_Handler, - }, - }, - Streams: []grpc.StreamDesc{ - { - StreamName: "FetchResources", - Handler: _Provider_FetchResources_Handler, - ServerStreams: true, - }, - }, - Metadata: "internal/plugin.proto", -} diff --git a/cqproto/internal/plugin.proto b/cqproto/internal/plugin.proto index 33d85638..46e1497f 100644 --- a/cqproto/internal/plugin.proto +++ b/cqproto/internal/plugin.proto @@ -41,6 +41,8 @@ message FetchResources { message Request { // list of resources provider is requested to fetch repeated string resources = 1; + // trigger to enable partial fetching + bool partial_fetching_enabled = 2; } message Response { // map of resources that have finished fetching @@ -49,9 +51,22 @@ message FetchResources { uint64 resource_count = 2; // Error value if any, if returned the stream will be canceled string error = 3; + // list of resources where the fetching failed + repeated PartialFetchFailedResource partial_fetch_failed_resources = 4; } } +message PartialFetchFailedResource { + // table name of the failed resource fetch + string table_name = 1; + // root/parent table name + string root_table_name = 2; + // root/parent primary key values + repeated string root_primary_key_values = 3; + // error message for this resource fetch failure + string error = 4; +} + message GetProviderSchema { message Request {} message Response { diff --git a/cqproto/internal/plugin_grpc.pb.go b/cqproto/internal/plugin_grpc.pb.go new file mode 100644 index 00000000..188be5cb --- /dev/null +++ b/cqproto/internal/plugin_grpc.pb.go @@ -0,0 +1,245 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. + +package internal + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// ProviderClient is the client API for Provider service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type ProviderClient interface { + // Information about what a provider supports/expects + GetProviderSchema(ctx context.Context, in *GetProviderSchema_Request, opts ...grpc.CallOption) (*GetProviderSchema_Response, error) + // Gets a provider's configuration example + GetProviderConfig(ctx context.Context, in *GetProviderConfig_Request, opts ...grpc.CallOption) (*GetProviderConfig_Response, error) + // One-time initialization, called before other functions below + ConfigureProvider(ctx context.Context, in *ConfigureProvider_Request, opts ...grpc.CallOption) (*ConfigureProvider_Response, error) + // Fetch Provider Resources + FetchResources(ctx context.Context, in *FetchResources_Request, opts ...grpc.CallOption) (Provider_FetchResourcesClient, error) +} + +type providerClient struct { + cc grpc.ClientConnInterface +} + +func NewProviderClient(cc grpc.ClientConnInterface) ProviderClient { + return &providerClient{cc} +} + +func (c *providerClient) GetProviderSchema(ctx context.Context, in *GetProviderSchema_Request, opts ...grpc.CallOption) (*GetProviderSchema_Response, error) { + out := new(GetProviderSchema_Response) + err := c.cc.Invoke(ctx, "/proto.Provider/GetProviderSchema", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) GetProviderConfig(ctx context.Context, in *GetProviderConfig_Request, opts ...grpc.CallOption) (*GetProviderConfig_Response, error) { + out := new(GetProviderConfig_Response) + err := c.cc.Invoke(ctx, "/proto.Provider/GetProviderConfig", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) ConfigureProvider(ctx context.Context, in *ConfigureProvider_Request, opts ...grpc.CallOption) (*ConfigureProvider_Response, error) { + out := new(ConfigureProvider_Response) + err := c.cc.Invoke(ctx, "/proto.Provider/ConfigureProvider", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) FetchResources(ctx context.Context, in *FetchResources_Request, opts ...grpc.CallOption) (Provider_FetchResourcesClient, error) { + stream, err := c.cc.NewStream(ctx, &Provider_ServiceDesc.Streams[0], "/proto.Provider/FetchResources", opts...) + if err != nil { + return nil, err + } + x := &providerFetchResourcesClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type Provider_FetchResourcesClient interface { + Recv() (*FetchResources_Response, error) + grpc.ClientStream +} + +type providerFetchResourcesClient struct { + grpc.ClientStream +} + +func (x *providerFetchResourcesClient) Recv() (*FetchResources_Response, error) { + m := new(FetchResources_Response) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +// ProviderServer is the server API for Provider service. +// All implementations must embed UnimplementedProviderServer +// for forward compatibility +type ProviderServer interface { + // Information about what a provider supports/expects + GetProviderSchema(context.Context, *GetProviderSchema_Request) (*GetProviderSchema_Response, error) + // Gets a provider's configuration example + GetProviderConfig(context.Context, *GetProviderConfig_Request) (*GetProviderConfig_Response, error) + // One-time initialization, called before other functions below + ConfigureProvider(context.Context, *ConfigureProvider_Request) (*ConfigureProvider_Response, error) + // Fetch Provider Resources + FetchResources(*FetchResources_Request, Provider_FetchResourcesServer) error + mustEmbedUnimplementedProviderServer() +} + +// UnimplementedProviderServer must be embedded to have forward compatible implementations. +type UnimplementedProviderServer struct { +} + +func (UnimplementedProviderServer) GetProviderSchema(context.Context, *GetProviderSchema_Request) (*GetProviderSchema_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetProviderSchema not implemented") +} +func (UnimplementedProviderServer) GetProviderConfig(context.Context, *GetProviderConfig_Request) (*GetProviderConfig_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetProviderConfig not implemented") +} +func (UnimplementedProviderServer) ConfigureProvider(context.Context, *ConfigureProvider_Request) (*ConfigureProvider_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ConfigureProvider not implemented") +} +func (UnimplementedProviderServer) FetchResources(*FetchResources_Request, Provider_FetchResourcesServer) error { + return status.Errorf(codes.Unimplemented, "method FetchResources not implemented") +} +func (UnimplementedProviderServer) mustEmbedUnimplementedProviderServer() {} + +// UnsafeProviderServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to ProviderServer will +// result in compilation errors. +type UnsafeProviderServer interface { + mustEmbedUnimplementedProviderServer() +} + +func RegisterProviderServer(s grpc.ServiceRegistrar, srv ProviderServer) { + s.RegisterService(&Provider_ServiceDesc, srv) +} + +func _Provider_GetProviderSchema_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetProviderSchema_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).GetProviderSchema(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/proto.Provider/GetProviderSchema", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).GetProviderSchema(ctx, req.(*GetProviderSchema_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_GetProviderConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetProviderConfig_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).GetProviderConfig(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/proto.Provider/GetProviderConfig", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).GetProviderConfig(ctx, req.(*GetProviderConfig_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_ConfigureProvider_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ConfigureProvider_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).ConfigureProvider(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/proto.Provider/ConfigureProvider", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).ConfigureProvider(ctx, req.(*ConfigureProvider_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_FetchResources_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(FetchResources_Request) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(ProviderServer).FetchResources(m, &providerFetchResourcesServer{stream}) +} + +type Provider_FetchResourcesServer interface { + Send(*FetchResources_Response) error + grpc.ServerStream +} + +type providerFetchResourcesServer struct { + grpc.ServerStream +} + +func (x *providerFetchResourcesServer) Send(m *FetchResources_Response) error { + return x.ServerStream.SendMsg(m) +} + +// Provider_ServiceDesc is the grpc.ServiceDesc for Provider service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Provider_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "proto.Provider", + HandlerType: (*ProviderServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetProviderSchema", + Handler: _Provider_GetProviderSchema_Handler, + }, + { + MethodName: "GetProviderConfig", + Handler: _Provider_GetProviderConfig_Handler, + }, + { + MethodName: "ConfigureProvider", + Handler: _Provider_ConfigureProvider_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "FetchResources", + Handler: _Provider_FetchResources_Handler, + ServerStreams: true, + }, + }, + Metadata: "internal/plugin.proto", +} diff --git a/cqproto/provider.go b/cqproto/provider.go index 3b24325a..4e6976b2 100644 --- a/cqproto/provider.go +++ b/cqproto/provider.go @@ -1,4 +1,4 @@ -//go:generate protoc --go_out=plugins=grpc:. --go_opt=paths=source_relative internal/plugin.proto +//go:generate protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative internal/plugin.proto package cqproto import ( @@ -84,6 +84,9 @@ type ConfigureProviderResponse struct { // FetchResourcesRequest represents a CloudQuery RPC request of one or more resources type FetchResourcesRequest struct { Resources []string + + // PartialFetchingEnabled if true enables partial fetching + PartialFetchingEnabled bool } // FetchResourcesStream represents a CloudQuery RPC stream of fetch updates from the provider @@ -104,6 +107,19 @@ type FetchResourcesResponse struct { ResourceCount uint64 // Error value if any, if returned the stream will be canceled Error string + // list of resources where the fetching failed + PartialFetchFailedResources []*PartialFetchFailedResource +} + +type PartialFetchFailedResource struct { + // table name of the failed resource fetch + TableName string + // root/parent table name + RootTableName string + // root/parent primary key values + RootPrimaryKeyValues []string + // error message for this resource fetch failure + Error string } type ConnectionDetails struct { diff --git a/go.mod b/go.mod index d0b532c0..2d38b7a8 100644 --- a/go.mod +++ b/go.mod @@ -44,7 +44,7 @@ require ( golang.org/x/net v0.0.0-20210510120150-4163338589ed // indirect golang.org/x/sync v0.0.0-20210220032951-036812b2e83c golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect - google.golang.org/grpc v1.33.1 - google.golang.org/protobuf v1.26.0 + google.golang.org/grpc v1.40.0 + google.golang.org/protobuf v1.26.0 // indirect gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/go.sum b/go.sum index b2707d97..d8f595da 100644 --- a/go.sum +++ b/go.sum @@ -53,6 +53,7 @@ github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jB github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5/go.mod h1:tTuCMEN+UleMWgg9dVx4Hu52b1bJo+59jBh3ajtinzw= github.com/Microsoft/go-winio v0.4.16 h1:FtSW/jqD+l4ba5iPBj9CODVtgfYAD8w2wS923g/cFDk= github.com/Microsoft/go-winio v0.4.16/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= @@ -68,6 +69,7 @@ github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRF github.com/andybalholm/crlf v0.0.0-20171020200849-670099aa064f/go.mod h1:k8feO4+kXDxro6ErPXBRTJ/ro2mf0SsFG8s7doP9kJE= github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= github.com/apache/arrow/go/arrow v0.0.0-20200601151325-b2287a20f230/go.mod h1:QNYViu/X0HXDHw7m3KXzWSVXIbfUvJqBFe6Gj8/pYA0= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/apparentlymart/go-dump v0.0.0-20180507223929-23540a00eaa3/go.mod h1:oL81AME2rN47vu18xqj1S1jPIPuN7afo62yKTNn3XMM= @@ -99,6 +101,7 @@ github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= github.com/cenkalti/backoff/v4 v4.0.2/go.mod h1:eEew/i+1Q6OrCDZh3WiXYv3+nJwBASZ8Bog/87DQnVg= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cheggaaa/pb v1.0.27/go.mod h1:pQciLPpbU0oxA0h+VJYYLxO+XeDQb5pZijXscXHm81s= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= @@ -110,6 +113,8 @@ github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58/go.mod h1:EOBUe0h github.com/cloudquery/faker/v3 v3.7.4 h1:cCcU3r0yHpS0gqKj9rRKAGS0/hY33fBxbqCNFtDD4ec= github.com/cloudquery/faker/v3 v3.7.4/go.mod h1:1b8WVG9Gh0T2hVo1a8dWeXfu0AhqSB6J/mmJaesqOeo= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I= github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= github.com/cockroachdb/cockroach-go v0.0.0-20190925194419-606b3d062051 h1:eApuUG8W2EtBVwxqLlY2wgoqDYOg3WvIHGvW4fUbbow= @@ -164,6 +169,8 @@ github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4s github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5/go.mod h1:a2zkGnVExMxdzMo3M0Hi/3sEU+cWnZpSni0O6/Yb/P0= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= @@ -282,6 +289,8 @@ github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.2.0 h1:qJYtXnJRWmpe7m/3XlyhrsLrEURqHRM2kxzoxXqyUDs= github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= +github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5 h1:sjZBwGj9Jlw33ImPtvFviGYvseOtDM7hkSKB7+Tv3SM= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= @@ -297,6 +306,7 @@ github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed/go.mod h1:tMWxXQ9wFIaZeTI9F+hmhFiGpFmhOHzyShyFUhRm0H4= +github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE= github.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= @@ -629,6 +639,7 @@ github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+Gx github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/remyoudompheng/bigfft v0.0.0-20190728182440-6a916e37a237/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= +github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU= @@ -662,6 +673,7 @@ github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4k github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY= github.com/spf13/afero v1.6.0 h1:xoax2sJ2DT8S8xA2paPFjDCScCNeWsg75VG0DLRreiY= github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/cast v1.4.0 h1:WhlbjwB9EGCc8W5Rxdkus+wmH2ASRwwTJk6tgHKwdqQ= github.com/spf13/cast v1.4.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= @@ -734,6 +746,7 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4 h1:LYy1Hy3MJdrCdMwwzxA/dRok4ejH+RwNGbuoD9fCjto= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= @@ -841,6 +854,7 @@ golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200904194848-62affa334b73/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201029221708-28c70e62bb1d/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210326060303-6b1517762897/go.mod h1:uSPa2vr4CLtc/ILN5odXGNXS6mhrKVzTaCXzk9m6W3k= golang.org/x/net v0.0.0-20210510120150-4163338589ed h1:p9UgmWI9wKpfYmgaV/IZKGdXc5qEK45tDwwwDyjS26I= @@ -1049,6 +1063,8 @@ google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfG google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= +google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 h1:+kGHl1aib/qcwaRi1CbqBZ1rk19r85MNUf8HaBghugY= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= @@ -1079,6 +1095,10 @@ google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM google.golang.org/grpc v1.32.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.33.1 h1:DGeFlSan2f+WEtCERJ4J9GJWk15TxUi8QGagfI87Xyc= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= +google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= +google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.40.0 h1:AGJ0Ih4mHjSeibYkFGh1dD9KJ/eOtZ93I6hoHhukQ5Q= +google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/provider/provider.go b/provider/provider.go index 91cd03bd..3e3c4032 100644 --- a/provider/provider.go +++ b/provider/provider.go @@ -137,7 +137,7 @@ func (p *Provider) FetchResources(ctx context.Context, request *cqproto.FetchRes if !ok { return fmt.Errorf("plugin %s does not provide resource %s", p.Name, resource) } - execData := schema.NewExecutionData(p.db, p.Logger, table, p.disableDelete, p.extraFields) + execData := schema.NewExecutionData(p.db, p.Logger, table, p.disableDelete, p.extraFields, request.PartialFetchingEnabled) p.Logger.Debug("fetching table...", "provider", p.Name, "table", table.Name) // Save resource aside r := resource @@ -152,15 +152,17 @@ func (p *Provider) FetchResources(ctx context.Context, request *cqproto.FetchRes defer l.Unlock() if err != nil { return sender.Send(&cqproto.FetchResourcesResponse{ - FinishedResources: finishedResources, - ResourceCount: resourceCount, - Error: err.Error(), + FinishedResources: finishedResources, + ResourceCount: resourceCount, + Error: err.Error(), + PartialFetchFailedResources: cqproto.PartialFetchToCQProto(execData.PartialFetchFailureResult), }) } err = sender.Send(&cqproto.FetchResourcesResponse{ - FinishedResources: finishedResources, - ResourceCount: resourceCount, - Error: "", + FinishedResources: finishedResources, + ResourceCount: resourceCount, + Error: "", + PartialFetchFailedResources: cqproto.PartialFetchToCQProto(execData.PartialFetchFailureResult), }) if err != nil { return err diff --git a/provider/schema/execution.go b/provider/schema/execution.go index 016e7e38..4c16bd8d 100644 --- a/provider/schema/execution.go +++ b/provider/schema/execution.go @@ -29,16 +29,39 @@ type ExecutionData struct { disableDelete bool // extraFields to be passed to each created resource in the execution extraFields map[string]interface{} + // partialFetch if true allows partial fetching of resources + partialFetch bool + // PartialFetchFailureResult is a map of resources where the fetch process failed + PartialFetchFailureResult []PartialFetchFailedResource + // partialFetchChan is the channel that is used to send failed resource fetches + partialFetchChan chan PartialFetchFailedResource } +// PartialFetchFailedResource represents a single partial fetch failed resource +type PartialFetchFailedResource struct { + // table name of the failed resource fetch + TableName string + // root/parent table name + RootTableName string + // root/parent primary key values + RootPrimaryKeyValues []string + // error message for this resource fetch failure + Error string +} + +// partialFetchFailureBufferLength defines the buffer length for the partialFetchChan. +const partialFetchFailureBufferLength = 20 + // NewExecutionData Create a new execution data -func NewExecutionData(db Database, logger hclog.Logger, table *Table, disableDelete bool, extraFields map[string]interface{}) ExecutionData { +func NewExecutionData(db Database, logger hclog.Logger, table *Table, disableDelete bool, extraFields map[string]interface{}, partialFetch bool) ExecutionData { return ExecutionData{ - Table: table, - Db: db, - Logger: logger, - disableDelete: disableDelete, - extraFields: extraFields, + Table: table, + Db: db, + Logger: logger, + disableDelete: disableDelete, + extraFields: extraFields, + PartialFetchFailureResult: []PartialFetchFailedResource{}, + partialFetch: partialFetch, } } @@ -50,6 +73,20 @@ func (e ExecutionData) ResolveTable(ctx context.Context, meta ClientMeta, parent meta.Logger().Debug("multiplexing client", "count", len(clients), "table", e.Table.Name) } g, ctx := errgroup.WithContext(ctx) + + // Start the partial fetch failure result channel routine + if e.partialFetch { + e.partialFetchChan = make(chan PartialFetchFailedResource, partialFetchFailureBufferLength) + defer func() { + close(e.partialFetchChan) + }() + go func() { + for fetchResourceFailure := range e.partialFetchChan { + meta.Logger().Debug("received failed partial fetch resource", "resource", fetchResourceFailure) + e.PartialFetchFailureResult = append(e.PartialFetchFailureResult, fetchResourceFailure) + } + }() + } var totalResources uint64 for _, client := range clients { client := client @@ -67,11 +104,13 @@ func (e ExecutionData) ResolveTable(ctx context.Context, meta ClientMeta, parent func (e ExecutionData) WithTable(t *Table) ExecutionData { return ExecutionData{ - Table: t, - Db: e.Db, - Logger: e.Logger, - disableDelete: e.disableDelete, - extraFields: e.extraFields, + Table: t, + Db: e.Db, + Logger: e.Logger, + disableDelete: e.disableDelete, + extraFields: e.extraFields, + partialFetch: e.partialFetch, + PartialFetchFailureResult: []PartialFetchFailedResource{}, } } @@ -127,7 +166,7 @@ func (e ExecutionData) callTableResolve(ctx context.Context, client ClientMeta, // check if channel iteration stopped because of resolver failure if resolverErr != nil { client.Logger().Error("received resolve resources error", "table", e.Table.Name, "error", resolverErr) - return 0, resolverErr + return 0, e.checkPartialFetchError(resolverErr, nil, "table resolve error") } // Print only parent resources if parent == nil { @@ -159,14 +198,16 @@ func (e ExecutionData) resolveResources(ctx context.Context, meta ClientMeta, pa } } - // Finally resolve relations of each resource + // Finally, resolve relations of each resource for _, rel := range e.Table.Relations { meta.Logger().Debug("resolving table relation", "table", e.Table.Name, "relation", rel.Name) for _, r := range resources { // ignore relation resource count _, err := e.WithTable(rel).ResolveTable(ctx, meta, r) if err != nil { - return err + if partialFetchErr := e.checkPartialFetchError(err, r, "resolve relation error"); partialFetchErr != nil { + return partialFetchErr + } } } } @@ -186,13 +227,17 @@ func (e ExecutionData) resolveResourceValues(ctx context.Context, meta ClientMet // call PostRowResolver if defined after columns have been resolved if resource.table.PostResourceResolver != nil { if err = resource.table.PostResourceResolver(ctx, meta, resource); err != nil { - return err + if partialFetchErr := e.checkPartialFetchError(err, resource, "post resource resolver failed"); partialFetchErr != nil { + return partialFetchErr + } } } // Finally generate cq_id for resource for _, c := range GetDefaultSDKColumns() { if err = c.Resolver(ctx, meta, resource, c); err != nil { - return err + if partialFetchErr := e.checkPartialFetchError(err, resource, "column resolver execution failed"); partialFetchErr != nil { + return partialFetchErr + } } } return err @@ -244,3 +289,56 @@ func interfaceSlice(slice interface{}) []interface{} { return ret } + +func (e ExecutionData) checkPartialFetchError(err error, res *Resource, customMsg string) error { + // Fast path if partial fetch is disabled + if !e.partialFetch { + return err + } + + partialFetchFailure := PartialFetchFailedResource{ + Error: fmt.Sprintf("%s: %s", customMsg, err.Error()), + } + e.Logger.Debug("fetch error occurred and partial fetch is enabled", "msg", partialFetchFailure.Error) + + // If resource is given + if res != nil { + partialFetchFailure.TableName = res.table.Name + + // Find root/parent resource if one exists + var root *Resource + currRes := res + for root == nil { + root = currRes + if currRes != nil && currRes.Parent != nil { + currRes = res.Parent + root = nil + } + } + + if root != res && root != nil { + partialFetchFailure.RootTableName = root.table.Name + partialFetchFailure.RootPrimaryKeyValues = getPrimaryKeyValues(root) + } + } + + // Send information via our channel + e.partialFetchChan <- partialFetchFailure + + return nil +} + +func getPrimaryKeyValues(res *Resource) []string { + tablePrimKeys := res.table.Options.PrimaryKeys + if len(tablePrimKeys) == 0 { + return []string{} + } + results := make([]string, len(tablePrimKeys)) + for _, primKey := range tablePrimKeys { + data := res.Get(primKey) + if data != nil { + results = append(results, fmt.Sprintf("%v", data)) + } + } + return results +} diff --git a/provider/schema/execution_test.go b/provider/schema/execution_test.go index 11dca180..d18c810d 100644 --- a/provider/schema/execution_test.go +++ b/provider/schema/execution_test.go @@ -121,17 +121,17 @@ func TestExecutionData_ResolveTable(t *testing.T) { t.Run("failing table resolver", func(t *testing.T) { testTable.Resolver = failingTableResolver mockDb := new(databaseMock) - exec := NewExecutionData(mockDb, logger, testTable, false, nil) + exec := NewExecutionData(mockDb, logger, testTable, false, nil, false) _, err := exec.ResolveTable(context.Background(), mockedClient, nil) assert.Error(t, err) - execFailing := NewExecutionData(mockDb, logger, testBadColumnResolverTable, false, nil) + execFailing := NewExecutionData(mockDb, logger, testBadColumnResolverTable, false, nil, false) _, err = execFailing.ResolveTable(context.Background(), mockedClient, nil) assert.Error(t, err) }) t.Run("doing nothing resolver", func(t *testing.T) { mockDb := new(databaseMock) - exec := NewExecutionData(mockDb, logger, testTable, false, nil) + exec := NewExecutionData(mockDb, logger, testTable, false, nil, false) testTable.Resolver = doNothingResolver _, err := exec.ResolveTable(context.Background(), mockedClient, nil) assert.Nil(t, err) @@ -140,7 +140,7 @@ func TestExecutionData_ResolveTable(t *testing.T) { t.Run("simple returning resources insert", func(t *testing.T) { mockDb := new(databaseMock) mockDb.On("CopyFrom", mock.Anything, mock.Anything, false, mock.Anything).Return(nil) - exec := NewExecutionData(mockDb, logger, testTable, false, nil) + exec := NewExecutionData(mockDb, logger, testTable, false, nil, false) testTable.Resolver = dataReturningResolver _, err := exec.ResolveTable(context.Background(), mockedClient, nil) assert.Nil(t, err) @@ -148,7 +148,7 @@ func TestExecutionData_ResolveTable(t *testing.T) { }) t.Run("simple returning resources insert w/disable_delete", func(t *testing.T) { mockDb := new(databaseMock) - exec := NewExecutionData(mockDb, logger, testTable, false, nil) + exec := NewExecutionData(mockDb, logger, testTable, false, nil, false) mockDb.On("CopyFrom", mock.Anything, mock.Anything, true, mock.Anything).Return(nil) testTable.Resolver = dataReturningResolver exec.disableDelete = true @@ -159,7 +159,7 @@ func TestExecutionData_ResolveTable(t *testing.T) { }) t.Run("simple returning single resources insert", func(t *testing.T) { mockDb := new(databaseMock) - exec := NewExecutionData(mockDb, logger, testTable, false, nil) + exec := NewExecutionData(mockDb, logger, testTable, false, nil, false) mockDb.On("CopyFrom", mock.Anything, mock.Anything, false, mock.Anything).Return(nil) testTable.Resolver = dataReturningSingleResolver _, err := exec.ResolveTable(context.Background(), mockedClient, nil) @@ -167,7 +167,7 @@ func TestExecutionData_ResolveTable(t *testing.T) { }) t.Run("simple returning nil resources insert", func(t *testing.T) { mockDb := new(databaseMock) - exec := NewExecutionData(mockDb, logger, testTable, false, nil) + exec := NewExecutionData(mockDb, logger, testTable, false, nil, false) testTable.Resolver = passingNilResolver _, err := exec.ResolveTable(context.Background(), mockedClient, nil) assert.Nil(t, err) @@ -175,7 +175,7 @@ func TestExecutionData_ResolveTable(t *testing.T) { }) t.Run("check post row resolver", func(t *testing.T) { mockDb := new(databaseMock) - exec := NewExecutionData(mockDb, logger, testTable, false, nil) + exec := NewExecutionData(mockDb, logger, testTable, false, nil, false) testTable.Resolver = dataReturningSingleResolver var expectedResource *Resource testTable.PostResourceResolver = func(ctx context.Context, meta ClientMeta, parent *Resource) error { @@ -197,7 +197,7 @@ func TestExecutionData_ResolveTable(t *testing.T) { t.Run("test resolving with default column values", func(t *testing.T) { mockDb := new(databaseMock) - execDefault := NewExecutionData(mockDb, logger, testDefaultsTable, false, nil) + execDefault := NewExecutionData(mockDb, logger, testDefaultsTable, false, nil, false) mockDb.On("CopyFrom", mock.Anything, mock.Anything, false, mock.Anything).Return(nil) testDefaultsTable.Resolver = func(ctx context.Context, meta ClientMeta, parent *Resource, res chan interface{}) error { res <- testDefaultsTableData{Name: nil} @@ -215,7 +215,7 @@ func TestExecutionData_ResolveTable(t *testing.T) { t.Run("disable delete", func(t *testing.T) { mockDb := new(databaseMock) - exec := NewExecutionData(mockDb, logger, testTable, true, nil) + exec := NewExecutionData(mockDb, logger, testTable, true, nil, false) //mockDb.On("CopyFrom", mock.Anything, mock.Anything, true, mock.Anything).Return(nil) testTable.Resolver = dataReturningSingleResolver testTable.DeleteFilter = func(meta ClientMeta, r *Resource) []interface{} { @@ -236,7 +236,7 @@ func TestExecutionData_ResolveTable(t *testing.T) { mockDb.AssertNumberOfCalls(t, "CopyFrom", 1) assert.Equal(t, expectedResource.data["name"], "other") assert.Nil(t, err) - exec = NewExecutionData(mockDb, logger, testTable, false, nil) + exec = NewExecutionData(mockDb, logger, testTable, false, nil, false) mockDb.On("CopyFrom", mock.Anything, mock.Anything, false, mock.Anything).Return(nil) _, err = exec.ResolveTable(context.Background(), mockedClient, nil) mockDb.AssertNumberOfCalls(t, "Delete", 1) @@ -245,7 +245,7 @@ func TestExecutionData_ResolveTable(t *testing.T) { }) t.Run("disable delete failed copy from", func(t *testing.T) { mockDb := new(databaseMock) - exec := NewExecutionData(mockDb, logger, testTable, true, nil) + exec := NewExecutionData(mockDb, logger, testTable, true, nil, false) //mockDb.On("CopyFrom", mock.Anything, mock.Anything, true, mock.Anything).Return(nil) testTable.Resolver = dataReturningSingleResolver testTable.DeleteFilter = func(meta ClientMeta, r *Resource) []interface{} { @@ -272,7 +272,7 @@ func TestExecutionData_ResolveTable(t *testing.T) { t.Run("always delete with disable delete", func(t *testing.T) { mockDb := new(databaseMock) - exec := NewExecutionData(mockDb, logger, alwaysDeleteTable, true, nil) + exec := NewExecutionData(mockDb, logger, alwaysDeleteTable, true, nil, false) alwaysDeleteTable.Resolver = dataReturningSingleResolver alwaysDeleteTable.DeleteFilter = func(meta ClientMeta, r *Resource) []interface{} { return nil @@ -295,7 +295,7 @@ func TestExecutionData_ResolveTable(t *testing.T) { t.Run("inject fields into execution", func(t *testing.T) { mockDb := new(databaseMock) - exec := NewExecutionData(mockDb, logger, testTable, false, map[string]interface{}{"injected_field": 1}) + exec := NewExecutionData(mockDb, logger, testTable, false, map[string]interface{}{"injected_field": 1}, false) testTable.Resolver = dataReturningSingleResolver testTable.DeleteFilter = nil var expectedResource *Resource diff --git a/provider/schema/resources_test.go b/provider/schema/resources_test.go index 38847aa3..6750a4c2 100644 --- a/provider/schema/resources_test.go +++ b/provider/schema/resources_test.go @@ -114,7 +114,7 @@ func TestRelationResourcePrimaryKey(t *testing.T) { }) mockedClient.On("Logger", mock.Anything).Return(logger) - exec := NewExecutionData(nil, logger, r2.table, false, nil) + exec := NewExecutionData(nil, logger, r2.table, false, nil, false) err := exec.resolveResourceValues(context.TODO(), mockedClient, r2) assert.Nil(t, err) v, err := r2.Values() @@ -179,7 +179,7 @@ func TestResourceResolveColumns(t *testing.T) { Level: hclog.Error, Output: nil, }) - exec := NewExecutionData(nil, logger, testTable, false, nil) + exec := NewExecutionData(nil, logger, testTable, false, nil, false) err := exec.resolveColumns(context.TODO(), mockedClient, r, testTable.Columns) assert.Nil(t, err) v, err := r.Values() @@ -198,7 +198,7 @@ func TestResourceResolveColumns(t *testing.T) { Level: hclog.Error, Output: nil, }) - exec := NewExecutionData(nil, logger, testZeroTable, false, nil) + exec := NewExecutionData(nil, logger, testZeroTable, false, nil, false) err := exec.resolveColumns(context.TODO(), mockedClient, r, testZeroTable.Columns) assert.Nil(t, err) v, err := r.Values() From 3ea16aa25b059b72515867affae4895ce945b00f Mon Sep 17 00:00:00 2001 From: Michel Vocks Date: Wed, 18 Aug 2021 15:41:39 +0200 Subject: [PATCH 2/7] Fixed small issues --- cqproto/internal/plugin.pb.go | 375 +++++++++++----------------------- provider/schema/execution.go | 33 +-- 2 files changed, 141 insertions(+), 267 deletions(-) diff --git a/cqproto/internal/plugin.pb.go b/cqproto/internal/plugin.pb.go index d9f91b78..0018c91f 100644 --- a/cqproto/internal/plugin.pb.go +++ b/cqproto/internal/plugin.pb.go @@ -1016,7 +1016,7 @@ type GetProviderConfig_Request struct { func (x *GetProviderConfig_Request) Reset() { *x = GetProviderConfig_Request{} if protoimpl.UnsafeEnabled { - mi := &file_internal_plugin_proto_msgTypes[17] + mi := &file_internal_plugin_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1029,7 +1029,7 @@ func (x *GetProviderConfig_Request) String() string { func (*GetProviderConfig_Request) ProtoMessage() {} func (x *GetProviderConfig_Request) ProtoReflect() protoreflect.Message { - mi := &file_internal_plugin_proto_msgTypes[17] + mi := &file_internal_plugin_proto_msgTypes[18] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1058,7 +1058,7 @@ type GetProviderConfig_Response struct { func (x *GetProviderConfig_Response) Reset() { *x = GetProviderConfig_Response{} if protoimpl.UnsafeEnabled { - mi := &file_internal_plugin_proto_msgTypes[18] + mi := &file_internal_plugin_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1071,7 +1071,7 @@ func (x *GetProviderConfig_Response) String() string { func (*GetProviderConfig_Response) ProtoMessage() {} func (x *GetProviderConfig_Response) ProtoReflect() protoreflect.Message { - mi := &file_internal_plugin_proto_msgTypes[18] + mi := &file_internal_plugin_proto_msgTypes[19] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1143,117 +1143,6 @@ var file_internal_plugin_proto_rawDesc = []byte{ 0x74, 0x6f, 0x2e, 0x46, 0x65, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, -<<<<<<< HEAD - 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, 0x08, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x9c, 0x03, - 0x0a, 0x11, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x53, 0x63, 0x68, - 0x65, 0x6d, 0x61, 0x1a, 0x09, 0x0a, 0x07, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0xfb, - 0x02, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, - 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x5e, 0x0a, 0x0f, 0x72, 0x65, 0x73, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x72, - 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x61, - 0x62, 0x6c, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0e, 0x72, 0x65, 0x73, 0x6f, 0x75, - 0x72, 0x63, 0x65, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x12, 0x51, 0x0a, 0x0a, 0x6d, 0x69, 0x67, - 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x31, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, - 0x72, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x2e, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, - 0x52, 0x0a, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x4f, 0x0a, 0x13, - 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x61, 0x62, 0x6c, 0x65, 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, 0x22, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x54, 0x61, 0x62, - 0x6c, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3d, 0x0a, - 0x0f, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 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, - 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x70, 0x0a, 0x11, - 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, - 0x67, 0x1a, 0x09, 0x0a, 0x07, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x50, 0x0a, 0x08, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, - 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, - 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x22, 0xda, - 0x01, 0x0a, 0x05, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, - 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x27, - 0x0a, 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x0d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x52, 0x07, - 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x12, 0x2a, 0x0a, 0x09, 0x72, 0x65, 0x6c, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x2e, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x09, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x12, 0x3a, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x54, 0x61, 0x62, - 0x6c, 0x65, 0x43, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x48, 0x00, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x88, 0x01, 0x01, 0x42, - 0x0a, 0x0a, 0x08, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x38, 0x0a, 0x14, 0x54, - 0x61, 0x62, 0x6c, 0x65, 0x43, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4f, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x50, 0x72, 0x69, 0x6d, 0x61, 0x72, 0x79, 0x4b, 0x65, - 0x79, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x50, 0x72, 0x69, 0x6d, 0x61, 0x72, - 0x79, 0x4b, 0x65, 0x79, 0x73, 0x22, 0x65, 0x0a, 0x06, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x12, - 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x25, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0e, 0x32, 0x11, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f, 0x6c, 0x75, - 0x6d, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0x50, 0x0a, 0x11, - 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, - 0x73, 0x12, 0x29, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, - 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, - 0x64, 0x73, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x64, 0x73, 0x6e, 0x2a, 0x97, - 0x02, 0x0a, 0x0a, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, - 0x07, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x42, 0x4f, - 0x4f, 0x4c, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x53, 0x4d, 0x41, 0x4c, 0x4c, 0x49, 0x4e, 0x54, - 0x10, 0x02, 0x12, 0x07, 0x0a, 0x03, 0x49, 0x4e, 0x54, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x42, - 0x49, 0x47, 0x49, 0x4e, 0x54, 0x10, 0x04, 0x12, 0x09, 0x0a, 0x05, 0x46, 0x4c, 0x4f, 0x41, 0x54, - 0x10, 0x05, 0x12, 0x08, 0x0a, 0x04, 0x55, 0x55, 0x49, 0x44, 0x10, 0x06, 0x12, 0x0a, 0x0a, 0x06, - 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x10, 0x07, 0x12, 0x0e, 0x0a, 0x0a, 0x42, 0x59, 0x54, 0x45, - 0x5f, 0x41, 0x52, 0x52, 0x41, 0x59, 0x10, 0x08, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x54, 0x52, 0x49, - 0x4e, 0x47, 0x5f, 0x41, 0x52, 0x52, 0x41, 0x59, 0x10, 0x09, 0x12, 0x0d, 0x0a, 0x09, 0x49, 0x4e, - 0x54, 0x5f, 0x41, 0x52, 0x52, 0x41, 0x59, 0x10, 0x0a, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x49, 0x4d, - 0x45, 0x53, 0x54, 0x41, 0x4d, 0x50, 0x10, 0x0b, 0x12, 0x08, 0x0a, 0x04, 0x4a, 0x53, 0x4f, 0x4e, - 0x10, 0x0c, 0x12, 0x0e, 0x0a, 0x0a, 0x55, 0x55, 0x49, 0x44, 0x5f, 0x41, 0x52, 0x52, 0x41, 0x59, - 0x10, 0x0d, 0x12, 0x08, 0x0a, 0x04, 0x49, 0x4e, 0x45, 0x54, 0x10, 0x0e, 0x12, 0x0e, 0x0a, 0x0a, - 0x49, 0x4e, 0x45, 0x54, 0x5f, 0x41, 0x52, 0x52, 0x41, 0x59, 0x10, 0x0f, 0x12, 0x08, 0x0a, 0x04, - 0x43, 0x49, 0x44, 0x52, 0x10, 0x10, 0x12, 0x0e, 0x0a, 0x0a, 0x43, 0x49, 0x44, 0x52, 0x5f, 0x41, - 0x52, 0x52, 0x41, 0x59, 0x10, 0x11, 0x12, 0x0c, 0x0a, 0x08, 0x4d, 0x41, 0x43, 0x5f, 0x41, 0x44, - 0x44, 0x52, 0x10, 0x12, 0x12, 0x12, 0x0a, 0x0e, 0x4d, 0x41, 0x43, 0x5f, 0x41, 0x44, 0x44, 0x52, - 0x5f, 0x41, 0x52, 0x52, 0x41, 0x59, 0x10, 0x13, 0x2a, 0x1e, 0x0a, 0x0e, 0x43, 0x6f, 0x6e, 0x6e, - 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0c, 0x0a, 0x08, 0x50, 0x4f, - 0x53, 0x54, 0x47, 0x52, 0x45, 0x53, 0x10, 0x00, 0x32, 0xeb, 0x02, 0x0a, 0x08, 0x50, 0x72, 0x6f, - 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x58, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x76, - 0x69, 0x64, 0x65, 0x72, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x20, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x53, 0x63, - 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, - 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x58, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x43, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x12, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x47, 0x65, 0x74, - 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x47, - 0x65, 0x74, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x58, 0x0a, 0x11, 0x43, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x75, 0x72, 0x65, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x20, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x65, - 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x21, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, - 0x72, 0x65, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x51, 0x0a, 0x0e, 0x46, 0x65, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x6f, - 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x46, 0x65, - 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x46, 0x65, 0x74, - 0x63, 0x68, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x42, 0x0b, 0x5a, 0x09, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, - 0x6e, 0x61, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -======= 0x79, 0x52, 0x11, 0x66, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x72, 0x65, @@ -1281,9 +1170,9 @@ var file_internal_plugin_proto_rawDesc = []byte{ 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x14, 0x72, 0x6f, 0x6f, 0x74, 0x50, 0x72, 0x69, 0x6d, 0x61, 0x72, 0x79, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, - 0x6f, 0x72, 0x22, 0x8a, 0x02, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, + 0x6f, 0x72, 0x22, 0x9c, 0x03, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x1a, 0x09, 0x0a, 0x07, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0xe9, 0x01, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x65, 0x73, 0x74, 0x1a, 0xfb, 0x02, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x5e, @@ -1292,93 +1181,101 @@ var file_internal_plugin_proto_rawDesc = []byte{ 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0e, - 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x1a, 0x4f, - 0x0a, 0x13, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x73, + 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x12, 0x51, + 0x0a, 0x0a, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x31, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x72, + 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0a, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x1a, 0x4f, 0x0a, 0x13, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x61, 0x62, + 0x6c, 0x65, 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, 0x22, 0x0a, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2e, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, + 0x38, 0x01, 0x1a, 0x3d, 0x0a, 0x0f, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 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, 0x22, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x54, - 0x61, 0x62, 0x6c, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, - 0x70, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x43, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x1a, 0x09, 0x0a, 0x07, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x50, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, - 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, - 0x67, 0x22, 0xda, 0x01, 0x0a, 0x05, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, - 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x12, 0x27, 0x0a, 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f, 0x6c, 0x75, 0x6d, - 0x6e, 0x52, 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x12, 0x2a, 0x0a, 0x09, 0x72, 0x65, - 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x09, 0x72, 0x65, 0x6c, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x3a, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, - 0x54, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x48, 0x00, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x88, - 0x01, 0x01, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x38, - 0x0a, 0x14, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4f, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x50, 0x72, 0x69, 0x6d, 0x61, 0x72, - 0x79, 0x4b, 0x65, 0x79, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x50, 0x72, 0x69, - 0x6d, 0x61, 0x72, 0x79, 0x4b, 0x65, 0x79, 0x73, 0x22, 0x65, 0x0a, 0x06, 0x43, 0x6f, 0x6c, 0x75, - 0x6d, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, - 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x25, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x11, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, - 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, - 0x50, 0x0a, 0x11, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x74, - 0x61, 0x69, 0x6c, 0x73, 0x12, 0x29, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f, 0x6e, 0x6e, 0x65, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, - 0x10, 0x0a, 0x03, 0x64, 0x73, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x64, 0x73, - 0x6e, 0x2a, 0x97, 0x02, 0x0a, 0x0a, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x54, 0x79, 0x70, 0x65, - 0x12, 0x0b, 0x0a, 0x07, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x10, 0x00, 0x12, 0x08, 0x0a, - 0x04, 0x42, 0x4f, 0x4f, 0x4c, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x53, 0x4d, 0x41, 0x4c, 0x4c, - 0x49, 0x4e, 0x54, 0x10, 0x02, 0x12, 0x07, 0x0a, 0x03, 0x49, 0x4e, 0x54, 0x10, 0x03, 0x12, 0x0a, - 0x0a, 0x06, 0x42, 0x49, 0x47, 0x49, 0x4e, 0x54, 0x10, 0x04, 0x12, 0x09, 0x0a, 0x05, 0x46, 0x4c, - 0x4f, 0x41, 0x54, 0x10, 0x05, 0x12, 0x08, 0x0a, 0x04, 0x55, 0x55, 0x49, 0x44, 0x10, 0x06, 0x12, - 0x0a, 0x0a, 0x06, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x10, 0x07, 0x12, 0x0e, 0x0a, 0x0a, 0x42, - 0x59, 0x54, 0x45, 0x5f, 0x41, 0x52, 0x52, 0x41, 0x59, 0x10, 0x08, 0x12, 0x10, 0x0a, 0x0c, 0x53, - 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x41, 0x52, 0x52, 0x41, 0x59, 0x10, 0x09, 0x12, 0x0d, 0x0a, - 0x09, 0x49, 0x4e, 0x54, 0x5f, 0x41, 0x52, 0x52, 0x41, 0x59, 0x10, 0x0a, 0x12, 0x0d, 0x0a, 0x09, - 0x54, 0x49, 0x4d, 0x45, 0x53, 0x54, 0x41, 0x4d, 0x50, 0x10, 0x0b, 0x12, 0x08, 0x0a, 0x04, 0x4a, - 0x53, 0x4f, 0x4e, 0x10, 0x0c, 0x12, 0x0e, 0x0a, 0x0a, 0x55, 0x55, 0x49, 0x44, 0x5f, 0x41, 0x52, - 0x52, 0x41, 0x59, 0x10, 0x0d, 0x12, 0x08, 0x0a, 0x04, 0x49, 0x4e, 0x45, 0x54, 0x10, 0x0e, 0x12, - 0x0e, 0x0a, 0x0a, 0x49, 0x4e, 0x45, 0x54, 0x5f, 0x41, 0x52, 0x52, 0x41, 0x59, 0x10, 0x0f, 0x12, - 0x08, 0x0a, 0x04, 0x43, 0x49, 0x44, 0x52, 0x10, 0x10, 0x12, 0x0e, 0x0a, 0x0a, 0x43, 0x49, 0x44, - 0x52, 0x5f, 0x41, 0x52, 0x52, 0x41, 0x59, 0x10, 0x11, 0x12, 0x0c, 0x0a, 0x08, 0x4d, 0x41, 0x43, - 0x5f, 0x41, 0x44, 0x44, 0x52, 0x10, 0x12, 0x12, 0x12, 0x0a, 0x0e, 0x4d, 0x41, 0x43, 0x5f, 0x41, - 0x44, 0x44, 0x52, 0x5f, 0x41, 0x52, 0x52, 0x41, 0x59, 0x10, 0x13, 0x2a, 0x1e, 0x0a, 0x0e, 0x43, - 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0c, 0x0a, - 0x08, 0x50, 0x4f, 0x53, 0x54, 0x47, 0x52, 0x45, 0x53, 0x10, 0x00, 0x32, 0xeb, 0x02, 0x0a, 0x08, - 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x58, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x50, - 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x20, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, - 0x72, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x21, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x76, 0x69, - 0x64, 0x65, 0x72, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x58, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, - 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, - 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, - 0x67, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, + 0x01, 0x22, 0x70, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, + 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x1a, 0x09, 0x0a, 0x07, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x50, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x63, + 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x63, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 0x22, 0xda, 0x01, 0x0a, 0x05, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x12, 0x0a, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x12, 0x27, 0x0a, 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x18, 0x03, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f, 0x6c, + 0x75, 0x6d, 0x6e, 0x52, 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x12, 0x2a, 0x0a, 0x09, + 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x0c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x09, 0x72, + 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x3a, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2e, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x48, 0x00, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x88, 0x01, 0x01, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x22, 0x38, 0x0a, 0x14, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x50, 0x72, 0x69, 0x6d, + 0x61, 0x72, 0x79, 0x4b, 0x65, 0x79, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x50, + 0x72, 0x69, 0x6d, 0x61, 0x72, 0x79, 0x4b, 0x65, 0x79, 0x73, 0x22, 0x65, 0x0a, 0x06, 0x43, 0x6f, + 0x6c, 0x75, 0x6d, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, + 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, + 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x25, 0x0a, 0x04, 0x74, 0x79, + 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x11, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2e, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, + 0x65, 0x22, 0x50, 0x0a, 0x11, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x44, + 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x12, 0x29, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f, 0x6e, + 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, + 0x65, 0x12, 0x10, 0x0a, 0x03, 0x64, 0x73, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, + 0x64, 0x73, 0x6e, 0x2a, 0x97, 0x02, 0x0a, 0x0a, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x54, 0x79, + 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x10, 0x00, 0x12, + 0x08, 0x0a, 0x04, 0x42, 0x4f, 0x4f, 0x4c, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x53, 0x4d, 0x41, + 0x4c, 0x4c, 0x49, 0x4e, 0x54, 0x10, 0x02, 0x12, 0x07, 0x0a, 0x03, 0x49, 0x4e, 0x54, 0x10, 0x03, + 0x12, 0x0a, 0x0a, 0x06, 0x42, 0x49, 0x47, 0x49, 0x4e, 0x54, 0x10, 0x04, 0x12, 0x09, 0x0a, 0x05, + 0x46, 0x4c, 0x4f, 0x41, 0x54, 0x10, 0x05, 0x12, 0x08, 0x0a, 0x04, 0x55, 0x55, 0x49, 0x44, 0x10, + 0x06, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x10, 0x07, 0x12, 0x0e, 0x0a, + 0x0a, 0x42, 0x59, 0x54, 0x45, 0x5f, 0x41, 0x52, 0x52, 0x41, 0x59, 0x10, 0x08, 0x12, 0x10, 0x0a, + 0x0c, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x41, 0x52, 0x52, 0x41, 0x59, 0x10, 0x09, 0x12, + 0x0d, 0x0a, 0x09, 0x49, 0x4e, 0x54, 0x5f, 0x41, 0x52, 0x52, 0x41, 0x59, 0x10, 0x0a, 0x12, 0x0d, + 0x0a, 0x09, 0x54, 0x49, 0x4d, 0x45, 0x53, 0x54, 0x41, 0x4d, 0x50, 0x10, 0x0b, 0x12, 0x08, 0x0a, + 0x04, 0x4a, 0x53, 0x4f, 0x4e, 0x10, 0x0c, 0x12, 0x0e, 0x0a, 0x0a, 0x55, 0x55, 0x49, 0x44, 0x5f, + 0x41, 0x52, 0x52, 0x41, 0x59, 0x10, 0x0d, 0x12, 0x08, 0x0a, 0x04, 0x49, 0x4e, 0x45, 0x54, 0x10, + 0x0e, 0x12, 0x0e, 0x0a, 0x0a, 0x49, 0x4e, 0x45, 0x54, 0x5f, 0x41, 0x52, 0x52, 0x41, 0x59, 0x10, + 0x0f, 0x12, 0x08, 0x0a, 0x04, 0x43, 0x49, 0x44, 0x52, 0x10, 0x10, 0x12, 0x0e, 0x0a, 0x0a, 0x43, + 0x49, 0x44, 0x52, 0x5f, 0x41, 0x52, 0x52, 0x41, 0x59, 0x10, 0x11, 0x12, 0x0c, 0x0a, 0x08, 0x4d, + 0x41, 0x43, 0x5f, 0x41, 0x44, 0x44, 0x52, 0x10, 0x12, 0x12, 0x12, 0x0a, 0x0e, 0x4d, 0x41, 0x43, + 0x5f, 0x41, 0x44, 0x44, 0x52, 0x5f, 0x41, 0x52, 0x52, 0x41, 0x59, 0x10, 0x13, 0x2a, 0x1e, 0x0a, + 0x0e, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, + 0x0c, 0x0a, 0x08, 0x50, 0x4f, 0x53, 0x54, 0x47, 0x52, 0x45, 0x53, 0x10, 0x00, 0x32, 0xeb, 0x02, + 0x0a, 0x08, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x58, 0x0a, 0x11, 0x47, 0x65, + 0x74, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, + 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x76, 0x69, + 0x64, 0x65, 0x72, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x21, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, + 0x76, 0x69, 0x64, 0x65, 0x72, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x58, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x76, 0x69, + 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x58, 0x0a, 0x11, - 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x65, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, - 0x72, 0x12, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x75, 0x72, 0x65, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f, 0x6e, 0x66, + 0x66, 0x69, 0x67, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x43, + 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x58, + 0x0a, 0x11, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x65, 0x50, 0x72, 0x6f, 0x76, 0x69, + 0x64, 0x65, 0x72, 0x12, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x65, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x2e, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x51, 0x0a, 0x0e, 0x46, 0x65, 0x74, 0x63, 0x68, 0x52, - 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2e, 0x46, 0x65, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, - 0x46, 0x65, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x42, 0x0b, 0x5a, 0x09, 0x2f, 0x69, 0x6e, - 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, ->>>>>>> 7480648 (Initial commit) + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x65, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x2e, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x51, 0x0a, 0x0e, 0x46, 0x65, 0x74, 0x63, + 0x68, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, 0x1d, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2e, 0x46, 0x65, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x73, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2e, 0x46, 0x65, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, + 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x42, 0x0b, 0x5a, 0x09, 0x2f, + 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1394,29 +1291,12 @@ func file_internal_plugin_proto_rawDescGZIP() []byte { } var file_internal_plugin_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_internal_plugin_proto_msgTypes = make([]protoimpl.MessageInfo, 19) +var file_internal_plugin_proto_msgTypes = make([]protoimpl.MessageInfo, 20) var file_internal_plugin_proto_goTypes = []interface{}{ (ColumnType)(0), // 0: proto.ColumnType (ConnectionType)(0), // 1: proto.ConnectionType (*ConfigureProvider)(nil), // 2: proto.ConfigureProvider (*FetchResources)(nil), // 3: proto.FetchResources -<<<<<<< HEAD - (*GetProviderSchema)(nil), // 4: proto.GetProviderSchema - (*GetProviderConfig)(nil), // 5: proto.GetProviderConfig - (*Table)(nil), // 6: proto.Table - (*TableCreationOptions)(nil), // 7: proto.TableCreationOptions - (*Column)(nil), // 8: proto.Column - (*ConnectionDetails)(nil), // 9: proto.ConnectionDetails - (*ConfigureProvider_Request)(nil), // 10: proto.ConfigureProvider.Request - (*ConfigureProvider_Response)(nil), // 11: proto.ConfigureProvider.Response - (*FetchResources_Request)(nil), // 12: proto.FetchResources.Request - (*FetchResources_Response)(nil), // 13: proto.FetchResources.Response - nil, // 14: proto.FetchResources.Response.FinishedResourcesEntry - (*GetProviderSchema_Request)(nil), // 15: proto.GetProviderSchema.Request - (*GetProviderSchema_Response)(nil), // 16: proto.GetProviderSchema.Response - nil, // 17: proto.GetProviderSchema.Response.ResourceTablesEntry - nil, // 18: proto.GetProviderSchema.Response.MigrationsEntry -======= (*PartialFetchFailedResource)(nil), // 4: proto.PartialFetchFailedResource (*GetProviderSchema)(nil), // 5: proto.GetProviderSchema (*GetProviderConfig)(nil), // 6: proto.GetProviderConfig @@ -1432,9 +1312,9 @@ var file_internal_plugin_proto_goTypes = []interface{}{ (*GetProviderSchema_Request)(nil), // 16: proto.GetProviderSchema.Request (*GetProviderSchema_Response)(nil), // 17: proto.GetProviderSchema.Response nil, // 18: proto.GetProviderSchema.Response.ResourceTablesEntry ->>>>>>> 7480648 (Initial commit) - (*GetProviderConfig_Request)(nil), // 19: proto.GetProviderConfig.Request - (*GetProviderConfig_Response)(nil), // 20: proto.GetProviderConfig.Response + nil, // 19: proto.GetProviderSchema.Response.MigrationsEntry + (*GetProviderConfig_Request)(nil), // 20: proto.GetProviderConfig.Request + (*GetProviderConfig_Response)(nil), // 21: proto.GetProviderConfig.Response } var file_internal_plugin_proto_depIdxs = []int32{ 9, // 0: proto.Table.columns:type_name -> proto.Column @@ -1442,40 +1322,25 @@ var file_internal_plugin_proto_depIdxs = []int32{ 8, // 2: proto.Table.options:type_name -> proto.TableCreationOptions 0, // 3: proto.Column.type:type_name -> proto.ColumnType 1, // 4: proto.ConnectionDetails.type:type_name -> proto.ConnectionType -<<<<<<< HEAD - 9, // 5: proto.ConfigureProvider.Request.connection:type_name -> proto.ConnectionDetails - 14, // 6: proto.FetchResources.Response.finished_resources:type_name -> proto.FetchResources.Response.FinishedResourcesEntry - 17, // 7: proto.GetProviderSchema.Response.resource_tables:type_name -> proto.GetProviderSchema.Response.ResourceTablesEntry - 18, // 8: proto.GetProviderSchema.Response.migrations:type_name -> proto.GetProviderSchema.Response.MigrationsEntry - 6, // 9: proto.GetProviderSchema.Response.ResourceTablesEntry.value:type_name -> proto.Table - 15, // 10: proto.Provider.GetProviderSchema:input_type -> proto.GetProviderSchema.Request - 19, // 11: proto.Provider.GetProviderConfig:input_type -> proto.GetProviderConfig.Request - 10, // 12: proto.Provider.ConfigureProvider:input_type -> proto.ConfigureProvider.Request - 12, // 13: proto.Provider.FetchResources:input_type -> proto.FetchResources.Request - 16, // 14: proto.Provider.GetProviderSchema:output_type -> proto.GetProviderSchema.Response - 20, // 15: proto.Provider.GetProviderConfig:output_type -> proto.GetProviderConfig.Response - 11, // 16: proto.Provider.ConfigureProvider:output_type -> proto.ConfigureProvider.Response - 13, // 17: proto.Provider.FetchResources:output_type -> proto.FetchResources.Response -======= 10, // 5: proto.ConfigureProvider.Request.connection:type_name -> proto.ConnectionDetails 15, // 6: proto.FetchResources.Response.finished_resources:type_name -> proto.FetchResources.Response.FinishedResourcesEntry 4, // 7: proto.FetchResources.Response.partial_fetch_failed_resources:type_name -> proto.PartialFetchFailedResource 18, // 8: proto.GetProviderSchema.Response.resource_tables:type_name -> proto.GetProviderSchema.Response.ResourceTablesEntry - 7, // 9: proto.GetProviderSchema.Response.ResourceTablesEntry.value:type_name -> proto.Table - 16, // 10: proto.Provider.GetProviderSchema:input_type -> proto.GetProviderSchema.Request - 19, // 11: proto.Provider.GetProviderConfig:input_type -> proto.GetProviderConfig.Request - 11, // 12: proto.Provider.ConfigureProvider:input_type -> proto.ConfigureProvider.Request - 13, // 13: proto.Provider.FetchResources:input_type -> proto.FetchResources.Request - 17, // 14: proto.Provider.GetProviderSchema:output_type -> proto.GetProviderSchema.Response - 20, // 15: proto.Provider.GetProviderConfig:output_type -> proto.GetProviderConfig.Response - 12, // 16: proto.Provider.ConfigureProvider:output_type -> proto.ConfigureProvider.Response - 14, // 17: proto.Provider.FetchResources:output_type -> proto.FetchResources.Response ->>>>>>> 7480648 (Initial commit) - 14, // [14:18] is the sub-list for method output_type - 10, // [10:14] is the sub-list for method input_type - 10, // [10:10] is the sub-list for extension type_name - 10, // [10:10] is the sub-list for extension extendee - 0, // [0:10] is the sub-list for field type_name + 19, // 9: proto.GetProviderSchema.Response.migrations:type_name -> proto.GetProviderSchema.Response.MigrationsEntry + 7, // 10: proto.GetProviderSchema.Response.ResourceTablesEntry.value:type_name -> proto.Table + 16, // 11: proto.Provider.GetProviderSchema:input_type -> proto.GetProviderSchema.Request + 20, // 12: proto.Provider.GetProviderConfig:input_type -> proto.GetProviderConfig.Request + 11, // 13: proto.Provider.ConfigureProvider:input_type -> proto.ConfigureProvider.Request + 13, // 14: proto.Provider.FetchResources:input_type -> proto.FetchResources.Request + 17, // 15: proto.Provider.GetProviderSchema:output_type -> proto.GetProviderSchema.Response + 21, // 16: proto.Provider.GetProviderConfig:output_type -> proto.GetProviderConfig.Response + 12, // 17: proto.Provider.ConfigureProvider:output_type -> proto.ConfigureProvider.Response + 14, // 18: proto.Provider.FetchResources:output_type -> proto.FetchResources.Response + 15, // [15:19] is the sub-list for method output_type + 11, // [11:15] is the sub-list for method input_type + 11, // [11:11] is the sub-list for extension type_name + 11, // [11:11] is the sub-list for extension extendee + 0, // [0:11] is the sub-list for field type_name } func init() { file_internal_plugin_proto_init() } @@ -1664,7 +1529,7 @@ func file_internal_plugin_proto_init() { return nil } } - file_internal_plugin_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + file_internal_plugin_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetProviderConfig_Request); i { case 0: return &v.state @@ -1676,7 +1541,7 @@ func file_internal_plugin_proto_init() { return nil } } - file_internal_plugin_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + file_internal_plugin_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetProviderConfig_Response); i { case 0: return &v.state @@ -1696,7 +1561,7 @@ func file_internal_plugin_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_internal_plugin_proto_rawDesc, NumEnums: 2, - NumMessages: 19, + NumMessages: 20, NumExtensions: 0, NumServices: 1, }, diff --git a/provider/schema/execution.go b/provider/schema/execution.go index 4c16bd8d..c722ae61 100644 --- a/provider/schema/execution.go +++ b/provider/schema/execution.go @@ -50,7 +50,7 @@ type PartialFetchFailedResource struct { } // partialFetchFailureBufferLength defines the buffer length for the partialFetchChan. -const partialFetchFailureBufferLength = 20 +const partialFetchFailureBufferLength = 10 // NewExecutionData Create a new execution data func NewExecutionData(db Database, logger hclog.Logger, table *Table, disableDelete bool, extraFields map[string]interface{}, partialFetch bool) ExecutionData { @@ -65,7 +65,7 @@ func NewExecutionData(db Database, logger hclog.Logger, table *Table, disableDel } } -func (e ExecutionData) ResolveTable(ctx context.Context, meta ClientMeta, parent *Resource) (uint64, error) { +func (e *ExecutionData) ResolveTable(ctx context.Context, meta ClientMeta, parent *Resource) (uint64, error) { var clients []ClientMeta clients = append(clients, meta) if e.Table.Multiplex != nil { @@ -75,16 +75,15 @@ func (e ExecutionData) ResolveTable(ctx context.Context, meta ClientMeta, parent g, ctx := errgroup.WithContext(ctx) // Start the partial fetch failure result channel routine + finishedPartialFetchChan := make(chan bool) if e.partialFetch { e.partialFetchChan = make(chan PartialFetchFailedResource, partialFetchFailureBufferLength) - defer func() { - close(e.partialFetchChan) - }() go func() { for fetchResourceFailure := range e.partialFetchChan { meta.Logger().Debug("received failed partial fetch resource", "resource", fetchResourceFailure) e.PartialFetchFailureResult = append(e.PartialFetchFailureResult, fetchResourceFailure) } + finishedPartialFetchChan <- true }() } var totalResources uint64 @@ -99,11 +98,16 @@ func (e ExecutionData) ResolveTable(ctx context.Context, meta ClientMeta, parent return nil }) } - return totalResources, g.Wait() + err := g.Wait() + if e.partialFetch { + close(e.partialFetchChan) + <-finishedPartialFetchChan + } + return totalResources, err } -func (e ExecutionData) WithTable(t *Table) ExecutionData { - return ExecutionData{ +func (e *ExecutionData) WithTable(t *Table) *ExecutionData { + return &ExecutionData{ Table: t, Db: e.Db, Logger: e.Logger, @@ -175,7 +179,7 @@ func (e ExecutionData) callTableResolve(ctx context.Context, client ClientMeta, return nc, nil } -func (e ExecutionData) resolveResources(ctx context.Context, meta ClientMeta, parent *Resource, objects []interface{}) error { +func (e *ExecutionData) resolveResources(ctx context.Context, meta ClientMeta, parent *Resource, objects []interface{}) error { var resources = make(Resources, len(objects)) for i, o := range objects { resources[i] = NewResourceData(e.Table, parent, o, e.extraFields) @@ -214,11 +218,16 @@ func (e ExecutionData) resolveResources(ctx context.Context, meta ClientMeta, pa return nil } -func (e ExecutionData) resolveResourceValues(ctx context.Context, meta ClientMeta, resource *Resource) (err error) { +func (e *ExecutionData) resolveResourceValues(ctx context.Context, meta ClientMeta, resource *Resource) (err error) { defer func() { if r := recover(); r != nil { e.Logger.Error("resolve resource recovered from panic", "table", e.Table.Name, "stack", string(debug.Stack())) err = fmt.Errorf("failed resolve resource. Error: %s", r) + if partialFetchErr := e.checkPartialFetchError(err, resource, "resolve resource recovered from panic"); partialFetchErr != nil { + err = partialFetchErr + } else { + err = nil + } } }() if err = e.resolveColumns(ctx, meta, resource, resource.table.Columns); err != nil { @@ -243,7 +252,7 @@ func (e ExecutionData) resolveResourceValues(ctx context.Context, meta ClientMet return err } -func (e ExecutionData) resolveColumns(ctx context.Context, meta ClientMeta, resource *Resource, cols []Column) error { +func (e *ExecutionData) resolveColumns(ctx context.Context, meta ClientMeta, resource *Resource, cols []Column) error { for _, c := range cols { if c.Resolver != nil { meta.Logger().Trace("using custom column resolver", "column", c.Name) @@ -290,7 +299,7 @@ func interfaceSlice(slice interface{}) []interface{} { return ret } -func (e ExecutionData) checkPartialFetchError(err error, res *Resource, customMsg string) error { +func (e *ExecutionData) checkPartialFetchError(err error, res *Resource, customMsg string) error { // Fast path if partial fetch is disabled if !e.partialFetch { return err From 1341f4fc055f3164752acbf887f0daacd303f599 Mon Sep 17 00:00:00 2001 From: Michel Vocks Date: Wed, 18 Aug 2021 16:31:07 +0200 Subject: [PATCH 3/7] add small test --- provider/schema/execution_test.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/provider/schema/execution_test.go b/provider/schema/execution_test.go index d18c810d..bb8d3714 100644 --- a/provider/schema/execution_test.go +++ b/provider/schema/execution_test.go @@ -316,6 +316,26 @@ func TestExecutionData_ResolveTable(t *testing.T) { assert.Equal(t, []string{"name", "name_no_prefix", "prefix_name", "cq_id", "meta", "injected_field"}, expectedResource.columns) assert.Equal(t, []interface{}{"other", "name_no_prefix", "prefix_name", expectedResource.cqId, expectedResource.Get("meta"), 1}, values) }) + + t.Run("test partial fetch", func(t *testing.T) { + mockDb := new(databaseMock) + execDefault := NewExecutionData(mockDb, logger, testDefaultsTable, false, nil, true) + mockDb.On("CopyFrom", mock.Anything, mock.Anything, false, mock.Anything).Return(nil) + testDefaultsTable.Resolver = func(ctx context.Context, meta ClientMeta, parent *Resource, res chan interface{}) error { + res <- testDefaultsTableData{Name: nil} + return nil + } + var expectedResource *Resource + testDefaultsTable.PostResourceResolver = func(ctx context.Context, meta ClientMeta, parent *Resource) error { + expectedResource = parent + return fmt.Errorf("random failure") + } + _, err := execDefault.ResolveTable(context.Background(), mockedClient, nil) + assert.Nil(t, err) + assert.Equal(t, expectedResource.data["name"], "defaultValue") + assert.Len(t, execDefault.PartialFetchFailureResult, 1) + assert.Equal(t, "post resource resolver failed: random failure", execDefault.PartialFetchFailureResult[0].Error) + }) } // ClientMeta is an autogenerated mock type for the ClientMeta type From 9df9b6afd5fa68f29e00a7939098bd3869abe3a9 Mon Sep 17 00:00:00 2001 From: Michel Vocks Date: Thu, 19 Aug 2021 14:16:19 +0200 Subject: [PATCH 4/7] Address review feedback --- provider/schema/execution.go | 9 ++--- provider/schema/execution_test.go | 62 ++++++++++++++++++++++++++++++- 2 files changed, 65 insertions(+), 6 deletions(-) diff --git a/provider/schema/execution.go b/provider/schema/execution.go index c722ae61..54f278d7 100644 --- a/provider/schema/execution.go +++ b/provider/schema/execution.go @@ -222,16 +222,15 @@ func (e *ExecutionData) resolveResourceValues(ctx context.Context, meta ClientMe defer func() { if r := recover(); r != nil { e.Logger.Error("resolve resource recovered from panic", "table", e.Table.Name, "stack", string(debug.Stack())) - err = fmt.Errorf("failed resolve resource. Error: %s", r) - if partialFetchErr := e.checkPartialFetchError(err, resource, "resolve resource recovered from panic"); partialFetchErr != nil { + if partialFetchErr := e.checkPartialFetchError(fmt.Errorf("failed resolve resource. Error: %s", r), resource, "resolve resource recovered from panic"); partialFetchErr != nil { err = partialFetchErr - } else { - err = nil } } }() if err = e.resolveColumns(ctx, meta, resource, resource.table.Columns); err != nil { - return err + if partialFetchErr := e.checkPartialFetchError(err, resource, "resolve column error"); partialFetchErr != nil { + return partialFetchErr + } } // call PostRowResolver if defined after columns have been resolved if resource.table.PostResourceResolver != nil { diff --git a/provider/schema/execution_test.go b/provider/schema/execution_test.go index bb8d3714..a0514502 100644 --- a/provider/schema/execution_test.go +++ b/provider/schema/execution_test.go @@ -317,7 +317,7 @@ func TestExecutionData_ResolveTable(t *testing.T) { assert.Equal(t, []interface{}{"other", "name_no_prefix", "prefix_name", expectedResource.cqId, expectedResource.Get("meta"), 1}, values) }) - t.Run("test partial fetch", func(t *testing.T) { + t.Run("test partial fetch post resource resolver", func(t *testing.T) { mockDb := new(databaseMock) execDefault := NewExecutionData(mockDb, logger, testDefaultsTable, false, nil, true) mockDb.On("CopyFrom", mock.Anything, mock.Anything, false, mock.Anything).Return(nil) @@ -336,6 +336,66 @@ func TestExecutionData_ResolveTable(t *testing.T) { assert.Len(t, execDefault.PartialFetchFailureResult, 1) assert.Equal(t, "post resource resolver failed: random failure", execDefault.PartialFetchFailureResult[0].Error) }) + + t.Run("test partial fetch resolver", func(t *testing.T) { + mockDb := new(databaseMock) + execDefault := NewExecutionData(mockDb, logger, testDefaultsTable, false, nil, true) + mockDb.On("CopyFrom", mock.Anything, mock.Anything, false, mock.Anything).Return(nil) + testDefaultsTable.Resolver = func(ctx context.Context, meta ClientMeta, parent *Resource, res chan interface{}) error { + res <- testDefaultsTableData{Name: nil} + return fmt.Errorf("random failure") + } + var expectedResource *Resource + testDefaultsTable.PostResourceResolver = func(ctx context.Context, meta ClientMeta, parent *Resource) error { + expectedResource = parent + return nil + } + _, err := execDefault.ResolveTable(context.Background(), mockedClient, nil) + assert.Nil(t, err) + assert.Equal(t, expectedResource.data["name"], "defaultValue") + assert.Len(t, execDefault.PartialFetchFailureResult, 1) + assert.Equal(t, "table resolve error: random failure", execDefault.PartialFetchFailureResult[0].Error) + }) + + t.Run("test partial fetch resolver panic", func(t *testing.T) { + mockDb := new(databaseMock) + execDefault := NewExecutionData(mockDb, logger, testDefaultsTable, false, nil, true) + mockDb.On("CopyFrom", mock.Anything, mock.Anything, false, mock.Anything).Return(nil) + testDefaultsTable.Resolver = func(ctx context.Context, meta ClientMeta, parent *Resource, res chan interface{}) error { + res <- testDefaultsTableData{Name: nil} + panic("test panic") + } + var expectedResource *Resource + testDefaultsTable.PostResourceResolver = func(ctx context.Context, meta ClientMeta, parent *Resource) error { + expectedResource = parent + return nil + } + _, err := execDefault.ResolveTable(context.Background(), mockedClient, nil) + assert.Nil(t, err) + assert.Equal(t, expectedResource.data["name"], "defaultValue") + assert.Len(t, execDefault.PartialFetchFailureResult, 1) + assert.Equal(t, "table resolve error: failed table test_table fetch. Error: test panic", execDefault.PartialFetchFailureResult[0].Error) + }) + + t.Run("test partial fetch post resource resolver panic", func(t *testing.T) { + mockDb := new(databaseMock) + execDefault := NewExecutionData(mockDb, logger, testDefaultsTable, false, nil, true) + mockDb.On("CopyFrom", mock.Anything, mock.Anything, false, mock.Anything).Return(nil) + testDefaultsTable.Resolver = func(ctx context.Context, meta ClientMeta, parent *Resource, res chan interface{}) error { + res <- testDefaultsTableData{Name: nil} + return nil + } + var expectedResource *Resource + testDefaultsTable.PostResourceResolver = func(ctx context.Context, meta ClientMeta, parent *Resource) error { + expectedResource = parent + panic("test panic") + } + _, err := execDefault.ResolveTable(context.Background(), mockedClient, nil) + assert.Nil(t, err) + assert.Equal(t, expectedResource.data["name"], "defaultValue") + assert.Len(t, execDefault.PartialFetchFailureResult, 1) + assert.Equal(t, "resolve resource recovered from panic: failed resolve resource. Error: test panic", execDefault.PartialFetchFailureResult[0].Error) + }) } // ClientMeta is an autogenerated mock type for the ClientMeta type From f9a15d5c962fb2238feb8e80d94b50a661ffb93b Mon Sep 17 00:00:00 2001 From: Michel Vocks Date: Mon, 23 Aug 2021 16:15:59 +0200 Subject: [PATCH 5/7] Address review feedback --- provider/schema/execution.go | 58 ++++++++++++++++++++++++++++-------- 1 file changed, 45 insertions(+), 13 deletions(-) diff --git a/provider/schema/execution.go b/provider/schema/execution.go index 54f278d7..d7c79579 100644 --- a/provider/schema/execution.go +++ b/provider/schema/execution.go @@ -91,11 +91,8 @@ func (e *ExecutionData) ResolveTable(ctx context.Context, meta ClientMeta, paren client := client g.Go(func() error { count, err := e.callTableResolve(ctx, client, parent) - if err != nil && !(e.Table.IgnoreError != nil && e.Table.IgnoreError(err)) { - return err - } atomic.AddUint64(&totalResources, count) - return nil + return err }) } err := g.Wait() @@ -148,12 +145,17 @@ func (e ExecutionData) callTableResolve(ctx context.Context, client ClientMeta, go func() { defer func() { if r := recover(); r != nil { - e.Logger.Error("table resolver recovered from panic", "table", e.Table.Name, "stack", string(debug.Stack())) + client.Logger().Error("table resolver recovered from panic", "table", e.Table.Name, "stack", string(debug.Stack())) resolverErr = fmt.Errorf("failed table %s fetch. Error: %s", e.Table.Name, r) } close(res) }() - resolverErr = e.Table.Resolver(ctx, client, parent, res) + err := e.Table.Resolver(ctx, client, parent, res) + if err != nil && e.Table.IgnoreError != nil && e.Table.IgnoreError(err) { + client.Logger().Warn("ignored an error", "err", err, "table", e.Table.Name) + return + } + resolverErr = err }() nc := uint64(0) @@ -193,13 +195,10 @@ func (e *ExecutionData) resolveResources(ctx context.Context, meta ClientMeta, p // only top level tables should cascade, disable delete is turned on. // if we didn't disable delete all data should be wiped before resolve) shouldCascade := parent == nil && e.disableDelete - if err := e.Db.CopyFrom(ctx, resources, shouldCascade, e.extraFields); err != nil { - e.Logger.Warn("failed copy-from to db", "error", err) - // fallback insert, copy from sometimes does problems so we fall back with insert - if err := e.Db.Insert(ctx, e.Table, resources); err != nil { - e.Logger.Error("failed insert to db", "error", err) - return err - } + var err error + resources, err = e.copyDataIntoDB(ctx, resources, shouldCascade) + if err != nil { + return err } // Finally, resolve relations of each resource @@ -218,6 +217,39 @@ func (e *ExecutionData) resolveResources(ctx context.Context, meta ClientMeta, p return nil } +func (e *ExecutionData) copyDataIntoDB(ctx context.Context, resources Resources, shouldCascade bool) (Resources, error) { + partialFetchErrorOccurred := false + if err := e.Db.CopyFrom(ctx, resources, shouldCascade, e.extraFields); err != nil { + e.Logger.Warn("failed copy-from to db", "error", err) + // fallback insert, copy from sometimes does problems so we fall back with insert + if err := e.Db.Insert(ctx, e.Table, resources); err != nil { + e.Logger.Error("failed insert to db", "error", err) + if partialFetchErr := e.checkPartialFetchError(err, nil, "failed to copy resources into the db"); partialFetchErr != nil { + return nil, err + } + // If we're here, partial fetching is enabled and notification has been sent + partialFetchErrorOccurred = true + } + } + + // Fast-path exit here + if !partialFetchErrorOccurred { + return resources, nil + } + + // Try to insert resource by resource if partial fetch is enabled and an error occurred + partialFetchResources := make(Resources, 0) + for id := range resources { + if err := e.Db.Insert(ctx, e.Table, Resources{resources[id]}); err != nil { + e.Logger.Error("failed to insert resource into db", "error", err, "resource", resources[id]) + } else { + // If there is no error we add the resource to the final result + partialFetchResources = append(partialFetchResources, resources[id]) + } + } + return partialFetchResources, nil +} + func (e *ExecutionData) resolveResourceValues(ctx context.Context, meta ClientMeta, resource *Resource) (err error) { defer func() { if r := recover(); r != nil { From ef37e39ba5a943bfbc884095faa28f34405b84d9 Mon Sep 17 00:00:00 2001 From: Michel Vocks Date: Tue, 24 Aug 2021 09:19:20 +0200 Subject: [PATCH 6/7] Return correct error --- provider/schema/execution.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/provider/schema/execution.go b/provider/schema/execution.go index d7c79579..9ae24471 100644 --- a/provider/schema/execution.go +++ b/provider/schema/execution.go @@ -225,7 +225,7 @@ func (e *ExecutionData) copyDataIntoDB(ctx context.Context, resources Resources, if err := e.Db.Insert(ctx, e.Table, resources); err != nil { e.Logger.Error("failed insert to db", "error", err) if partialFetchErr := e.checkPartialFetchError(err, nil, "failed to copy resources into the db"); partialFetchErr != nil { - return nil, err + return nil, partialFetchErr } // If we're here, partial fetching is enabled and notification has been sent partialFetchErrorOccurred = true From 78bd912a65321da29168557da5486f36352af89c Mon Sep 17 00:00:00 2001 From: Michel Vocks Date: Wed, 25 Aug 2021 11:15:40 +0200 Subject: [PATCH 7/7] Address review feedback --- provider/schema/execution.go | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/provider/schema/execution.go b/provider/schema/execution.go index 9ae24471..7c482758 100644 --- a/provider/schema/execution.go +++ b/provider/schema/execution.go @@ -218,24 +218,23 @@ func (e *ExecutionData) resolveResources(ctx context.Context, meta ClientMeta, p } func (e *ExecutionData) copyDataIntoDB(ctx context.Context, resources Resources, shouldCascade bool) (Resources, error) { - partialFetchErrorOccurred := false - if err := e.Db.CopyFrom(ctx, resources, shouldCascade, e.extraFields); err != nil { - e.Logger.Warn("failed copy-from to db", "error", err) - // fallback insert, copy from sometimes does problems so we fall back with insert - if err := e.Db.Insert(ctx, e.Table, resources); err != nil { - e.Logger.Error("failed insert to db", "error", err) - if partialFetchErr := e.checkPartialFetchError(err, nil, "failed to copy resources into the db"); partialFetchErr != nil { - return nil, partialFetchErr - } - // If we're here, partial fetching is enabled and notification has been sent - partialFetchErrorOccurred = true - } + err := e.Db.CopyFrom(ctx, resources, shouldCascade, e.extraFields) + if err == nil { + return resources, nil } + e.Logger.Warn("failed copy-from to db", "error", err) - // Fast-path exit here - if !partialFetchErrorOccurred { + // fallback insert, copy from sometimes does problems so we fall back with insert + err = e.Db.Insert(ctx, e.Table, resources) + if err == nil { return resources, nil } + e.Logger.Error("failed insert to db", "error", err) + + // Partial fetch check + if partialFetchErr := e.checkPartialFetchError(err, nil, "failed to copy resources into the db"); partialFetchErr != nil { + return nil, partialFetchErr + } // Try to insert resource by resource if partial fetch is enabled and an error occurred partialFetchResources := make(Resources, 0)