diff --git a/cmd/start.go b/cmd/start.go index 06d6db0fbe..bc572e88d2 100644 --- a/cmd/start.go +++ b/cmd/start.go @@ -18,8 +18,9 @@ import ( "github.com/opentdf/opentdf-v2-poc/internal/server" // "github.com/opentdf/opentdf-v2-poc/services/acre" - // "github.com/opentdf/opentdf-v2-poc/services/acse" "github.com/opentdf/opentdf-v2-poc/services/attributes" + "github.com/opentdf/opentdf-v2-poc/services/subjectmapping" + // "github.com/opentdf/opentdf-v2-poc/services/keyaccessgrants" "github.com/spf13/cobra" ) @@ -142,11 +143,11 @@ func RegisterServices(_ config.Config, otdf *server.OpenTDFServer, dbClient *db. return fmt.Errorf("could not register attributes service: %w", err) } - // slog.Info("registering acse server") - // err = acse.NewSubjectEncodingServer(dbClient, otdf.GrpcServer, otdf.GrpcInProcess.GetGrpcServer(), otdf.Mux) - // if err != nil { - // return fmt.Errorf("could not register acse service: %w", err) - // } + slog.Info("registering subject mapping service") + err = subjectmapping.NewSubjectMappingServer(dbClient, otdf.GrpcServer, otdf.GrpcInProcess.GetGrpcServer(), otdf.Mux) + if err != nil { + return fmt.Errorf("could not register subject mapping service: %w", err) + } // slog.Info("registering key access grants service") // err = keyaccessgrants.NewKeyAccessGrantsServer(dbClient, otdf.GrpcServer, otdf.Mux) diff --git a/internal/db/subject_mappings.go b/internal/db/subject_mappings.go new file mode 100644 index 0000000000..acb6514494 --- /dev/null +++ b/internal/db/subject_mappings.go @@ -0,0 +1,285 @@ +package db + +import ( + "context" + "strings" + + sq "github.com/Masterminds/squirrel" + "github.com/jackc/pgx/v5" + "github.com/opentdf/opentdf-v2-poc/sdk/attributes" + "github.com/opentdf/opentdf-v2-poc/sdk/common" + "github.com/opentdf/opentdf-v2-poc/sdk/subjectmapping" + "google.golang.org/protobuf/encoding/protojson" +) + +var SubjectMappingTable = tableName(TableSubjectMappings) +var SubjectMappingOperatorEnumPrefix = "SUBJECT_MAPPINGS_OPERATOR_ENUM_" + +func subjectMappingOperatorEnumTransformIn(value string) string { + return strings.TrimPrefix(value, SubjectMappingOperatorEnumPrefix) +} + +func subjectMappingOperatorEnumTransformOut(value string) subjectmapping.SubjectMappingOperatorEnum { + return subjectmapping.SubjectMappingOperatorEnum(subjectmapping.SubjectMappingOperatorEnum_value[SubjectMappingOperatorEnumPrefix+value]) +} + +func subjectMappingSelect() sq.SelectBuilder { + return newStatementBuilder().Select( + tableField(SubjectMappingTable, "id"), + tableField(SubjectMappingTable, "operator"), + tableField(SubjectMappingTable, "subject_attribute"), + tableField(SubjectMappingTable, "subject_attribute_values"), + tableField(SubjectMappingTable, "metadata"), + "JSON_AGG("+ + "JSON_BUILD_OBJECT("+ + "'id', "+tableField(AttributeValueTable, "id")+", "+ + "'value', "+tableField(AttributeValueTable, "value")+","+ + "'members', "+tableField(AttributeValueTable, "members")+ + ")"+ + ") AS attribute_value", + ). + LeftJoin(AttributeValueTable + " ON " + tableField(AttributeValueTable, "id") + " = " + tableField(SubjectMappingTable, "id")). + GroupBy(tableField(SubjectMappingTable, "id")) +} + +func subjectMappingHydrateItem(row pgx.Row) (*subjectmapping.SubjectMapping, error) { + var ( + id string + operator string + subjectAttribute string + subjectAttributeValues []string + metadataJson []byte + attributeValueJson []byte + ) + + err := row.Scan( + &id, + &operator, + &subjectAttribute, + &subjectAttributeValues, + &metadataJson, + &attributeValueJson, + ) + if err != nil { + return nil, err + } + + m := &common.Metadata{} + if metadataJson != nil { + if err := protojson.Unmarshal(metadataJson, m); err != nil { + return nil, err + } + } + + v := &attributes.Value{} + if metadataJson != nil { + if err := protojson.Unmarshal(metadataJson, v); err != nil { + return nil, err + } + } + + s := &subjectmapping.SubjectMapping{ + Id: id, + Operator: subjectMappingOperatorEnumTransformOut(operator), + SubjectAttribute: subjectAttribute, + SubjectValues: subjectAttributeValues, + Metadata: m, + AttributeValue: v, + } + return s, nil +} + +func subjectMappingHydrateList(rows pgx.Rows) ([]*subjectmapping.SubjectMapping, error) { + list := make([]*subjectmapping.SubjectMapping, 0) + for rows.Next() { + s, err := subjectMappingHydrateItem(rows) + if err != nil { + return nil, err + } + list = append(list, s) + } + return list, nil +} + +/// +/// SubjectMapping CRUD +/// + +func createSubjectMappingSql(attribute_value_id string, operator string, subject_attribute string, subject_attribute_values []string, metadata []byte) (string, []interface{}, error) { + return newStatementBuilder(). + Insert(SubjectMappingTable). + Columns( + "attribute_value_id", + "operator", + "subject_attribute", + "subject_attribute_values", + "metadata", + ). + Values( + attribute_value_id, + operator, + subject_attribute, + subject_attribute_values, + metadata, + ). + Suffix("RETURNING \"id\""). + ToSql() +} +func (c *Client) CreateSubjectMapping(ctx context.Context, s *subjectmapping.SubjectMappingCreateUpdate) (*subjectmapping.SubjectMapping, error) { + metadataJson, metadata, err := marshalCreateMetadata(s.Metadata) + if err != nil { + return nil, err + } + + sql, args, err := createSubjectMappingSql( + s.AttributeValueId, + subjectMappingOperatorEnumTransformIn(s.Operator.String()), + s.SubjectAttribute, + s.SubjectValues, + metadataJson, + ) + + var id string + if r, err := c.queryRow(ctx, sql, args, err); err != nil { + return nil, err + } else if err := r.Scan(&id); err != nil { + return nil, err + } + + // a, err := c.GetAttributeValue(ctx, s.AttributeValueId) + + rS := &subjectmapping.SubjectMapping{ + Id: id, + // Attribute: a, + Operator: s.Operator, + SubjectAttribute: s.SubjectAttribute, + SubjectValues: s.SubjectValues, + Metadata: metadata, + } + return rS, nil +} + +func getSubjectMappingSql(id string) (string, []interface{}, error) { + return subjectMappingSelect(). + From(SubjectMappingTable). + Where(sq.Eq{"id": id}). + ToSql() +} +func (c *Client) GetSubjectMapping(ctx context.Context, id string) (*subjectmapping.SubjectMapping, error) { + sql, args, err := getSubjectMappingSql(id) + + row, err := c.queryRow(ctx, sql, args, err) + if err != nil { + return nil, err + } + + s, err := subjectMappingHydrateItem(row) + if err != nil { + return nil, err + } + + return s, nil +} + +func listSubjectMappingsSql() (string, []interface{}, error) { + return subjectMappingSelect(). + From(SubjectMappingTable). + ToSql() +} +func (c *Client) ListSubjectMappings(ctx context.Context) ([]*subjectmapping.SubjectMapping, error) { + sql, args, err := listSubjectMappingsSql() + if err != nil { + return nil, err + } + + rows, err := c.query(ctx, sql, args, err) + if err != nil { + return nil, err + } + defer rows.Close() + + subjectMappings, err := subjectMappingHydrateList(rows) + if err != nil { + return nil, err + } + + return subjectMappings, nil +} + +func updateSubjectMappingSql(id string, attribute_value_id string, operator string, subject_attribute string, subject_attribute_values []string, metadata []byte) (string, []interface{}, error) { + sb := newStatementBuilder(). + Update(SubjectMappingTable) + + if attribute_value_id != "" { + sb.Set("attribute_value_id", attribute_value_id) + } + if operator != "" { + sb.Set("operator", operator) + } + if subject_attribute != "" { + sb.Set("subject_attribute", subject_attribute) + } + if subject_attribute_values != nil { + sb.Set("subject_attribute_values", subject_attribute_values) + } + if metadata != nil { + sb.Set("metadata", metadata) + } + + return sb. + Where(sq.Eq{"id": id}). + ToSql() +} +func (c *Client) UpdateSubjectMapping(ctx context.Context, id string, s *subjectmapping.SubjectMappingCreateUpdate) (*subjectmapping.SubjectMapping, error) { + prev, err := c.GetSubjectMapping(ctx, id) + if err != nil { + return nil, err + } + + metadataJson, _, err := marshalUpdateMetadata(prev.Metadata, s.Metadata) + if err != nil { + return nil, err + } + + sql, args, err := updateSubjectMappingSql( + id, + s.AttributeValueId, + subjectMappingOperatorEnumTransformIn(s.Operator.String()), + s.SubjectAttribute, + s.SubjectValues, + metadataJson, + ) + if err != nil { + return nil, err + } + + if err := c.exec(ctx, sql, args, err); err != nil { + return nil, err + } + + return prev, nil +} + +func deleteSubjectMappingSql(id string) (string, []interface{}, error) { + return newStatementBuilder(). + Delete(SubjectMappingTable). + Where(sq.Eq{"id": id}). + ToSql() +} +func (c *Client) DeleteSubjectMapping(ctx context.Context, id string) (*subjectmapping.SubjectMapping, error) { + prev, err := c.GetSubjectMapping(ctx, id) + if err != nil { + return nil, err + } + + sql, args, err := deleteSubjectMappingSql(id) + if err != nil { + return nil, err + } + + if err := c.exec(ctx, sql, args, err); err != nil { + return nil, err + } + + return prev, nil +} diff --git a/proto/subjectmapping/subject_mapping.proto b/proto/subjectmapping/subject_mapping.proto index e619283ce8..0105301a08 100644 --- a/proto/subjectmapping/subject_mapping.proto +++ b/proto/subjectmapping/subject_mapping.proto @@ -2,6 +2,7 @@ syntax = "proto3"; package subjectmapping; +import "attributes/attributes.proto"; import "buf/validate/validate.proto"; import "common/common.proto"; import "google/api/annotations.proto"; @@ -57,17 +58,41 @@ import "google/api/annotations.proto"; ``` */ + +// buflint ENUM_VALUE_PREFIX: to make sure that C++ scoping rules aren't violated when users add new enum values to an enum in a given package +enum SubjectMappingOperatorEnum { + SUBJECT_MAPPING_OPERATOR_ENUM_UNSPECIFIED = 0; + SUBJECT_MAPPING_OPERATOR_ENUM_IN = 1; + SUBJECT_MAPPING_OPERATOR_ENUM_NOT_IN = 2; +} + message SubjectMapping { - common.Metadata metadata = 1; + string id = 1; - // buflint ENUM_VALUE_PREFIX: to make sure that C++ scoping rules aren't violated when users add new enum values to an enum in a given package - enum SubjectMappingOperatorEnum { - SUBJECT_MAPPING_OPERATOR_ENUM_UNSPECIFIED = 0; - SUBJECT_MAPPING_OPERATOR_ENUM_IN = 1; - SUBJECT_MAPPING_OPERATOR_ENUM_NOT_IN = 2; - } + common.Metadata metadata = 2; //TODO should this be a list of values? + // Attribute Value to be mapped to + attributes.Value attribute_value = 3; + + // Resource Attribute Key; NOT Attribute Definition Attribute name + string subject_attribute = 4; + + // The list of comparison values for a resource's value + repeated string subject_values = 5; + + // the operator + SubjectMappingOperatorEnum operator = 6 [ + (buf.validate.field).enum.defined_only = true, + (buf.validate.field).required = true + ]; + //TODO future - add features or idea of pattern/regex like ACSE? like username regex to pull domain from subject attribute + // or treat the subject values as regex patterns applied to subject attribute +} + +message SubjectMappingCreateUpdate { + common.MetadataMutable metadata = 1; + // Attribute Value to be mapped to string attribute_value_id = 2; @@ -99,20 +124,26 @@ message ListSubjectMappingsResponse { } message CreateSubjectMappingRequest { - SubjectMapping subject_mapping = 1 [(buf.validate.field).required = true]; + SubjectMappingCreateUpdate subject_mapping = 1 [(buf.validate.field).required = true]; +} +message CreateSubjectMappingResponse { + SubjectMapping subject_mapping = 1; } -message CreateSubjectMappingResponse {} message UpdateSubjectMappingRequest { string id = 1 [(buf.validate.field).required = true]; - SubjectMapping subject_mapping = 2 [(buf.validate.field).required = true]; + SubjectMappingCreateUpdate subject_mapping = 2 [(buf.validate.field).required = true]; +} +message UpdateSubjectMappingResponse { + SubjectMapping subject_mapping = 1; } -message UpdateSubjectMappingResponse {} message DeleteSubjectMappingRequest { string id = 1 [(buf.validate.field).required = true]; } -message DeleteSubjectMappingResponse {} +message DeleteSubjectMappingResponse { + SubjectMapping subject_mapping = 1; +} service SubjectMappingService { rpc ListSubjectMappings(ListSubjectMappingsRequest) returns (ListSubjectMappingsResponse) { diff --git a/sdk/subjectmapping/subject_mapping.pb.go b/sdk/subjectmapping/subject_mapping.pb.go index 1495f8bd2a..2212c4764f 100644 --- a/sdk/subjectmapping/subject_mapping.pb.go +++ b/sdk/subjectmapping/subject_mapping.pb.go @@ -8,6 +8,7 @@ package subjectmapping import ( _ "buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validate" + attributes "github.com/opentdf/opentdf-v2-poc/sdk/attributes" common "github.com/opentdf/opentdf-v2-poc/sdk/common" _ "google.golang.org/genproto/googleapis/api/annotations" protoreflect "google.golang.org/protobuf/reflect/protoreflect" @@ -24,117 +25,70 @@ const ( ) // buflint ENUM_VALUE_PREFIX: to make sure that C++ scoping rules aren't violated when users add new enum values to an enum in a given package -type SubjectMapping_SubjectMappingOperatorEnum int32 +type SubjectMappingOperatorEnum int32 const ( - SubjectMapping_SUBJECT_MAPPING_OPERATOR_ENUM_UNSPECIFIED SubjectMapping_SubjectMappingOperatorEnum = 0 - SubjectMapping_SUBJECT_MAPPING_OPERATOR_ENUM_IN SubjectMapping_SubjectMappingOperatorEnum = 1 - SubjectMapping_SUBJECT_MAPPING_OPERATOR_ENUM_NOT_IN SubjectMapping_SubjectMappingOperatorEnum = 2 + SubjectMappingOperatorEnum_SUBJECT_MAPPING_OPERATOR_ENUM_UNSPECIFIED SubjectMappingOperatorEnum = 0 + SubjectMappingOperatorEnum_SUBJECT_MAPPING_OPERATOR_ENUM_IN SubjectMappingOperatorEnum = 1 + SubjectMappingOperatorEnum_SUBJECT_MAPPING_OPERATOR_ENUM_NOT_IN SubjectMappingOperatorEnum = 2 ) -// Enum value maps for SubjectMapping_SubjectMappingOperatorEnum. +// Enum value maps for SubjectMappingOperatorEnum. var ( - SubjectMapping_SubjectMappingOperatorEnum_name = map[int32]string{ + SubjectMappingOperatorEnum_name = map[int32]string{ 0: "SUBJECT_MAPPING_OPERATOR_ENUM_UNSPECIFIED", 1: "SUBJECT_MAPPING_OPERATOR_ENUM_IN", 2: "SUBJECT_MAPPING_OPERATOR_ENUM_NOT_IN", } - SubjectMapping_SubjectMappingOperatorEnum_value = map[string]int32{ + SubjectMappingOperatorEnum_value = map[string]int32{ "SUBJECT_MAPPING_OPERATOR_ENUM_UNSPECIFIED": 0, "SUBJECT_MAPPING_OPERATOR_ENUM_IN": 1, "SUBJECT_MAPPING_OPERATOR_ENUM_NOT_IN": 2, } ) -func (x SubjectMapping_SubjectMappingOperatorEnum) Enum() *SubjectMapping_SubjectMappingOperatorEnum { - p := new(SubjectMapping_SubjectMappingOperatorEnum) +func (x SubjectMappingOperatorEnum) Enum() *SubjectMappingOperatorEnum { + p := new(SubjectMappingOperatorEnum) *p = x return p } -func (x SubjectMapping_SubjectMappingOperatorEnum) String() string { +func (x SubjectMappingOperatorEnum) String() string { return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } -func (SubjectMapping_SubjectMappingOperatorEnum) Descriptor() protoreflect.EnumDescriptor { +func (SubjectMappingOperatorEnum) Descriptor() protoreflect.EnumDescriptor { return file_subjectmapping_subject_mapping_proto_enumTypes[0].Descriptor() } -func (SubjectMapping_SubjectMappingOperatorEnum) Type() protoreflect.EnumType { +func (SubjectMappingOperatorEnum) Type() protoreflect.EnumType { return &file_subjectmapping_subject_mapping_proto_enumTypes[0] } -func (x SubjectMapping_SubjectMappingOperatorEnum) Number() protoreflect.EnumNumber { +func (x SubjectMappingOperatorEnum) Number() protoreflect.EnumNumber { return protoreflect.EnumNumber(x) } -// Deprecated: Use SubjectMapping_SubjectMappingOperatorEnum.Descriptor instead. -func (SubjectMapping_SubjectMappingOperatorEnum) EnumDescriptor() ([]byte, []int) { - return file_subjectmapping_subject_mapping_proto_rawDescGZIP(), []int{0, 0} -} - -// # Subject Mapping (aka Access Control Subject Encoding aka ACSE): Structures supporting the mapping of Subjects and Attributes (e.g. Entitlement) -// -// ## Examples -// -// ### Where: -// -// - attribute_value_id represents the following attribute -// - FQN: "http://demo.com/attr/relto/value/CZE" -// - UUID: "12345678-1234-1234-1234-123456789012" -// -// ### Request -// -// ```bash -// grpcurl -plaintext -d '{ -// "subject_mapping": { -// "metadata": { -// "description": "subject mapping 1", -// "labels": { -// "test-label": "test-value" -// } -// }, -// "attribute_value_id": "12345678-1234-1234-1234-123456789012", -// "subject_attribute": "nationality", -// "subject_values": ["CZE"], -// "operator": "IN" -// } -// }' localhost:8080 SubjectMappingService.CreateSubjectMapping -// ``` -// -// ### Response -// -// ``` -// { -// "subject_mapping": { -// "metadata": { -// "id": "12345678-2222-1234-1234-123456789012", -// "description": "subject mapping 1", -// "labels": { -// "test-label": "test-value" -// } -// }, -// "attribute_value_id": "12345678-1234-1234-1234-123456789012", -// "subject_attribute": "nationality", -// "subject_values": ["CZE"], -// "operator": "IN" -// } -// } -// ``` +// Deprecated: Use SubjectMappingOperatorEnum.Descriptor instead. +func (SubjectMappingOperatorEnum) EnumDescriptor() ([]byte, []int) { + return file_subjectmapping_subject_mapping_proto_rawDescGZIP(), []int{0} +} + type SubjectMapping struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Metadata *common.Metadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Metadata *common.Metadata `protobuf:"bytes,2,opt,name=metadata,proto3" json:"metadata,omitempty"` //TODO should this be a list of values? // Attribute Value to be mapped to - AttributeValueId string `protobuf:"bytes,2,opt,name=attribute_value_id,json=attributeValueId,proto3" json:"attribute_value_id,omitempty"` + AttributeValue *attributes.Value `protobuf:"bytes,3,opt,name=attribute_value,json=attributeValue,proto3" json:"attribute_value,omitempty"` // Resource Attribute Key; NOT Attribute Definition Attribute name - SubjectAttribute string `protobuf:"bytes,3,opt,name=subject_attribute,json=subjectAttribute,proto3" json:"subject_attribute,omitempty"` + SubjectAttribute string `protobuf:"bytes,4,opt,name=subject_attribute,json=subjectAttribute,proto3" json:"subject_attribute,omitempty"` // The list of comparison values for a resource's value - SubjectValues []string `protobuf:"bytes,4,rep,name=subject_values,json=subjectValues,proto3" json:"subject_values,omitempty"` + SubjectValues []string `protobuf:"bytes,5,rep,name=subject_values,json=subjectValues,proto3" json:"subject_values,omitempty"` // the operator - Operator SubjectMapping_SubjectMappingOperatorEnum `protobuf:"varint,5,opt,name=operator,proto3,enum=subjectmapping.SubjectMapping_SubjectMappingOperatorEnum" json:"operator,omitempty"` + Operator SubjectMappingOperatorEnum `protobuf:"varint,6,opt,name=operator,proto3,enum=subjectmapping.SubjectMappingOperatorEnum" json:"operator,omitempty"` } func (x *SubjectMapping) Reset() { @@ -169,6 +123,13 @@ func (*SubjectMapping) Descriptor() ([]byte, []int) { return file_subjectmapping_subject_mapping_proto_rawDescGZIP(), []int{0} } +func (x *SubjectMapping) GetId() string { + if x != nil { + return x.Id + } + return "" +} + func (x *SubjectMapping) GetMetadata() *common.Metadata { if x != nil { return x.Metadata @@ -176,11 +137,11 @@ func (x *SubjectMapping) GetMetadata() *common.Metadata { return nil } -func (x *SubjectMapping) GetAttributeValueId() string { +func (x *SubjectMapping) GetAttributeValue() *attributes.Value { if x != nil { - return x.AttributeValueId + return x.AttributeValue } - return "" + return nil } func (x *SubjectMapping) GetSubjectAttribute() string { @@ -197,11 +158,94 @@ func (x *SubjectMapping) GetSubjectValues() []string { return nil } -func (x *SubjectMapping) GetOperator() SubjectMapping_SubjectMappingOperatorEnum { +func (x *SubjectMapping) GetOperator() SubjectMappingOperatorEnum { if x != nil { return x.Operator } - return SubjectMapping_SUBJECT_MAPPING_OPERATOR_ENUM_UNSPECIFIED + return SubjectMappingOperatorEnum_SUBJECT_MAPPING_OPERATOR_ENUM_UNSPECIFIED +} + +type SubjectMappingCreateUpdate struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Metadata *common.MetadataMutable `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` + // Attribute Value to be mapped to + AttributeValueId string `protobuf:"bytes,2,opt,name=attribute_value_id,json=attributeValueId,proto3" json:"attribute_value_id,omitempty"` + // Resource Attribute Key; NOT Attribute Definition Attribute name + SubjectAttribute string `protobuf:"bytes,3,opt,name=subject_attribute,json=subjectAttribute,proto3" json:"subject_attribute,omitempty"` + // The list of comparison values for a resource's value + SubjectValues []string `protobuf:"bytes,4,rep,name=subject_values,json=subjectValues,proto3" json:"subject_values,omitempty"` + // the operator + Operator SubjectMappingOperatorEnum `protobuf:"varint,5,opt,name=operator,proto3,enum=subjectmapping.SubjectMappingOperatorEnum" json:"operator,omitempty"` +} + +func (x *SubjectMappingCreateUpdate) Reset() { + *x = SubjectMappingCreateUpdate{} + if protoimpl.UnsafeEnabled { + mi := &file_subjectmapping_subject_mapping_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SubjectMappingCreateUpdate) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SubjectMappingCreateUpdate) ProtoMessage() {} + +func (x *SubjectMappingCreateUpdate) ProtoReflect() protoreflect.Message { + mi := &file_subjectmapping_subject_mapping_proto_msgTypes[1] + 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 SubjectMappingCreateUpdate.ProtoReflect.Descriptor instead. +func (*SubjectMappingCreateUpdate) Descriptor() ([]byte, []int) { + return file_subjectmapping_subject_mapping_proto_rawDescGZIP(), []int{1} +} + +func (x *SubjectMappingCreateUpdate) GetMetadata() *common.MetadataMutable { + if x != nil { + return x.Metadata + } + return nil +} + +func (x *SubjectMappingCreateUpdate) GetAttributeValueId() string { + if x != nil { + return x.AttributeValueId + } + return "" +} + +func (x *SubjectMappingCreateUpdate) GetSubjectAttribute() string { + if x != nil { + return x.SubjectAttribute + } + return "" +} + +func (x *SubjectMappingCreateUpdate) GetSubjectValues() []string { + if x != nil { + return x.SubjectValues + } + return nil +} + +func (x *SubjectMappingCreateUpdate) GetOperator() SubjectMappingOperatorEnum { + if x != nil { + return x.Operator + } + return SubjectMappingOperatorEnum_SUBJECT_MAPPING_OPERATOR_ENUM_UNSPECIFIED } type GetSubjectMappingRequest struct { @@ -215,7 +259,7 @@ type GetSubjectMappingRequest struct { func (x *GetSubjectMappingRequest) Reset() { *x = GetSubjectMappingRequest{} if protoimpl.UnsafeEnabled { - mi := &file_subjectmapping_subject_mapping_proto_msgTypes[1] + mi := &file_subjectmapping_subject_mapping_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -228,7 +272,7 @@ func (x *GetSubjectMappingRequest) String() string { func (*GetSubjectMappingRequest) ProtoMessage() {} func (x *GetSubjectMappingRequest) ProtoReflect() protoreflect.Message { - mi := &file_subjectmapping_subject_mapping_proto_msgTypes[1] + mi := &file_subjectmapping_subject_mapping_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -241,7 +285,7 @@ func (x *GetSubjectMappingRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetSubjectMappingRequest.ProtoReflect.Descriptor instead. func (*GetSubjectMappingRequest) Descriptor() ([]byte, []int) { - return file_subjectmapping_subject_mapping_proto_rawDescGZIP(), []int{1} + return file_subjectmapping_subject_mapping_proto_rawDescGZIP(), []int{2} } func (x *GetSubjectMappingRequest) GetId() string { @@ -262,7 +306,7 @@ type GetSubjectMappingResponse struct { func (x *GetSubjectMappingResponse) Reset() { *x = GetSubjectMappingResponse{} if protoimpl.UnsafeEnabled { - mi := &file_subjectmapping_subject_mapping_proto_msgTypes[2] + mi := &file_subjectmapping_subject_mapping_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -275,7 +319,7 @@ func (x *GetSubjectMappingResponse) String() string { func (*GetSubjectMappingResponse) ProtoMessage() {} func (x *GetSubjectMappingResponse) ProtoReflect() protoreflect.Message { - mi := &file_subjectmapping_subject_mapping_proto_msgTypes[2] + mi := &file_subjectmapping_subject_mapping_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -288,7 +332,7 @@ func (x *GetSubjectMappingResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use GetSubjectMappingResponse.ProtoReflect.Descriptor instead. func (*GetSubjectMappingResponse) Descriptor() ([]byte, []int) { - return file_subjectmapping_subject_mapping_proto_rawDescGZIP(), []int{2} + return file_subjectmapping_subject_mapping_proto_rawDescGZIP(), []int{3} } func (x *GetSubjectMappingResponse) GetSubjectMapping() *SubjectMapping { @@ -307,7 +351,7 @@ type ListSubjectMappingsRequest struct { func (x *ListSubjectMappingsRequest) Reset() { *x = ListSubjectMappingsRequest{} if protoimpl.UnsafeEnabled { - mi := &file_subjectmapping_subject_mapping_proto_msgTypes[3] + mi := &file_subjectmapping_subject_mapping_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -320,7 +364,7 @@ func (x *ListSubjectMappingsRequest) String() string { func (*ListSubjectMappingsRequest) ProtoMessage() {} func (x *ListSubjectMappingsRequest) ProtoReflect() protoreflect.Message { - mi := &file_subjectmapping_subject_mapping_proto_msgTypes[3] + mi := &file_subjectmapping_subject_mapping_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -333,7 +377,7 @@ func (x *ListSubjectMappingsRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ListSubjectMappingsRequest.ProtoReflect.Descriptor instead. func (*ListSubjectMappingsRequest) Descriptor() ([]byte, []int) { - return file_subjectmapping_subject_mapping_proto_rawDescGZIP(), []int{3} + return file_subjectmapping_subject_mapping_proto_rawDescGZIP(), []int{4} } type ListSubjectMappingsResponse struct { @@ -347,7 +391,7 @@ type ListSubjectMappingsResponse struct { func (x *ListSubjectMappingsResponse) Reset() { *x = ListSubjectMappingsResponse{} if protoimpl.UnsafeEnabled { - mi := &file_subjectmapping_subject_mapping_proto_msgTypes[4] + mi := &file_subjectmapping_subject_mapping_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -360,7 +404,7 @@ func (x *ListSubjectMappingsResponse) String() string { func (*ListSubjectMappingsResponse) ProtoMessage() {} func (x *ListSubjectMappingsResponse) ProtoReflect() protoreflect.Message { - mi := &file_subjectmapping_subject_mapping_proto_msgTypes[4] + mi := &file_subjectmapping_subject_mapping_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -373,7 +417,7 @@ func (x *ListSubjectMappingsResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ListSubjectMappingsResponse.ProtoReflect.Descriptor instead. func (*ListSubjectMappingsResponse) Descriptor() ([]byte, []int) { - return file_subjectmapping_subject_mapping_proto_rawDescGZIP(), []int{4} + return file_subjectmapping_subject_mapping_proto_rawDescGZIP(), []int{5} } func (x *ListSubjectMappingsResponse) GetSubjectMappings() []*SubjectMapping { @@ -388,13 +432,13 @@ type CreateSubjectMappingRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - SubjectMapping *SubjectMapping `protobuf:"bytes,1,opt,name=subject_mapping,json=subjectMapping,proto3" json:"subject_mapping,omitempty"` + SubjectMapping *SubjectMappingCreateUpdate `protobuf:"bytes,1,opt,name=subject_mapping,json=subjectMapping,proto3" json:"subject_mapping,omitempty"` } func (x *CreateSubjectMappingRequest) Reset() { *x = CreateSubjectMappingRequest{} if protoimpl.UnsafeEnabled { - mi := &file_subjectmapping_subject_mapping_proto_msgTypes[5] + mi := &file_subjectmapping_subject_mapping_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -407,7 +451,7 @@ func (x *CreateSubjectMappingRequest) String() string { func (*CreateSubjectMappingRequest) ProtoMessage() {} func (x *CreateSubjectMappingRequest) ProtoReflect() protoreflect.Message { - mi := &file_subjectmapping_subject_mapping_proto_msgTypes[5] + mi := &file_subjectmapping_subject_mapping_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -420,10 +464,10 @@ func (x *CreateSubjectMappingRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use CreateSubjectMappingRequest.ProtoReflect.Descriptor instead. func (*CreateSubjectMappingRequest) Descriptor() ([]byte, []int) { - return file_subjectmapping_subject_mapping_proto_rawDescGZIP(), []int{5} + return file_subjectmapping_subject_mapping_proto_rawDescGZIP(), []int{6} } -func (x *CreateSubjectMappingRequest) GetSubjectMapping() *SubjectMapping { +func (x *CreateSubjectMappingRequest) GetSubjectMapping() *SubjectMappingCreateUpdate { if x != nil { return x.SubjectMapping } @@ -434,12 +478,14 @@ type CreateSubjectMappingResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + + SubjectMapping *SubjectMapping `protobuf:"bytes,1,opt,name=subject_mapping,json=subjectMapping,proto3" json:"subject_mapping,omitempty"` } func (x *CreateSubjectMappingResponse) Reset() { *x = CreateSubjectMappingResponse{} if protoimpl.UnsafeEnabled { - mi := &file_subjectmapping_subject_mapping_proto_msgTypes[6] + mi := &file_subjectmapping_subject_mapping_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -452,7 +498,7 @@ func (x *CreateSubjectMappingResponse) String() string { func (*CreateSubjectMappingResponse) ProtoMessage() {} func (x *CreateSubjectMappingResponse) ProtoReflect() protoreflect.Message { - mi := &file_subjectmapping_subject_mapping_proto_msgTypes[6] + mi := &file_subjectmapping_subject_mapping_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -465,7 +511,14 @@ func (x *CreateSubjectMappingResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use CreateSubjectMappingResponse.ProtoReflect.Descriptor instead. func (*CreateSubjectMappingResponse) Descriptor() ([]byte, []int) { - return file_subjectmapping_subject_mapping_proto_rawDescGZIP(), []int{6} + return file_subjectmapping_subject_mapping_proto_rawDescGZIP(), []int{7} +} + +func (x *CreateSubjectMappingResponse) GetSubjectMapping() *SubjectMapping { + if x != nil { + return x.SubjectMapping + } + return nil } type UpdateSubjectMappingRequest struct { @@ -473,14 +526,14 @@ type UpdateSubjectMappingRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - SubjectMapping *SubjectMapping `protobuf:"bytes,2,opt,name=subject_mapping,json=subjectMapping,proto3" json:"subject_mapping,omitempty"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + SubjectMapping *SubjectMappingCreateUpdate `protobuf:"bytes,2,opt,name=subject_mapping,json=subjectMapping,proto3" json:"subject_mapping,omitempty"` } func (x *UpdateSubjectMappingRequest) Reset() { *x = UpdateSubjectMappingRequest{} if protoimpl.UnsafeEnabled { - mi := &file_subjectmapping_subject_mapping_proto_msgTypes[7] + mi := &file_subjectmapping_subject_mapping_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -493,7 +546,7 @@ func (x *UpdateSubjectMappingRequest) String() string { func (*UpdateSubjectMappingRequest) ProtoMessage() {} func (x *UpdateSubjectMappingRequest) ProtoReflect() protoreflect.Message { - mi := &file_subjectmapping_subject_mapping_proto_msgTypes[7] + mi := &file_subjectmapping_subject_mapping_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -506,7 +559,7 @@ func (x *UpdateSubjectMappingRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use UpdateSubjectMappingRequest.ProtoReflect.Descriptor instead. func (*UpdateSubjectMappingRequest) Descriptor() ([]byte, []int) { - return file_subjectmapping_subject_mapping_proto_rawDescGZIP(), []int{7} + return file_subjectmapping_subject_mapping_proto_rawDescGZIP(), []int{8} } func (x *UpdateSubjectMappingRequest) GetId() string { @@ -516,7 +569,7 @@ func (x *UpdateSubjectMappingRequest) GetId() string { return "" } -func (x *UpdateSubjectMappingRequest) GetSubjectMapping() *SubjectMapping { +func (x *UpdateSubjectMappingRequest) GetSubjectMapping() *SubjectMappingCreateUpdate { if x != nil { return x.SubjectMapping } @@ -527,12 +580,14 @@ type UpdateSubjectMappingResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + + SubjectMapping *SubjectMapping `protobuf:"bytes,1,opt,name=subject_mapping,json=subjectMapping,proto3" json:"subject_mapping,omitempty"` } func (x *UpdateSubjectMappingResponse) Reset() { *x = UpdateSubjectMappingResponse{} if protoimpl.UnsafeEnabled { - mi := &file_subjectmapping_subject_mapping_proto_msgTypes[8] + mi := &file_subjectmapping_subject_mapping_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -545,7 +600,7 @@ func (x *UpdateSubjectMappingResponse) String() string { func (*UpdateSubjectMappingResponse) ProtoMessage() {} func (x *UpdateSubjectMappingResponse) ProtoReflect() protoreflect.Message { - mi := &file_subjectmapping_subject_mapping_proto_msgTypes[8] + mi := &file_subjectmapping_subject_mapping_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -558,7 +613,14 @@ func (x *UpdateSubjectMappingResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use UpdateSubjectMappingResponse.ProtoReflect.Descriptor instead. func (*UpdateSubjectMappingResponse) Descriptor() ([]byte, []int) { - return file_subjectmapping_subject_mapping_proto_rawDescGZIP(), []int{8} + return file_subjectmapping_subject_mapping_proto_rawDescGZIP(), []int{9} +} + +func (x *UpdateSubjectMappingResponse) GetSubjectMapping() *SubjectMapping { + if x != nil { + return x.SubjectMapping + } + return nil } type DeleteSubjectMappingRequest struct { @@ -572,7 +634,7 @@ type DeleteSubjectMappingRequest struct { func (x *DeleteSubjectMappingRequest) Reset() { *x = DeleteSubjectMappingRequest{} if protoimpl.UnsafeEnabled { - mi := &file_subjectmapping_subject_mapping_proto_msgTypes[9] + mi := &file_subjectmapping_subject_mapping_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -585,7 +647,7 @@ func (x *DeleteSubjectMappingRequest) String() string { func (*DeleteSubjectMappingRequest) ProtoMessage() {} func (x *DeleteSubjectMappingRequest) ProtoReflect() protoreflect.Message { - mi := &file_subjectmapping_subject_mapping_proto_msgTypes[9] + mi := &file_subjectmapping_subject_mapping_proto_msgTypes[10] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -598,7 +660,7 @@ func (x *DeleteSubjectMappingRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use DeleteSubjectMappingRequest.ProtoReflect.Descriptor instead. func (*DeleteSubjectMappingRequest) Descriptor() ([]byte, []int) { - return file_subjectmapping_subject_mapping_proto_rawDescGZIP(), []int{9} + return file_subjectmapping_subject_mapping_proto_rawDescGZIP(), []int{10} } func (x *DeleteSubjectMappingRequest) GetId() string { @@ -612,12 +674,14 @@ type DeleteSubjectMappingResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + + SubjectMapping *SubjectMapping `protobuf:"bytes,1,opt,name=subject_mapping,json=subjectMapping,proto3" json:"subject_mapping,omitempty"` } func (x *DeleteSubjectMappingResponse) Reset() { *x = DeleteSubjectMappingResponse{} if protoimpl.UnsafeEnabled { - mi := &file_subjectmapping_subject_mapping_proto_msgTypes[10] + mi := &file_subjectmapping_subject_mapping_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -630,7 +694,7 @@ func (x *DeleteSubjectMappingResponse) String() string { func (*DeleteSubjectMappingResponse) ProtoMessage() {} func (x *DeleteSubjectMappingResponse) ProtoReflect() protoreflect.Message { - mi := &file_subjectmapping_subject_mapping_proto_msgTypes[10] + mi := &file_subjectmapping_subject_mapping_proto_msgTypes[11] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -643,7 +707,14 @@ func (x *DeleteSubjectMappingResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use DeleteSubjectMappingResponse.ProtoReflect.Descriptor instead. func (*DeleteSubjectMappingResponse) Descriptor() ([]byte, []int) { - return file_subjectmapping_subject_mapping_proto_rawDescGZIP(), []int{10} + return file_subjectmapping_subject_mapping_proto_rawDescGZIP(), []int{11} +} + +func (x *DeleteSubjectMappingResponse) GetSubjectMapping() *SubjectMapping { + if x != nil { + return x.SubjectMapping + } + return nil } var File_subjectmapping_subject_mapping_proto protoreflect.FileDescriptor @@ -652,144 +723,181 @@ var file_subjectmapping_subject_mapping_proto_rawDesc = []byte{ 0x0a, 0x24, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x2f, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x6d, - 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x1a, 0x1b, 0x62, 0x75, 0x66, 0x2f, 0x76, 0x61, 0x6c, 0x69, - 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x1a, 0x13, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, - 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xc2, 0x03, 0x0a, 0x0e, 0x53, 0x75, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x12, 0x2c, 0x0a, 0x08, 0x6d, 0x65, 0x74, - 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x6f, - 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x2c, 0x0a, 0x12, 0x61, 0x74, 0x74, 0x72, 0x69, - 0x62, 0x75, 0x74, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x10, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x49, 0x64, 0x12, 0x2b, 0x0a, 0x11, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, - 0x5f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x10, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, - 0x74, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0d, 0x73, 0x75, 0x62, 0x6a, - 0x65, 0x63, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x62, 0x0a, 0x08, 0x6f, 0x70, 0x65, - 0x72, 0x61, 0x74, 0x6f, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x39, 0x2e, 0x73, 0x75, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x2e, 0x53, 0x75, 0x62, - 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x2e, 0x53, 0x75, 0x62, 0x6a, - 0x65, 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, - 0x6f, 0x72, 0x45, 0x6e, 0x75, 0x6d, 0x42, 0x0b, 0xba, 0x48, 0x08, 0xc8, 0x01, 0x01, 0x82, 0x01, - 0x02, 0x10, 0x01, 0x52, 0x08, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x22, 0x9b, 0x01, - 0x0a, 0x1a, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, - 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x2d, 0x0a, 0x29, - 0x53, 0x55, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x4d, 0x41, 0x50, 0x50, 0x49, 0x4e, 0x47, 0x5f, - 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x4f, 0x52, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x55, 0x4e, - 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x24, 0x0a, 0x20, 0x53, - 0x55, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x4d, 0x41, 0x50, 0x50, 0x49, 0x4e, 0x47, 0x5f, 0x4f, - 0x50, 0x45, 0x52, 0x41, 0x54, 0x4f, 0x52, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x49, 0x4e, 0x10, - 0x01, 0x12, 0x28, 0x0a, 0x24, 0x53, 0x55, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x4d, 0x41, 0x50, - 0x50, 0x49, 0x4e, 0x47, 0x5f, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x4f, 0x52, 0x5f, 0x45, 0x4e, - 0x55, 0x4d, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x49, 0x4e, 0x10, 0x02, 0x22, 0x32, 0x0a, 0x18, 0x47, - 0x65, 0x74, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x42, 0x06, 0xba, 0x48, 0x03, 0xc8, 0x01, 0x01, 0x52, 0x02, 0x69, 0x64, 0x22, - 0x64, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, 0x70, - 0x70, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x0f, - 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x6d, + 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x1a, 0x1b, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, + 0x65, 0x73, 0x2f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x62, 0x75, 0x66, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, + 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x1a, 0x13, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, + 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x22, 0xb3, 0x02, 0x0a, 0x0e, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, + 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x2c, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, + 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0x12, 0x3a, 0x0a, 0x0f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, + 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, + 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x2e, 0x56, 0x61, 0x6c, 0x75, 0x65, + 0x52, 0x0e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, + 0x12, 0x2b, 0x0a, 0x11, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x61, 0x74, 0x74, 0x72, + 0x69, 0x62, 0x75, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x73, 0x75, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x12, 0x25, 0x0a, + 0x0e, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, + 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0d, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x56, 0x61, + 0x6c, 0x75, 0x65, 0x73, 0x12, 0x53, 0x0a, 0x08, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2a, 0x2e, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x2e, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, + 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x45, 0x6e, + 0x75, 0x6d, 0x42, 0x0b, 0xba, 0x48, 0x08, 0xc8, 0x01, 0x01, 0x82, 0x01, 0x02, 0x10, 0x01, 0x52, + 0x08, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x22, 0xa8, 0x02, 0x0a, 0x1a, 0x53, 0x75, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x33, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x63, 0x6f, 0x6d, + 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4d, 0x75, 0x74, 0x61, + 0x62, 0x6c, 0x65, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x2c, 0x0a, + 0x12, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x61, 0x74, 0x74, 0x72, 0x69, + 0x62, 0x75, 0x74, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x49, 0x64, 0x12, 0x2b, 0x0a, 0x11, 0x73, + 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x41, + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x73, 0x75, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, + 0x52, 0x0d, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, + 0x53, 0x0a, 0x08, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x0e, 0x32, 0x2a, 0x2e, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x6d, 0x61, 0x70, 0x70, 0x69, + 0x6e, 0x67, 0x2e, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, + 0x67, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x45, 0x6e, 0x75, 0x6d, 0x42, 0x0b, 0xba, + 0x48, 0x08, 0xc8, 0x01, 0x01, 0x82, 0x01, 0x02, 0x10, 0x01, 0x52, 0x08, 0x6f, 0x70, 0x65, 0x72, + 0x61, 0x74, 0x6f, 0x72, 0x22, 0x32, 0x0a, 0x18, 0x47, 0x65, 0x74, 0x53, 0x75, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x16, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x06, 0xba, 0x48, + 0x03, 0xc8, 0x01, 0x01, 0x52, 0x02, 0x69, 0x64, 0x22, 0x64, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x53, + 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x0f, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x5f, 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, + 0x2e, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x2e, + 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x52, 0x0e, + 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x22, 0x1c, + 0x0a, 0x1a, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, 0x70, + 0x70, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x68, 0x0a, 0x1b, + 0x4c, 0x69, 0x73, 0x74, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, + 0x6e, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x49, 0x0a, 0x10, 0x73, + 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x73, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x2e, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, - 0x70, 0x70, 0x69, 0x6e, 0x67, 0x52, 0x0e, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, - 0x70, 0x70, 0x69, 0x6e, 0x67, 0x22, 0x1c, 0x0a, 0x1a, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x75, 0x62, - 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x22, 0x68, 0x0a, 0x1b, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x75, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x49, 0x0a, 0x10, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x6d, 0x61, - 0x70, 0x70, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x73, + 0x70, 0x70, 0x69, 0x6e, 0x67, 0x52, 0x0f, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, + 0x70, 0x70, 0x69, 0x6e, 0x67, 0x73, 0x22, 0x7a, 0x0a, 0x1b, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x5b, 0x0a, 0x0f, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x5f, 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, + 0x2e, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x2e, + 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x42, 0x06, 0xba, 0x48, 0x03, 0xc8, + 0x01, 0x01, 0x52, 0x0e, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, + 0x6e, 0x67, 0x22, 0x67, 0x0a, 0x1c, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x75, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x47, 0x0a, 0x0f, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x6d, 0x61, + 0x70, 0x70, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x73, 0x75, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x2e, 0x53, 0x75, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x52, 0x0e, 0x73, 0x75, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x22, 0x92, 0x01, 0x0a, 0x1b, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, 0x70, + 0x70, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x02, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x06, 0xba, 0x48, 0x03, 0xc8, 0x01, 0x01, 0x52, + 0x02, 0x69, 0x64, 0x12, 0x5b, 0x0a, 0x0f, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x6d, + 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x2e, 0x53, 0x75, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x52, 0x0f, 0x73, 0x75, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x73, 0x22, 0x6e, 0x0a, - 0x1b, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, - 0x70, 0x70, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x4f, 0x0a, 0x0f, - 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x6d, - 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x2e, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, - 0x70, 0x70, 0x69, 0x6e, 0x67, 0x42, 0x06, 0xba, 0x48, 0x03, 0xc8, 0x01, 0x01, 0x52, 0x0e, 0x73, - 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x22, 0x1e, 0x0a, - 0x1c, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, - 0x70, 0x70, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x86, 0x01, - 0x0a, 0x1b, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, - 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, - 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x06, 0xba, 0x48, 0x03, 0xc8, 0x01, - 0x01, 0x52, 0x02, 0x69, 0x64, 0x12, 0x4f, 0x0a, 0x0f, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, - 0x5f, 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x42, 0x06, 0xba, 0x48, 0x03, 0xc8, 0x01, 0x01, + 0x52, 0x0e, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, + 0x22, 0x67, 0x0a, 0x1c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x47, 0x0a, 0x0f, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x6d, 0x61, 0x70, 0x70, + 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x73, 0x75, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x2e, 0x53, 0x75, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x52, 0x0e, 0x73, 0x75, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x22, 0x35, 0x0a, 0x1b, 0x44, 0x65, 0x6c, + 0x65, 0x74, 0x65, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, + 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x42, 0x06, 0xba, 0x48, 0x03, 0xc8, 0x01, 0x01, 0x52, 0x02, 0x69, 0x64, + 0x22, 0x67, 0x0a, 0x1c, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x47, 0x0a, 0x0f, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x6d, 0x61, 0x70, 0x70, + 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x73, 0x75, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x2e, 0x53, 0x75, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x52, 0x0e, 0x73, 0x75, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x2a, 0x9b, 0x01, 0x0a, 0x1a, 0x53, 0x75, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x4f, 0x70, 0x65, 0x72, + 0x61, 0x74, 0x6f, 0x72, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x2d, 0x0a, 0x29, 0x53, 0x55, 0x42, 0x4a, + 0x45, 0x43, 0x54, 0x5f, 0x4d, 0x41, 0x50, 0x50, 0x49, 0x4e, 0x47, 0x5f, 0x4f, 0x50, 0x45, 0x52, + 0x41, 0x54, 0x4f, 0x52, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, + 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x24, 0x0a, 0x20, 0x53, 0x55, 0x42, 0x4a, 0x45, + 0x43, 0x54, 0x5f, 0x4d, 0x41, 0x50, 0x50, 0x49, 0x4e, 0x47, 0x5f, 0x4f, 0x50, 0x45, 0x52, 0x41, + 0x54, 0x4f, 0x52, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x49, 0x4e, 0x10, 0x01, 0x12, 0x28, 0x0a, + 0x24, 0x53, 0x55, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x4d, 0x41, 0x50, 0x50, 0x49, 0x4e, 0x47, + 0x5f, 0x4f, 0x50, 0x45, 0x52, 0x41, 0x54, 0x4f, 0x52, 0x5f, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x4e, + 0x4f, 0x54, 0x5f, 0x49, 0x4e, 0x10, 0x02, 0x32, 0x87, 0x06, 0x0a, 0x15, 0x53, 0x75, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x12, 0x89, 0x01, 0x0a, 0x13, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x2a, 0x2e, 0x73, 0x75, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, + 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x6d, + 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x75, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x19, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x12, 0x11, 0x2f, 0x73, 0x75, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x2d, 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x88, 0x01, + 0x0a, 0x11, 0x47, 0x65, 0x74, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, + 0x69, 0x6e, 0x67, 0x12, 0x28, 0x2e, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x6d, 0x61, 0x70, + 0x70, 0x69, 0x6e, 0x67, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, + 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, + 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x2e, 0x47, + 0x65, 0x74, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x18, + 0x12, 0x16, 0x2f, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2d, 0x6d, 0x61, 0x70, 0x70, 0x69, + 0x6e, 0x67, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x12, 0x9d, 0x01, 0x0a, 0x14, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, + 0x67, 0x12, 0x2b, 0x2e, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x6d, 0x61, 0x70, 0x70, 0x69, + 0x6e, 0x67, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x2e, - 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x42, 0x06, - 0xba, 0x48, 0x03, 0xc8, 0x01, 0x01, 0x52, 0x0e, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, - 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x22, 0x1e, 0x0a, 0x1c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x35, 0x0a, 0x1b, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, - 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x42, 0x06, 0xba, 0x48, 0x03, 0xc8, 0x01, 0x01, 0x52, 0x02, 0x69, 0x64, 0x22, 0x1e, 0x0a, - 0x1c, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, - 0x70, 0x70, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x87, 0x06, - 0x0a, 0x15, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, - 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x89, 0x01, 0x0a, 0x13, 0x4c, 0x69, 0x73, 0x74, - 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x73, 0x12, - 0x2a, 0x2e, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, - 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, - 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x73, 0x75, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x2e, 0x4c, 0x69, 0x73, - 0x74, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x73, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x19, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, - 0x12, 0x11, 0x2f, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2d, 0x6d, 0x61, 0x70, 0x70, 0x69, - 0x6e, 0x67, 0x73, 0x12, 0x88, 0x01, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x53, 0x75, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x12, 0x28, 0x2e, 0x73, 0x75, 0x62, 0x6a, - 0x65, 0x63, 0x74, 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x75, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, 0x70, + 0x70, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2a, 0x82, 0xd3, + 0xe4, 0x93, 0x02, 0x24, 0x3a, 0x0f, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x6d, 0x61, + 0x70, 0x70, 0x69, 0x6e, 0x67, 0x22, 0x11, 0x2f, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2d, + 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x73, 0x12, 0xa2, 0x01, 0x0a, 0x14, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, + 0x67, 0x12, 0x2b, 0x2e, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x6d, 0x61, 0x70, 0x70, 0x69, + 0x6e, 0x67, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, + 0x2e, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x2e, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, 0x70, + 0x70, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2f, 0x82, 0xd3, + 0xe4, 0x93, 0x02, 0x29, 0x3a, 0x0f, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x6d, 0x61, + 0x70, 0x70, 0x69, 0x6e, 0x67, 0x22, 0x16, 0x2f, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2d, + 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x12, 0x91, 0x01, + 0x0a, 0x14, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, + 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x12, 0x2b, 0x2e, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x6d, 0x61, 0x70, - 0x70, 0x69, 0x6e, 0x67, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, - 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1e, - 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x18, 0x12, 0x16, 0x2f, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, - 0x2d, 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x12, 0x9d, - 0x01, 0x0a, 0x14, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, - 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x12, 0x2b, 0x2e, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, - 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x6d, 0x61, - 0x70, 0x70, 0x69, 0x6e, 0x67, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x75, 0x62, 0x6a, - 0x65, 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x2a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x24, 0x3a, 0x0f, 0x73, 0x75, 0x62, 0x6a, - 0x65, 0x63, 0x74, 0x5f, 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x22, 0x11, 0x2f, 0x73, 0x75, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2d, 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x73, 0x12, 0xa2, - 0x01, 0x0a, 0x14, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, - 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x12, 0x2b, 0x2e, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, - 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x6d, 0x61, - 0x70, 0x70, 0x69, 0x6e, 0x67, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x62, 0x6a, - 0x65, 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x2f, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x29, 0x3a, 0x0f, 0x73, 0x75, 0x62, 0x6a, - 0x65, 0x63, 0x74, 0x5f, 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x22, 0x16, 0x2f, 0x73, 0x75, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2d, 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x73, 0x2f, 0x7b, - 0x69, 0x64, 0x7d, 0x12, 0x91, 0x01, 0x0a, 0x14, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x75, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x12, 0x2b, 0x2e, 0x73, - 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x2e, 0x44, 0x65, - 0x6c, 0x65, 0x74, 0x65, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, - 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x73, 0x75, 0x62, 0x6a, - 0x65, 0x63, 0x74, 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, - 0x65, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x18, 0x2a, - 0x16, 0x2f, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2d, 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, - 0x67, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x42, 0xb7, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, - 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x42, 0x13, - 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x64, 0x66, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x64, - 0x66, 0x2d, 0x76, 0x32, 0x2d, 0x70, 0x6f, 0x63, 0x2f, 0x73, 0x64, 0x6b, 0x2f, 0x73, 0x75, 0x62, - 0x6a, 0x65, 0x63, 0x74, 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0xa2, 0x02, 0x03, 0x53, 0x58, - 0x58, 0xaa, 0x02, 0x0e, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x6d, 0x61, 0x70, 0x70, 0x69, - 0x6e, 0x67, 0xca, 0x02, 0x0e, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x6d, 0x61, 0x70, 0x70, - 0x69, 0x6e, 0x67, 0xe2, 0x02, 0x1a, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x6d, 0x61, 0x70, - 0x70, 0x69, 0x6e, 0x67, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0xea, 0x02, 0x0e, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, - 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x6d, 0x61, 0x70, + 0x70, 0x69, 0x6e, 0x67, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x75, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x1e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x18, 0x2a, 0x16, 0x2f, 0x73, 0x75, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x2d, 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x73, 0x2f, 0x7b, 0x69, 0x64, + 0x7d, 0x42, 0xb7, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x42, 0x13, 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, + 0x34, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x70, 0x65, 0x6e, + 0x74, 0x64, 0x66, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x64, 0x66, 0x2d, 0x76, 0x32, 0x2d, 0x70, + 0x6f, 0x63, 0x2f, 0x73, 0x64, 0x6b, 0x2f, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x6d, 0x61, + 0x70, 0x70, 0x69, 0x6e, 0x67, 0xa2, 0x02, 0x03, 0x53, 0x58, 0x58, 0xaa, 0x02, 0x0e, 0x53, 0x75, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0xca, 0x02, 0x0e, 0x53, + 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0xe2, 0x02, 0x1a, + 0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x5c, 0x47, + 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, 0x53, 0x75, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( @@ -805,44 +913,53 @@ func file_subjectmapping_subject_mapping_proto_rawDescGZIP() []byte { } var file_subjectmapping_subject_mapping_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_subjectmapping_subject_mapping_proto_msgTypes = make([]protoimpl.MessageInfo, 11) +var file_subjectmapping_subject_mapping_proto_msgTypes = make([]protoimpl.MessageInfo, 12) var file_subjectmapping_subject_mapping_proto_goTypes = []interface{}{ - (SubjectMapping_SubjectMappingOperatorEnum)(0), // 0: subjectmapping.SubjectMapping.SubjectMappingOperatorEnum - (*SubjectMapping)(nil), // 1: subjectmapping.SubjectMapping - (*GetSubjectMappingRequest)(nil), // 2: subjectmapping.GetSubjectMappingRequest - (*GetSubjectMappingResponse)(nil), // 3: subjectmapping.GetSubjectMappingResponse - (*ListSubjectMappingsRequest)(nil), // 4: subjectmapping.ListSubjectMappingsRequest - (*ListSubjectMappingsResponse)(nil), // 5: subjectmapping.ListSubjectMappingsResponse - (*CreateSubjectMappingRequest)(nil), // 6: subjectmapping.CreateSubjectMappingRequest - (*CreateSubjectMappingResponse)(nil), // 7: subjectmapping.CreateSubjectMappingResponse - (*UpdateSubjectMappingRequest)(nil), // 8: subjectmapping.UpdateSubjectMappingRequest - (*UpdateSubjectMappingResponse)(nil), // 9: subjectmapping.UpdateSubjectMappingResponse - (*DeleteSubjectMappingRequest)(nil), // 10: subjectmapping.DeleteSubjectMappingRequest - (*DeleteSubjectMappingResponse)(nil), // 11: subjectmapping.DeleteSubjectMappingResponse - (*common.Metadata)(nil), // 12: common.Metadata + (SubjectMappingOperatorEnum)(0), // 0: subjectmapping.SubjectMappingOperatorEnum + (*SubjectMapping)(nil), // 1: subjectmapping.SubjectMapping + (*SubjectMappingCreateUpdate)(nil), // 2: subjectmapping.SubjectMappingCreateUpdate + (*GetSubjectMappingRequest)(nil), // 3: subjectmapping.GetSubjectMappingRequest + (*GetSubjectMappingResponse)(nil), // 4: subjectmapping.GetSubjectMappingResponse + (*ListSubjectMappingsRequest)(nil), // 5: subjectmapping.ListSubjectMappingsRequest + (*ListSubjectMappingsResponse)(nil), // 6: subjectmapping.ListSubjectMappingsResponse + (*CreateSubjectMappingRequest)(nil), // 7: subjectmapping.CreateSubjectMappingRequest + (*CreateSubjectMappingResponse)(nil), // 8: subjectmapping.CreateSubjectMappingResponse + (*UpdateSubjectMappingRequest)(nil), // 9: subjectmapping.UpdateSubjectMappingRequest + (*UpdateSubjectMappingResponse)(nil), // 10: subjectmapping.UpdateSubjectMappingResponse + (*DeleteSubjectMappingRequest)(nil), // 11: subjectmapping.DeleteSubjectMappingRequest + (*DeleteSubjectMappingResponse)(nil), // 12: subjectmapping.DeleteSubjectMappingResponse + (*common.Metadata)(nil), // 13: common.Metadata + (*attributes.Value)(nil), // 14: attributes.Value + (*common.MetadataMutable)(nil), // 15: common.MetadataMutable } var file_subjectmapping_subject_mapping_proto_depIdxs = []int32{ - 12, // 0: subjectmapping.SubjectMapping.metadata:type_name -> common.Metadata - 0, // 1: subjectmapping.SubjectMapping.operator:type_name -> subjectmapping.SubjectMapping.SubjectMappingOperatorEnum - 1, // 2: subjectmapping.GetSubjectMappingResponse.subject_mapping:type_name -> subjectmapping.SubjectMapping - 1, // 3: subjectmapping.ListSubjectMappingsResponse.subject_mappings:type_name -> subjectmapping.SubjectMapping - 1, // 4: subjectmapping.CreateSubjectMappingRequest.subject_mapping:type_name -> subjectmapping.SubjectMapping - 1, // 5: subjectmapping.UpdateSubjectMappingRequest.subject_mapping:type_name -> subjectmapping.SubjectMapping - 4, // 6: subjectmapping.SubjectMappingService.ListSubjectMappings:input_type -> subjectmapping.ListSubjectMappingsRequest - 2, // 7: subjectmapping.SubjectMappingService.GetSubjectMapping:input_type -> subjectmapping.GetSubjectMappingRequest - 6, // 8: subjectmapping.SubjectMappingService.CreateSubjectMapping:input_type -> subjectmapping.CreateSubjectMappingRequest - 8, // 9: subjectmapping.SubjectMappingService.UpdateSubjectMapping:input_type -> subjectmapping.UpdateSubjectMappingRequest - 10, // 10: subjectmapping.SubjectMappingService.DeleteSubjectMapping:input_type -> subjectmapping.DeleteSubjectMappingRequest - 5, // 11: subjectmapping.SubjectMappingService.ListSubjectMappings:output_type -> subjectmapping.ListSubjectMappingsResponse - 3, // 12: subjectmapping.SubjectMappingService.GetSubjectMapping:output_type -> subjectmapping.GetSubjectMappingResponse - 7, // 13: subjectmapping.SubjectMappingService.CreateSubjectMapping:output_type -> subjectmapping.CreateSubjectMappingResponse - 9, // 14: subjectmapping.SubjectMappingService.UpdateSubjectMapping:output_type -> subjectmapping.UpdateSubjectMappingResponse - 11, // 15: subjectmapping.SubjectMappingService.DeleteSubjectMapping:output_type -> subjectmapping.DeleteSubjectMappingResponse - 11, // [11:16] is the sub-list for method output_type - 6, // [6:11] is the sub-list for method input_type - 6, // [6:6] is the sub-list for extension type_name - 6, // [6:6] is the sub-list for extension extendee - 0, // [0:6] is the sub-list for field type_name + 13, // 0: subjectmapping.SubjectMapping.metadata:type_name -> common.Metadata + 14, // 1: subjectmapping.SubjectMapping.attribute_value:type_name -> attributes.Value + 0, // 2: subjectmapping.SubjectMapping.operator:type_name -> subjectmapping.SubjectMappingOperatorEnum + 15, // 3: subjectmapping.SubjectMappingCreateUpdate.metadata:type_name -> common.MetadataMutable + 0, // 4: subjectmapping.SubjectMappingCreateUpdate.operator:type_name -> subjectmapping.SubjectMappingOperatorEnum + 1, // 5: subjectmapping.GetSubjectMappingResponse.subject_mapping:type_name -> subjectmapping.SubjectMapping + 1, // 6: subjectmapping.ListSubjectMappingsResponse.subject_mappings:type_name -> subjectmapping.SubjectMapping + 2, // 7: subjectmapping.CreateSubjectMappingRequest.subject_mapping:type_name -> subjectmapping.SubjectMappingCreateUpdate + 1, // 8: subjectmapping.CreateSubjectMappingResponse.subject_mapping:type_name -> subjectmapping.SubjectMapping + 2, // 9: subjectmapping.UpdateSubjectMappingRequest.subject_mapping:type_name -> subjectmapping.SubjectMappingCreateUpdate + 1, // 10: subjectmapping.UpdateSubjectMappingResponse.subject_mapping:type_name -> subjectmapping.SubjectMapping + 1, // 11: subjectmapping.DeleteSubjectMappingResponse.subject_mapping:type_name -> subjectmapping.SubjectMapping + 5, // 12: subjectmapping.SubjectMappingService.ListSubjectMappings:input_type -> subjectmapping.ListSubjectMappingsRequest + 3, // 13: subjectmapping.SubjectMappingService.GetSubjectMapping:input_type -> subjectmapping.GetSubjectMappingRequest + 7, // 14: subjectmapping.SubjectMappingService.CreateSubjectMapping:input_type -> subjectmapping.CreateSubjectMappingRequest + 9, // 15: subjectmapping.SubjectMappingService.UpdateSubjectMapping:input_type -> subjectmapping.UpdateSubjectMappingRequest + 11, // 16: subjectmapping.SubjectMappingService.DeleteSubjectMapping:input_type -> subjectmapping.DeleteSubjectMappingRequest + 6, // 17: subjectmapping.SubjectMappingService.ListSubjectMappings:output_type -> subjectmapping.ListSubjectMappingsResponse + 4, // 18: subjectmapping.SubjectMappingService.GetSubjectMapping:output_type -> subjectmapping.GetSubjectMappingResponse + 8, // 19: subjectmapping.SubjectMappingService.CreateSubjectMapping:output_type -> subjectmapping.CreateSubjectMappingResponse + 10, // 20: subjectmapping.SubjectMappingService.UpdateSubjectMapping:output_type -> subjectmapping.UpdateSubjectMappingResponse + 12, // 21: subjectmapping.SubjectMappingService.DeleteSubjectMapping:output_type -> subjectmapping.DeleteSubjectMappingResponse + 17, // [17:22] is the sub-list for method output_type + 12, // [12:17] is the sub-list for method input_type + 12, // [12:12] is the sub-list for extension type_name + 12, // [12:12] is the sub-list for extension extendee + 0, // [0:12] is the sub-list for field type_name } func init() { file_subjectmapping_subject_mapping_proto_init() } @@ -864,7 +981,7 @@ func file_subjectmapping_subject_mapping_proto_init() { } } file_subjectmapping_subject_mapping_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetSubjectMappingRequest); i { + switch v := v.(*SubjectMappingCreateUpdate); i { case 0: return &v.state case 1: @@ -876,7 +993,7 @@ func file_subjectmapping_subject_mapping_proto_init() { } } file_subjectmapping_subject_mapping_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetSubjectMappingResponse); i { + switch v := v.(*GetSubjectMappingRequest); i { case 0: return &v.state case 1: @@ -888,7 +1005,7 @@ func file_subjectmapping_subject_mapping_proto_init() { } } file_subjectmapping_subject_mapping_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListSubjectMappingsRequest); i { + switch v := v.(*GetSubjectMappingResponse); i { case 0: return &v.state case 1: @@ -900,7 +1017,7 @@ func file_subjectmapping_subject_mapping_proto_init() { } } file_subjectmapping_subject_mapping_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListSubjectMappingsResponse); i { + switch v := v.(*ListSubjectMappingsRequest); i { case 0: return &v.state case 1: @@ -912,7 +1029,7 @@ func file_subjectmapping_subject_mapping_proto_init() { } } file_subjectmapping_subject_mapping_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CreateSubjectMappingRequest); i { + switch v := v.(*ListSubjectMappingsResponse); i { case 0: return &v.state case 1: @@ -924,7 +1041,7 @@ func file_subjectmapping_subject_mapping_proto_init() { } } file_subjectmapping_subject_mapping_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CreateSubjectMappingResponse); i { + switch v := v.(*CreateSubjectMappingRequest); i { case 0: return &v.state case 1: @@ -936,7 +1053,7 @@ func file_subjectmapping_subject_mapping_proto_init() { } } file_subjectmapping_subject_mapping_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateSubjectMappingRequest); i { + switch v := v.(*CreateSubjectMappingResponse); i { case 0: return &v.state case 1: @@ -948,7 +1065,7 @@ func file_subjectmapping_subject_mapping_proto_init() { } } file_subjectmapping_subject_mapping_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateSubjectMappingResponse); i { + switch v := v.(*UpdateSubjectMappingRequest); i { case 0: return &v.state case 1: @@ -960,7 +1077,7 @@ func file_subjectmapping_subject_mapping_proto_init() { } } file_subjectmapping_subject_mapping_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeleteSubjectMappingRequest); i { + switch v := v.(*UpdateSubjectMappingResponse); i { case 0: return &v.state case 1: @@ -972,6 +1089,18 @@ func file_subjectmapping_subject_mapping_proto_init() { } } file_subjectmapping_subject_mapping_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteSubjectMappingRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_subjectmapping_subject_mapping_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DeleteSubjectMappingResponse); i { case 0: return &v.state @@ -990,7 +1119,7 @@ func file_subjectmapping_subject_mapping_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_subjectmapping_subject_mapping_proto_rawDesc, NumEnums: 1, - NumMessages: 11, + NumMessages: 12, NumExtensions: 0, NumServices: 1, }, diff --git a/services/acse/acse.gox b/services/acse/acse.gox deleted file mode 100644 index f8d1fe629f..0000000000 --- a/services/acse/acse.gox +++ /dev/null @@ -1,188 +0,0 @@ -package acse - -import ( - "context" - "errors" - "fmt" - "log/slog" - - "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" - "github.com/jackc/pgx/v5" - "github.com/opentdf/opentdf-v2-poc/internal/db" - "github.com/opentdf/opentdf-v2-poc/sdk/acse" - "github.com/opentdf/opentdf-v2-poc/sdk/common" - - "github.com/opentdf/opentdf-v2-poc/services" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - "google.golang.org/protobuf/encoding/protojson" -) - -type SubjectEncodingService struct { - acse.UnimplementedSubjectEncodingServiceServer - dbClient *db.Client -} - -func NewSubjectEncodingServer(dbClient *db.Client, grpcServer *grpc.Server, - grpcInprocess *grpc.Server, mux *runtime.ServeMux) error { - as := &SubjectEncodingService{ - dbClient: dbClient, - } - acse.RegisterSubjectEncodingServiceServer(grpcServer, as) - if grpcInprocess != nil { - acse.RegisterSubjectEncodingServiceServer(grpcInprocess, as) - } - err := acse.RegisterSubjectEncodingServiceHandlerServer(context.Background(), mux, as) - if err != nil { - return fmt.Errorf("failed to register subject encoding service handler: %w", err) - } - return nil -} - -func (s SubjectEncodingService) CreateSubjectMapping(ctx context.Context, - req *acse.CreateSubjectMappingRequest) (*acse.CreateSubjectMappingResponse, error) { - slog.Debug("creating subject mapping") - - resource, err := protojson.Marshal(req.SubjectMapping) - if err != nil { - return &acse.CreateSubjectMappingResponse{}, - status.Error(codes.Internal, services.ErrCreatingResource) - } - - err = s.dbClient.CreateResource(ctx, req.SubjectMapping.Descriptor_, resource) - if err != nil { - slog.Error(services.ErrCreatingResource, slog.String("error", err.Error())) - return &acse.CreateSubjectMappingResponse{}, status.Error(codes.Internal, - fmt.Sprintf("%v: %v", services.ErrCreatingResource, err)) - } - - return &acse.CreateSubjectMappingResponse{}, nil -} - -func (s SubjectEncodingService) ListSubjectMappings(ctx context.Context, - req *acse.ListSubjectMappingsRequest) (*acse.ListSubjectMappingsResponse, error) { - mappings := &acse.ListSubjectMappingsResponse{} - - rows, err := s.dbClient.ListResources( - ctx, - common.PolicyResourceType_POLICY_RESOURCE_TYPE_SUBJECT_ENCODING_MAPPING.String(), - req.Selector, - ) - if err != nil { - slog.Error(services.ErrListingResource, slog.String("error", err.Error())) - return mappings, status.Error(codes.Internal, services.ErrListingResource) - } - defer rows.Close() - - for rows.Next() { - var ( - id int32 - mapping = new(acse.SubjectMapping) - bMapping []byte - ) - err = rows.Scan(&id, &bMapping) - if err != nil { - slog.Error(services.ErrListingResource, slog.String("error", err.Error())) - return mappings, status.Error(codes.Internal, services.ErrListingResource) - } - - err = protojson.Unmarshal(bMapping, mapping) - if err != nil { - slog.Error(services.ErrListingResource, slog.String("error", err.Error())) - return mappings, status.Error(codes.Internal, services.ErrListingResource) - } - - mapping.Descriptor_.Id = id - mappings.SubjectMappings = append(mappings.SubjectMappings, mapping) - } - - if err := rows.Err(); err != nil { - slog.Error(services.ErrListingResource, slog.String("error", err.Error())) - return mappings, status.Error(codes.Internal, services.ErrListingResource) - } - - if err := rows.Err(); err != nil { - slog.Error(services.ErrListingResource, slog.String("error", err.Error())) - return mappings, status.Error(codes.Internal, services.ErrListingResource) - } - - return mappings, nil -} - -func (s SubjectEncodingService) GetSubjectMapping(ctx context.Context, - req *acse.GetSubjectMappingRequest) (*acse.GetSubjectMappingResponse, error) { - var ( - mapping = &acse.GetSubjectMappingResponse{ - SubjectMapping: new(acse.SubjectMapping), - } - id int32 - bMapping []byte - ) - - row, err := s.dbClient.GetResource( - ctx, - req.Id, - common.PolicyResourceType_POLICY_RESOURCE_TYPE_SUBJECT_ENCODING_MAPPING.String(), - ) - if err != nil { - slog.Error(services.ErrGettingResource, slog.String("error", err.Error())) - return mapping, status.Error(codes.Internal, services.ErrGettingResource) - } - - err = row.Scan(&id, &bMapping) - if err != nil { - if errors.Is(err, pgx.ErrNoRows) { - slog.Info(services.ErrNotFound, slog.Int("id", int(req.Id))) - return mapping, status.Error(codes.NotFound, services.ErrNotFound) - } - slog.Error(services.ErrGettingResource, slog.String("error", err.Error())) - return mapping, status.Error(codes.Internal, services.ErrGettingResource) - } - - err = protojson.Unmarshal(bMapping, mapping.SubjectMapping) - if err != nil { - slog.Error(services.ErrGettingResource, slog.String("error", err.Error())) - return mapping, status.Error(codes.Internal, services.ErrGettingResource) - } - - mapping.SubjectMapping.Descriptor_.Id = id - - return mapping, nil -} - -func (s SubjectEncodingService) UpdateSubjectMapping(ctx context.Context, - req *acse.UpdateSubjectMappingRequest) (*acse.UpdateSubjectMappingResponse, error) { - resource, err := protojson.Marshal(req.SubjectMapping) - if err != nil { - return &acse.UpdateSubjectMappingResponse{}, - status.Error(codes.Internal, services.ErrCreatingResource) - } - - err = s.dbClient.UpdateResource( - ctx, - req.SubjectMapping.Descriptor_, - resource, - common.PolicyResourceType_POLICY_RESOURCE_TYPE_SUBJECT_ENCODING_MAPPING.String(), - ) - if err != nil { - slog.Error(services.ErrUpdatingResource, slog.String("error", err.Error())) - return &acse.UpdateSubjectMappingResponse{}, - status.Error(codes.Internal, services.ErrUpdatingResource) - } - return &acse.UpdateSubjectMappingResponse{}, nil -} - -func (s SubjectEncodingService) DeleteSubjectMapping(ctx context.Context, - req *acse.DeleteSubjectMappingRequest) (*acse.DeleteSubjectMappingResponse, error) { - if err := s.dbClient.DeleteResource( - ctx, - req.Id, - common.PolicyResourceType_POLICY_RESOURCE_TYPE_SUBJECT_ENCODING_MAPPING.String(), - ); err != nil { - slog.Error(services.ErrDeletingResource, slog.String("error", err.Error())) - return &acse.DeleteSubjectMappingResponse{}, - status.Error(codes.Internal, services.ErrDeletingResource) - } - return &acse.DeleteSubjectMappingResponse{}, nil -} diff --git a/services/acse/acse_test.gox b/services/subjectmapping/acse_test.gox similarity index 100% rename from services/acse/acse_test.gox rename to services/subjectmapping/acse_test.gox diff --git a/services/subjectmapping/subjectmapping.go b/services/subjectmapping/subjectmapping.go new file mode 100644 index 0000000000..56953133f7 --- /dev/null +++ b/services/subjectmapping/subjectmapping.go @@ -0,0 +1,117 @@ +package subjectmapping + +import ( + "context" + "errors" + "fmt" + "log/slog" + + "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" + "github.com/jackc/pgx/v5" + "github.com/opentdf/opentdf-v2-poc/internal/db" + "github.com/opentdf/opentdf-v2-poc/sdk/subjectmapping" + + "github.com/opentdf/opentdf-v2-poc/services" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type SubjectMappingService struct { + subjectmapping.UnimplementedSubjectMappingServiceServer + dbClient *db.Client +} + +func NewSubjectMappingServer(dbClient *db.Client, grpcServer *grpc.Server, + grpcInprocess *grpc.Server, mux *runtime.ServeMux) error { + s := &SubjectMappingService{ + dbClient: dbClient, + } + subjectmapping.RegisterSubjectMappingServiceServer(grpcServer, s) + if grpcInprocess != nil { + subjectmapping.RegisterSubjectMappingServiceServer(grpcInprocess, s) + } + err := subjectmapping.RegisterSubjectMappingServiceHandlerServer(context.Background(), mux, s) + if err != nil { + return fmt.Errorf("failed to register subject encoding service handler: %w", err) + } + return nil +} + +func (s SubjectMappingService) CreateSubjectMapping(ctx context.Context, + req *subjectmapping.CreateSubjectMappingRequest) (*subjectmapping.CreateSubjectMappingResponse, error) { + rsp := &subjectmapping.CreateSubjectMappingResponse{} + slog.Debug("creating subject mapping") + + mappings, err := s.dbClient.CreateSubjectMapping(context.Background(), req.SubjectMapping) + if err != nil { + slog.Error(services.ErrCreatingResource, slog.String("error", err.Error())) + return nil, status.Error(codes.Internal, services.ErrCreatingResource) + } + rsp.SubjectMapping = mappings + + return rsp, nil +} + +func (s SubjectMappingService) ListSubjectMappings(ctx context.Context, + req *subjectmapping.ListSubjectMappingsRequest) (*subjectmapping.ListSubjectMappingsResponse, error) { + rsp := &subjectmapping.ListSubjectMappingsResponse{} + + mappings, err := s.dbClient.ListSubjectMappings(ctx) + if err != nil { + slog.Error(services.ErrListingResource, slog.String("error", err.Error())) + return nil, status.Error(codes.Internal, services.ErrListingResource) + } + + rsp.SubjectMappings = mappings + + return rsp, nil +} + +func (s SubjectMappingService) GetSubjectMapping(ctx context.Context, + req *subjectmapping.GetSubjectMappingRequest) (*subjectmapping.GetSubjectMappingResponse, error) { + rsp := &subjectmapping.GetSubjectMappingResponse{} + + mapping, err := s.dbClient.GetSubjectMapping(ctx, req.Id) + if err != nil { + if errors.Is(err, pgx.ErrNoRows) { + return nil, status.Error(codes.NotFound, services.ErrNotFound) + } + slog.Error(services.ErrGettingResource, slog.String("error", err.Error())) + return nil, status.Error(codes.Internal, services.ErrGettingResource) + } + + rsp.SubjectMapping = mapping + + return rsp, nil +} + +func (s SubjectMappingService) UpdateSubjectMapping(ctx context.Context, + req *subjectmapping.UpdateSubjectMappingRequest) (*subjectmapping.UpdateSubjectMappingResponse, error) { + rsp := &subjectmapping.UpdateSubjectMappingResponse{} + + mapping, err := s.dbClient.UpdateSubjectMapping(ctx, req.Id, req.SubjectMapping) + if err != nil { + slog.Error(services.ErrUpdatingResource, slog.String("error", err.Error())) + return nil, status.Error(codes.Internal, services.ErrUpdatingResource) + } + + rsp.SubjectMapping = mapping + + return rsp, nil +} + +func (s SubjectMappingService) DeleteSubjectMapping(ctx context.Context, + req *subjectmapping.DeleteSubjectMappingRequest) (*subjectmapping.DeleteSubjectMappingResponse, error) { + rsp := &subjectmapping.DeleteSubjectMappingResponse{} + + mapping, err := s.dbClient.DeleteSubjectMapping(ctx, req.Id) + if err != nil { + slog.Error(services.ErrDeletingResource, slog.String("error", err.Error())) + return nil, status.Error(codes.Internal, services.ErrDeletingResource) + } + + rsp.SubjectMapping = mapping + + return rsp, nil +} diff --git a/tests/acse_test.go b/tests/acse_test.go deleted file mode 100644 index c8caa626d7..0000000000 --- a/tests/acse_test.go +++ /dev/null @@ -1,37 +0,0 @@ -package tests - -import ( - "testing" - - "github.com/opentdf/opentdf-v2-poc/sdk/acse" - "github.com/stretchr/testify/suite" - "google.golang.org/grpc" - "google.golang.org/grpc/credentials/insecure" -) - -type AcseSuite struct { - suite.Suite - conn *grpc.ClientConn - client acse.SubjectEncodingServiceClient -} - -func (suite *AcseSuite) SetupSuite() { - conn, err := grpc.Dial("localhost:9000", grpc.WithTransportCredentials(insecure.NewCredentials())) - if err != nil { - suite.T().Fatal(err) - } - suite.conn = conn - - suite.client = acse.NewSubjectEncodingServiceClient(conn) -} - -func (suite *AcseSuite) TearDownSuite() { - suite.conn.Close() -} - -func TestAcseSuite(t *testing.T) { - if testing.Short() { - t.Skip("skipping acse integration tests") - } - suite.Run(t, new(AcseSuite)) -} diff --git a/tests/subjectmapping_test.go b/tests/subjectmapping_test.go new file mode 100644 index 0000000000..0795012af0 --- /dev/null +++ b/tests/subjectmapping_test.go @@ -0,0 +1,37 @@ +package tests + +import ( + "testing" + + "github.com/opentdf/opentdf-v2-poc/sdk/subjectmapping" + "github.com/stretchr/testify/suite" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" +) + +type SubjectMappingSuite struct { + suite.Suite + conn *grpc.ClientConn + client subjectmapping.SubjectMappingServiceClient +} + +func (suite *SubjectMappingSuite) SetupSuite() { + conn, err := grpc.Dial("localhost:9000", grpc.WithTransportCredentials(insecure.NewCredentials())) + if err != nil { + suite.T().Fatal(err) + } + suite.conn = conn + + suite.client = subjectmapping.NewSubjectMappingServiceClient(conn) +} + +func (suite *SubjectMappingSuite) TearDownSuite() { + suite.conn.Close() +} + +func TestSubjectMappingSuite(t *testing.T) { + if testing.Short() { + t.Skip("skipping subject mapping integration tests") + } + suite.Run(t, new(SubjectMappingSuite)) +}