diff --git a/buf.gen.yaml b/buf.gen.yaml index b5a437dc58..0e8e6e86ec 100644 --- a/buf.gen.yaml +++ b/buf.gen.yaml @@ -18,3 +18,8 @@ plugins: out: protocol/go opt: - paths=source_relative + - remote: buf.build/connectrpc/go:v2.0.1 + out: protocol/go + opt: + - paths=source_relative + - package_suffix=connectv2 diff --git a/go.work b/go.work index 56bbbff991..530ed0e3d4 100644 --- a/go.work +++ b/go.work @@ -1,6 +1,6 @@ -go 1.25.5 +go 1.26.0 -toolchain go1.25.14 +toolchain go1.26.9 use ( ./lib/fixtures diff --git a/lib/fixtures/go.mod b/lib/fixtures/go.mod index 2a34e8a1b4..4ef0e2a8cf 100644 --- a/lib/fixtures/go.mod +++ b/lib/fixtures/go.mod @@ -1,6 +1,6 @@ module github.com/opentdf/platform/lib/fixtures -go 1.25.0 +go 1.26.0 require github.com/Nerzal/gocloak/v13 v13.9.0 diff --git a/lib/flattening/go.mod b/lib/flattening/go.mod index 7e709fd35a..bb04f1624b 100644 --- a/lib/flattening/go.mod +++ b/lib/flattening/go.mod @@ -1,6 +1,6 @@ module github.com/opentdf/platform/lib/flattening -go 1.25.0 +go 1.26.0 require github.com/stretchr/testify v1.11.1 diff --git a/lib/identifier/go.mod b/lib/identifier/go.mod index f8bac60c76..74edb37215 100644 --- a/lib/identifier/go.mod +++ b/lib/identifier/go.mod @@ -1,6 +1,6 @@ module github.com/opentdf/platform/lib/identifier -go 1.25.0 +go 1.26.0 require github.com/stretchr/testify v1.11.1 diff --git a/lib/ocrypto/go.mod b/lib/ocrypto/go.mod index 98d5837da9..c63bf9c43b 100644 --- a/lib/ocrypto/go.mod +++ b/lib/ocrypto/go.mod @@ -1,6 +1,6 @@ module github.com/opentdf/platform/lib/ocrypto -go 1.25.0 +go 1.26.0 require ( github.com/cloudflare/circl v1.6.3 diff --git a/otdfctl/go.mod b/otdfctl/go.mod index b14ac0db25..dd2316d631 100644 --- a/otdfctl/go.mod +++ b/otdfctl/go.mod @@ -1,6 +1,6 @@ module github.com/opentdf/platform/otdfctl -go 1.25.0 +go 1.26.0 require ( github.com/adrg/frontmatter v0.2.0 diff --git a/protocol/codegen/go.mod b/protocol/codegen/go.mod index 1c11114085..68d61e9845 100644 --- a/protocol/codegen/go.mod +++ b/protocol/codegen/go.mod @@ -1,3 +1,3 @@ module github.com/opentdf/platform/protocol/codegen -go 1.25.5 +go 1.26.0 diff --git a/protocol/codegen/go.work b/protocol/codegen/go.work index 2789a8cc01..bb20e7b2f9 100644 --- a/protocol/codegen/go.work +++ b/protocol/codegen/go.work @@ -1,5 +1,5 @@ // Isolate this module from the root workspace so `go run .` resolves locally // without adding protocol/codegen to the root go.work. -go 1.25.5 +go 1.26.0 use . diff --git a/protocol/go/authorization/authorizationconnectv2/authorization.connect.go b/protocol/go/authorization/authorizationconnectv2/authorization.connect.go new file mode 100644 index 0000000000..20c934ac2f --- /dev/null +++ b/protocol/go/authorization/authorizationconnectv2/authorization.connect.go @@ -0,0 +1,173 @@ +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: authorization/authorization.proto + +package authorizationconnectv2 + +import ( + connect "connectrpc.com/connect/v2" + context "context" + authorization "github.com/opentdf/platform/protocol/go/authorization" + sync "sync" +) + +const ( + // AuthorizationServiceName is the fully-qualified name of the AuthorizationService service. + AuthorizationServiceName = "authorization.AuthorizationService" +) + +// These constants are the procedure names of the RPCs defined in this package. They're exposed at +// runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // AuthorizationServiceGetDecisionsProcedure is the procedure name of the AuthorizationService's + // GetDecisions RPC. + AuthorizationServiceGetDecisionsProcedure = "/authorization.AuthorizationService/GetDecisions" + // AuthorizationServiceGetDecisionsByTokenProcedure is the procedure name of the + // AuthorizationService's GetDecisionsByToken RPC. + AuthorizationServiceGetDecisionsByTokenProcedure = "/authorization.AuthorizationService/GetDecisionsByToken" + // AuthorizationServiceGetEntitlementsProcedure is the procedure name of the AuthorizationService's + // GetEntitlements RPC. + AuthorizationServiceGetEntitlementsProcedure = "/authorization.AuthorizationService/GetEntitlements" +) + +var ( + authorizationServiceGetDecisionsSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: authorization.File_authorization_authorization_proto.Services().ByName("AuthorizationService").Methods().ByName("GetDecisions"), + Procedure: AuthorizationServiceGetDecisionsProcedure, + } + }) + authorizationServiceGetDecisionsByTokenSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: authorization.File_authorization_authorization_proto.Services().ByName("AuthorizationService").Methods().ByName("GetDecisionsByToken"), + Procedure: AuthorizationServiceGetDecisionsByTokenProcedure, + } + }) + authorizationServiceGetEntitlementsSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: authorization.File_authorization_authorization_proto.Services().ByName("AuthorizationService").Methods().ByName("GetEntitlements"), + Procedure: AuthorizationServiceGetEntitlementsProcedure, + } + }) +) + +// AuthorizationServiceClient is a client for the authorization.AuthorizationService service. +type AuthorizationServiceClient interface { + GetDecisions(context.Context, *authorization.GetDecisionsRequest) (*authorization.GetDecisionsResponse, error) + GetDecisionsByToken(context.Context, *authorization.GetDecisionsByTokenRequest) (*authorization.GetDecisionsByTokenResponse, error) + GetEntitlements(context.Context, *authorization.GetEntitlementsRequest) (*authorization.GetEntitlementsResponse, error) +} + +// NewAuthorizationServiceClient constructs a client for the authorization.AuthorizationService +// service. Multiple service clients may share a single connect.Client. +func NewAuthorizationServiceClient(client *connect.Client) AuthorizationServiceClient { + return &authorizationServiceClient{client: client} +} + +// AuthorizationServiceHandler is an implementation of the authorization.AuthorizationService +// service. +type AuthorizationServiceHandler interface { + GetDecisions(context.Context, *authorization.GetDecisionsRequest) (*authorization.GetDecisionsResponse, error) + GetDecisionsByToken(context.Context, *authorization.GetDecisionsByTokenRequest) (*authorization.GetDecisionsByTokenResponse, error) + GetEntitlements(context.Context, *authorization.GetEntitlementsRequest) (*authorization.GetEntitlementsResponse, error) +} + +// RegisterAuthorizationServiceHandler registers svc as the authorization.AuthorizationService +// implementation on server. +func RegisterAuthorizationServiceHandler(server *connect.Server, svc AuthorizationServiceHandler) { + adapter := authorizationServiceHandler{svc: svc} + server.Register( + connect.Method{Spec: authorizationServiceGetDecisionsSpec(), Handler: adapter.getDecisions}, + connect.Method{Spec: authorizationServiceGetDecisionsByTokenSpec(), Handler: adapter.getDecisionsByToken}, + connect.Method{Spec: authorizationServiceGetEntitlementsSpec(), Handler: adapter.getEntitlements}, + ) +} + +// UnimplementedAuthorizationServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedAuthorizationServiceHandler struct{} + +func (UnimplementedAuthorizationServiceHandler) GetDecisions(context.Context, *authorization.GetDecisionsRequest) (*authorization.GetDecisionsResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "authorization.AuthorizationService.GetDecisions is not implemented") +} + +func (UnimplementedAuthorizationServiceHandler) GetDecisionsByToken(context.Context, *authorization.GetDecisionsByTokenRequest) (*authorization.GetDecisionsByTokenResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "authorization.AuthorizationService.GetDecisionsByToken is not implemented") +} + +func (UnimplementedAuthorizationServiceHandler) GetEntitlements(context.Context, *authorization.GetEntitlementsRequest) (*authorization.GetEntitlementsResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "authorization.AuthorizationService.GetEntitlements is not implemented") +} + +type authorizationServiceClient struct { + client *connect.Client +} + +func (c *authorizationServiceClient) GetDecisions(ctx context.Context, req *authorization.GetDecisionsRequest) (*authorization.GetDecisionsResponse, error) { + var res authorization.GetDecisionsResponse + if err := c.client.CallUnary(ctx, authorizationServiceGetDecisionsSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *authorizationServiceClient) GetDecisionsByToken(ctx context.Context, req *authorization.GetDecisionsByTokenRequest) (*authorization.GetDecisionsByTokenResponse, error) { + var res authorization.GetDecisionsByTokenResponse + if err := c.client.CallUnary(ctx, authorizationServiceGetDecisionsByTokenSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *authorizationServiceClient) GetEntitlements(ctx context.Context, req *authorization.GetEntitlementsRequest) (*authorization.GetEntitlementsResponse, error) { + var res authorization.GetEntitlementsResponse + if err := c.client.CallUnary(ctx, authorizationServiceGetEntitlementsSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +type authorizationServiceHandler struct{ svc AuthorizationServiceHandler } + +func (h authorizationServiceHandler) getDecisions(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req authorization.GetDecisionsRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.GetDecisions(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h authorizationServiceHandler) getDecisionsByToken(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req authorization.GetDecisionsByTokenRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.GetDecisionsByToken(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h authorizationServiceHandler) getEntitlements(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req authorization.GetEntitlementsRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.GetEntitlements(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} diff --git a/protocol/go/authorization/v2/authorizationv2connectv2/authorization.connect.go b/protocol/go/authorization/v2/authorizationv2connectv2/authorization.connect.go new file mode 100644 index 0000000000..6e19d12689 --- /dev/null +++ b/protocol/go/authorization/v2/authorizationv2connectv2/authorization.connect.go @@ -0,0 +1,210 @@ +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: authorization/v2/authorization.proto + +package authorizationv2connectv2 + +import ( + connect "connectrpc.com/connect/v2" + context "context" + v2 "github.com/opentdf/platform/protocol/go/authorization/v2" + sync "sync" +) + +const ( + // AuthorizationServiceName is the fully-qualified name of the AuthorizationService service. + AuthorizationServiceName = "authorization.v2.AuthorizationService" +) + +// These constants are the procedure names of the RPCs defined in this package. They're exposed at +// runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // AuthorizationServiceGetDecisionProcedure is the procedure name of the AuthorizationService's + // GetDecision RPC. + AuthorizationServiceGetDecisionProcedure = "/authorization.v2.AuthorizationService/GetDecision" + // AuthorizationServiceGetDecisionMultiResourceProcedure is the procedure name of the + // AuthorizationService's GetDecisionMultiResource RPC. + AuthorizationServiceGetDecisionMultiResourceProcedure = "/authorization.v2.AuthorizationService/GetDecisionMultiResource" + // AuthorizationServiceGetDecisionBulkProcedure is the procedure name of the AuthorizationService's + // GetDecisionBulk RPC. + AuthorizationServiceGetDecisionBulkProcedure = "/authorization.v2.AuthorizationService/GetDecisionBulk" + // AuthorizationServiceGetEntitlementsProcedure is the procedure name of the AuthorizationService's + // GetEntitlements RPC. + AuthorizationServiceGetEntitlementsProcedure = "/authorization.v2.AuthorizationService/GetEntitlements" +) + +var ( + authorizationServiceGetDecisionSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: v2.File_authorization_v2_authorization_proto.Services().ByName("AuthorizationService").Methods().ByName("GetDecision"), + Procedure: AuthorizationServiceGetDecisionProcedure, + } + }) + authorizationServiceGetDecisionMultiResourceSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: v2.File_authorization_v2_authorization_proto.Services().ByName("AuthorizationService").Methods().ByName("GetDecisionMultiResource"), + Procedure: AuthorizationServiceGetDecisionMultiResourceProcedure, + } + }) + authorizationServiceGetDecisionBulkSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: v2.File_authorization_v2_authorization_proto.Services().ByName("AuthorizationService").Methods().ByName("GetDecisionBulk"), + Procedure: AuthorizationServiceGetDecisionBulkProcedure, + } + }) + authorizationServiceGetEntitlementsSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: v2.File_authorization_v2_authorization_proto.Services().ByName("AuthorizationService").Methods().ByName("GetEntitlements"), + Procedure: AuthorizationServiceGetEntitlementsProcedure, + } + }) +) + +// AuthorizationServiceClient is a client for the authorization.v2.AuthorizationService service. +type AuthorizationServiceClient interface { + GetDecision(context.Context, *v2.GetDecisionRequest) (*v2.GetDecisionResponse, error) + GetDecisionMultiResource(context.Context, *v2.GetDecisionMultiResourceRequest) (*v2.GetDecisionMultiResourceResponse, error) + GetDecisionBulk(context.Context, *v2.GetDecisionBulkRequest) (*v2.GetDecisionBulkResponse, error) + GetEntitlements(context.Context, *v2.GetEntitlementsRequest) (*v2.GetEntitlementsResponse, error) +} + +// NewAuthorizationServiceClient constructs a client for the authorization.v2.AuthorizationService +// service. Multiple service clients may share a single connect.Client. +func NewAuthorizationServiceClient(client *connect.Client) AuthorizationServiceClient { + return &authorizationServiceClient{client: client} +} + +// AuthorizationServiceHandler is an implementation of the authorization.v2.AuthorizationService +// service. +type AuthorizationServiceHandler interface { + GetDecision(context.Context, *v2.GetDecisionRequest) (*v2.GetDecisionResponse, error) + GetDecisionMultiResource(context.Context, *v2.GetDecisionMultiResourceRequest) (*v2.GetDecisionMultiResourceResponse, error) + GetDecisionBulk(context.Context, *v2.GetDecisionBulkRequest) (*v2.GetDecisionBulkResponse, error) + GetEntitlements(context.Context, *v2.GetEntitlementsRequest) (*v2.GetEntitlementsResponse, error) +} + +// RegisterAuthorizationServiceHandler registers svc as the authorization.v2.AuthorizationService +// implementation on server. +func RegisterAuthorizationServiceHandler(server *connect.Server, svc AuthorizationServiceHandler) { + adapter := authorizationServiceHandler{svc: svc} + server.Register( + connect.Method{Spec: authorizationServiceGetDecisionSpec(), Handler: adapter.getDecision}, + connect.Method{Spec: authorizationServiceGetDecisionMultiResourceSpec(), Handler: adapter.getDecisionMultiResource}, + connect.Method{Spec: authorizationServiceGetDecisionBulkSpec(), Handler: adapter.getDecisionBulk}, + connect.Method{Spec: authorizationServiceGetEntitlementsSpec(), Handler: adapter.getEntitlements}, + ) +} + +// UnimplementedAuthorizationServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedAuthorizationServiceHandler struct{} + +func (UnimplementedAuthorizationServiceHandler) GetDecision(context.Context, *v2.GetDecisionRequest) (*v2.GetDecisionResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "authorization.v2.AuthorizationService.GetDecision is not implemented") +} + +func (UnimplementedAuthorizationServiceHandler) GetDecisionMultiResource(context.Context, *v2.GetDecisionMultiResourceRequest) (*v2.GetDecisionMultiResourceResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "authorization.v2.AuthorizationService.GetDecisionMultiResource is not implemented") +} + +func (UnimplementedAuthorizationServiceHandler) GetDecisionBulk(context.Context, *v2.GetDecisionBulkRequest) (*v2.GetDecisionBulkResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "authorization.v2.AuthorizationService.GetDecisionBulk is not implemented") +} + +func (UnimplementedAuthorizationServiceHandler) GetEntitlements(context.Context, *v2.GetEntitlementsRequest) (*v2.GetEntitlementsResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "authorization.v2.AuthorizationService.GetEntitlements is not implemented") +} + +type authorizationServiceClient struct { + client *connect.Client +} + +func (c *authorizationServiceClient) GetDecision(ctx context.Context, req *v2.GetDecisionRequest) (*v2.GetDecisionResponse, error) { + var res v2.GetDecisionResponse + if err := c.client.CallUnary(ctx, authorizationServiceGetDecisionSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *authorizationServiceClient) GetDecisionMultiResource(ctx context.Context, req *v2.GetDecisionMultiResourceRequest) (*v2.GetDecisionMultiResourceResponse, error) { + var res v2.GetDecisionMultiResourceResponse + if err := c.client.CallUnary(ctx, authorizationServiceGetDecisionMultiResourceSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *authorizationServiceClient) GetDecisionBulk(ctx context.Context, req *v2.GetDecisionBulkRequest) (*v2.GetDecisionBulkResponse, error) { + var res v2.GetDecisionBulkResponse + if err := c.client.CallUnary(ctx, authorizationServiceGetDecisionBulkSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *authorizationServiceClient) GetEntitlements(ctx context.Context, req *v2.GetEntitlementsRequest) (*v2.GetEntitlementsResponse, error) { + var res v2.GetEntitlementsResponse + if err := c.client.CallUnary(ctx, authorizationServiceGetEntitlementsSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +type authorizationServiceHandler struct{ svc AuthorizationServiceHandler } + +func (h authorizationServiceHandler) getDecision(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req v2.GetDecisionRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.GetDecision(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h authorizationServiceHandler) getDecisionMultiResource(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req v2.GetDecisionMultiResourceRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.GetDecisionMultiResource(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h authorizationServiceHandler) getDecisionBulk(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req v2.GetDecisionBulkRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.GetDecisionBulk(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h authorizationServiceHandler) getEntitlements(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req v2.GetEntitlementsRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.GetEntitlements(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} diff --git a/protocol/go/entityresolution/entityresolutionconnectv2/entity_resolution.connect.go b/protocol/go/entityresolution/entityresolutionconnectv2/entity_resolution.connect.go new file mode 100644 index 0000000000..3fd3e2635d --- /dev/null +++ b/protocol/go/entityresolution/entityresolutionconnectv2/entity_resolution.connect.go @@ -0,0 +1,144 @@ +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: entityresolution/entity_resolution.proto + +package entityresolutionconnectv2 + +import ( + connect "connectrpc.com/connect/v2" + context "context" + entityresolution "github.com/opentdf/platform/protocol/go/entityresolution" + sync "sync" +) + +const ( + // EntityResolutionServiceName is the fully-qualified name of the EntityResolutionService service. + EntityResolutionServiceName = "entityresolution.EntityResolutionService" +) + +// These constants are the procedure names of the RPCs defined in this package. They're exposed at +// runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // EntityResolutionServiceResolveEntitiesProcedure is the procedure name of the + // EntityResolutionService's ResolveEntities RPC. + EntityResolutionServiceResolveEntitiesProcedure = "/entityresolution.EntityResolutionService/ResolveEntities" + // EntityResolutionServiceCreateEntityChainFromJwtProcedure is the procedure name of the + // EntityResolutionService's CreateEntityChainFromJwt RPC. + EntityResolutionServiceCreateEntityChainFromJwtProcedure = "/entityresolution.EntityResolutionService/CreateEntityChainFromJwt" +) + +var ( + entityResolutionServiceResolveEntitiesSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: entityresolution.File_entityresolution_entity_resolution_proto.Services().ByName("EntityResolutionService").Methods().ByName("ResolveEntities"), + Procedure: EntityResolutionServiceResolveEntitiesProcedure, + } + }) + entityResolutionServiceCreateEntityChainFromJwtSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: entityresolution.File_entityresolution_entity_resolution_proto.Services().ByName("EntityResolutionService").Methods().ByName("CreateEntityChainFromJwt"), + Procedure: EntityResolutionServiceCreateEntityChainFromJwtProcedure, + } + }) +) + +// EntityResolutionServiceClient is a client for the entityresolution.EntityResolutionService +// service. +type EntityResolutionServiceClient interface { + // Deprecated: use v2 ResolveEntities instead + ResolveEntities(context.Context, *entityresolution.ResolveEntitiesRequest) (*entityresolution.ResolveEntitiesResponse, error) + // Deprecated: use v2 CreateEntityChainsFromTokens instead + CreateEntityChainFromJwt(context.Context, *entityresolution.CreateEntityChainFromJwtRequest) (*entityresolution.CreateEntityChainFromJwtResponse, error) +} + +// NewEntityResolutionServiceClient constructs a client for the +// entityresolution.EntityResolutionService service. Multiple service clients may share a single +// connect.Client. +func NewEntityResolutionServiceClient(client *connect.Client) EntityResolutionServiceClient { + return &entityResolutionServiceClient{client: client} +} + +// EntityResolutionServiceHandler is an implementation of the +// entityresolution.EntityResolutionService service. +type EntityResolutionServiceHandler interface { + // Deprecated: use v2 ResolveEntities instead + ResolveEntities(context.Context, *entityresolution.ResolveEntitiesRequest) (*entityresolution.ResolveEntitiesResponse, error) + // Deprecated: use v2 CreateEntityChainsFromTokens instead + CreateEntityChainFromJwt(context.Context, *entityresolution.CreateEntityChainFromJwtRequest) (*entityresolution.CreateEntityChainFromJwtResponse, error) +} + +// RegisterEntityResolutionServiceHandler registers svc as the +// entityresolution.EntityResolutionService implementation on server. +func RegisterEntityResolutionServiceHandler(server *connect.Server, svc EntityResolutionServiceHandler) { + adapter := entityResolutionServiceHandler{svc: svc} + server.Register( + connect.Method{Spec: entityResolutionServiceResolveEntitiesSpec(), Handler: adapter.resolveEntities}, + connect.Method{Spec: entityResolutionServiceCreateEntityChainFromJwtSpec(), Handler: adapter.createEntityChainFromJwt}, + ) +} + +// UnimplementedEntityResolutionServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedEntityResolutionServiceHandler struct{} + +func (UnimplementedEntityResolutionServiceHandler) ResolveEntities(context.Context, *entityresolution.ResolveEntitiesRequest) (*entityresolution.ResolveEntitiesResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "entityresolution.EntityResolutionService.ResolveEntities is not implemented") +} + +func (UnimplementedEntityResolutionServiceHandler) CreateEntityChainFromJwt(context.Context, *entityresolution.CreateEntityChainFromJwtRequest) (*entityresolution.CreateEntityChainFromJwtResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "entityresolution.EntityResolutionService.CreateEntityChainFromJwt is not implemented") +} + +type entityResolutionServiceClient struct { + client *connect.Client +} + +func (c *entityResolutionServiceClient) ResolveEntities(ctx context.Context, req *entityresolution.ResolveEntitiesRequest) (*entityresolution.ResolveEntitiesResponse, error) { + var res entityresolution.ResolveEntitiesResponse + if err := c.client.CallUnary(ctx, entityResolutionServiceResolveEntitiesSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *entityResolutionServiceClient) CreateEntityChainFromJwt(ctx context.Context, req *entityresolution.CreateEntityChainFromJwtRequest) (*entityresolution.CreateEntityChainFromJwtResponse, error) { + var res entityresolution.CreateEntityChainFromJwtResponse + if err := c.client.CallUnary(ctx, entityResolutionServiceCreateEntityChainFromJwtSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +type entityResolutionServiceHandler struct { + svc EntityResolutionServiceHandler +} + +func (h entityResolutionServiceHandler) resolveEntities(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req entityresolution.ResolveEntitiesRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.ResolveEntities(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h entityResolutionServiceHandler) createEntityChainFromJwt(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req entityresolution.CreateEntityChainFromJwtRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.CreateEntityChainFromJwt(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} diff --git a/protocol/go/entityresolution/v2/entityresolutionv2connectv2/entity_resolution.connect.go b/protocol/go/entityresolution/v2/entityresolutionv2connectv2/entity_resolution.connect.go new file mode 100644 index 0000000000..5c8aa19a4e --- /dev/null +++ b/protocol/go/entityresolution/v2/entityresolutionv2connectv2/entity_resolution.connect.go @@ -0,0 +1,140 @@ +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: entityresolution/v2/entity_resolution.proto + +package entityresolutionv2connectv2 + +import ( + connect "connectrpc.com/connect/v2" + context "context" + v2 "github.com/opentdf/platform/protocol/go/entityresolution/v2" + sync "sync" +) + +const ( + // EntityResolutionServiceName is the fully-qualified name of the EntityResolutionService service. + EntityResolutionServiceName = "entityresolution.v2.EntityResolutionService" +) + +// These constants are the procedure names of the RPCs defined in this package. They're exposed at +// runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // EntityResolutionServiceResolveEntitiesProcedure is the procedure name of the + // EntityResolutionService's ResolveEntities RPC. + EntityResolutionServiceResolveEntitiesProcedure = "/entityresolution.v2.EntityResolutionService/ResolveEntities" + // EntityResolutionServiceCreateEntityChainsFromTokensProcedure is the procedure name of the + // EntityResolutionService's CreateEntityChainsFromTokens RPC. + EntityResolutionServiceCreateEntityChainsFromTokensProcedure = "/entityresolution.v2.EntityResolutionService/CreateEntityChainsFromTokens" +) + +var ( + entityResolutionServiceResolveEntitiesSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: v2.File_entityresolution_v2_entity_resolution_proto.Services().ByName("EntityResolutionService").Methods().ByName("ResolveEntities"), + Procedure: EntityResolutionServiceResolveEntitiesProcedure, + } + }) + entityResolutionServiceCreateEntityChainsFromTokensSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: v2.File_entityresolution_v2_entity_resolution_proto.Services().ByName("EntityResolutionService").Methods().ByName("CreateEntityChainsFromTokens"), + Procedure: EntityResolutionServiceCreateEntityChainsFromTokensProcedure, + } + }) +) + +// EntityResolutionServiceClient is a client for the entityresolution.v2.EntityResolutionService +// service. +type EntityResolutionServiceClient interface { + ResolveEntities(context.Context, *v2.ResolveEntitiesRequest) (*v2.ResolveEntitiesResponse, error) + CreateEntityChainsFromTokens(context.Context, *v2.CreateEntityChainsFromTokensRequest) (*v2.CreateEntityChainsFromTokensResponse, error) +} + +// NewEntityResolutionServiceClient constructs a client for the +// entityresolution.v2.EntityResolutionService service. Multiple service clients may share a single +// connect.Client. +func NewEntityResolutionServiceClient(client *connect.Client) EntityResolutionServiceClient { + return &entityResolutionServiceClient{client: client} +} + +// EntityResolutionServiceHandler is an implementation of the +// entityresolution.v2.EntityResolutionService service. +type EntityResolutionServiceHandler interface { + ResolveEntities(context.Context, *v2.ResolveEntitiesRequest) (*v2.ResolveEntitiesResponse, error) + CreateEntityChainsFromTokens(context.Context, *v2.CreateEntityChainsFromTokensRequest) (*v2.CreateEntityChainsFromTokensResponse, error) +} + +// RegisterEntityResolutionServiceHandler registers svc as the +// entityresolution.v2.EntityResolutionService implementation on server. +func RegisterEntityResolutionServiceHandler(server *connect.Server, svc EntityResolutionServiceHandler) { + adapter := entityResolutionServiceHandler{svc: svc} + server.Register( + connect.Method{Spec: entityResolutionServiceResolveEntitiesSpec(), Handler: adapter.resolveEntities}, + connect.Method{Spec: entityResolutionServiceCreateEntityChainsFromTokensSpec(), Handler: adapter.createEntityChainsFromTokens}, + ) +} + +// UnimplementedEntityResolutionServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedEntityResolutionServiceHandler struct{} + +func (UnimplementedEntityResolutionServiceHandler) ResolveEntities(context.Context, *v2.ResolveEntitiesRequest) (*v2.ResolveEntitiesResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "entityresolution.v2.EntityResolutionService.ResolveEntities is not implemented") +} + +func (UnimplementedEntityResolutionServiceHandler) CreateEntityChainsFromTokens(context.Context, *v2.CreateEntityChainsFromTokensRequest) (*v2.CreateEntityChainsFromTokensResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "entityresolution.v2.EntityResolutionService.CreateEntityChainsFromTokens is not implemented") +} + +type entityResolutionServiceClient struct { + client *connect.Client +} + +func (c *entityResolutionServiceClient) ResolveEntities(ctx context.Context, req *v2.ResolveEntitiesRequest) (*v2.ResolveEntitiesResponse, error) { + var res v2.ResolveEntitiesResponse + if err := c.client.CallUnary(ctx, entityResolutionServiceResolveEntitiesSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *entityResolutionServiceClient) CreateEntityChainsFromTokens(ctx context.Context, req *v2.CreateEntityChainsFromTokensRequest) (*v2.CreateEntityChainsFromTokensResponse, error) { + var res v2.CreateEntityChainsFromTokensResponse + if err := c.client.CallUnary(ctx, entityResolutionServiceCreateEntityChainsFromTokensSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +type entityResolutionServiceHandler struct { + svc EntityResolutionServiceHandler +} + +func (h entityResolutionServiceHandler) resolveEntities(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req v2.ResolveEntitiesRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.ResolveEntities(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h entityResolutionServiceHandler) createEntityChainsFromTokens(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req v2.CreateEntityChainsFromTokensRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.CreateEntityChainsFromTokens(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} diff --git a/protocol/go/go.mod b/protocol/go/go.mod index 46af02e5ee..e42b0609a6 100644 --- a/protocol/go/go.mod +++ b/protocol/go/go.mod @@ -1,10 +1,11 @@ module github.com/opentdf/platform/protocol/go -go 1.25.0 +go 1.26.0 require ( buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.11-20260709200747-435963d16310.1 connectrpc.com/connect v1.20.0 + connectrpc.com/connect/v2 v2.0.1 google.golang.org/grpc v1.83.2 google.golang.org/protobuf v1.36.11 ) diff --git a/protocol/go/go.sum b/protocol/go/go.sum index d0de9ca1b4..d4f6b1ab89 100644 --- a/protocol/go/go.sum +++ b/protocol/go/go.sum @@ -2,6 +2,8 @@ buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.11-202607092007 buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.11-20260709200747-435963d16310.1/go.mod h1:tvtbpgaVXZX4g6Pn+AnzFycuRK3MOz5HJfEGeEllXYM= connectrpc.com/connect v1.20.0 h1:6TNDAB+WeNd2uolWNlYczB5E0KNNaVMNUEx8JEUsPmQ= connectrpc.com/connect v1.20.0/go.mod h1:A2ygJrukXwWy32vkCAAHNVguZrqZ+jeZ9rGRnGR4dN4= +connectrpc.com/connect/v2 v2.0.1 h1:WTAycxe87UqxSM5oxS30d1dalZ+C5xz8Ec8O6zVYkHQ= +connectrpc.com/connect/v2 v2.0.1/go.mod h1:N32OLrstcPUzkykFynnefFro3+xzSdOrZlK2jHmS/xo= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= diff --git a/protocol/go/kas/kasconnectv2/kas.connect.go b/protocol/go/kas/kasconnectv2/kas.connect.go new file mode 100644 index 0000000000..66b1b4b89e --- /dev/null +++ b/protocol/go/kas/kasconnectv2/kas.connect.go @@ -0,0 +1,186 @@ +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: kas/kas.proto + +package kasconnectv2 + +import ( + connect "connectrpc.com/connect/v2" + context "context" + kas "github.com/opentdf/platform/protocol/go/kas" + wrapperspb "google.golang.org/protobuf/types/known/wrapperspb" + sync "sync" +) + +const ( + // AccessServiceName is the fully-qualified name of the AccessService service. + AccessServiceName = "kas.AccessService" +) + +// These constants are the procedure names of the RPCs defined in this package. They're exposed at +// runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // AccessServicePublicKeyProcedure is the procedure name of the AccessService's PublicKey RPC. + AccessServicePublicKeyProcedure = "/kas.AccessService/PublicKey" + // AccessServiceLegacyPublicKeyProcedure is the procedure name of the AccessService's + // LegacyPublicKey RPC. + AccessServiceLegacyPublicKeyProcedure = "/kas.AccessService/LegacyPublicKey" + // AccessServiceRewrapProcedure is the procedure name of the AccessService's Rewrap RPC. + AccessServiceRewrapProcedure = "/kas.AccessService/Rewrap" +) + +var ( + accessServicePublicKeySpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: kas.File_kas_kas_proto.Services().ByName("AccessService").Methods().ByName("PublicKey"), + Procedure: AccessServicePublicKeyProcedure, + IdempotencyLevel: connect.IdempotencyNoSideEffects, + } + }) + accessServiceLegacyPublicKeySpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: kas.File_kas_kas_proto.Services().ByName("AccessService").Methods().ByName("LegacyPublicKey"), + Procedure: AccessServiceLegacyPublicKeyProcedure, + IdempotencyLevel: connect.IdempotencyNoSideEffects, + } + }) + accessServiceRewrapSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: kas.File_kas_kas_proto.Services().ByName("AccessService").Methods().ByName("Rewrap"), + Procedure: AccessServiceRewrapProcedure, + } + }) +) + +// AccessServiceClient is a client for the kas.AccessService service. +type AccessServiceClient interface { + PublicKey(context.Context, *kas.PublicKeyRequest) (*kas.PublicKeyResponse, error) + // Endpoint intended for gRPC Gateway's REST endpoint to provide v1 compatibility with older TDF clients + // + // This endpoint is not recommended for use in new applications, prefer the v2 endpoint ('PublicKey') instead. + // + // buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + // + // Deprecated: do not use. + LegacyPublicKey(context.Context, *kas.LegacyPublicKeyRequest) (*wrapperspb.StringValue, error) + Rewrap(context.Context, *kas.RewrapRequest) (*kas.RewrapResponse, error) +} + +// NewAccessServiceClient constructs a client for the kas.AccessService service. Multiple service +// clients may share a single connect.Client. +func NewAccessServiceClient(client *connect.Client) AccessServiceClient { + return &accessServiceClient{client: client} +} + +// AccessServiceHandler is an implementation of the kas.AccessService service. +type AccessServiceHandler interface { + PublicKey(context.Context, *kas.PublicKeyRequest) (*kas.PublicKeyResponse, error) + // Endpoint intended for gRPC Gateway's REST endpoint to provide v1 compatibility with older TDF clients + // + // This endpoint is not recommended for use in new applications, prefer the v2 endpoint ('PublicKey') instead. + // + // buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + // + // Deprecated: do not use. + LegacyPublicKey(context.Context, *kas.LegacyPublicKeyRequest) (*wrapperspb.StringValue, error) + Rewrap(context.Context, *kas.RewrapRequest) (*kas.RewrapResponse, error) +} + +// RegisterAccessServiceHandler registers svc as the kas.AccessService implementation on server. +func RegisterAccessServiceHandler(server *connect.Server, svc AccessServiceHandler) { + adapter := accessServiceHandler{svc: svc} + server.Register( + connect.Method{Spec: accessServicePublicKeySpec(), Handler: adapter.publicKey}, + connect.Method{Spec: accessServiceLegacyPublicKeySpec(), Handler: adapter.legacyPublicKey}, + connect.Method{Spec: accessServiceRewrapSpec(), Handler: adapter.rewrap}, + ) +} + +// UnimplementedAccessServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedAccessServiceHandler struct{} + +func (UnimplementedAccessServiceHandler) PublicKey(context.Context, *kas.PublicKeyRequest) (*kas.PublicKeyResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "kas.AccessService.PublicKey is not implemented") +} + +func (UnimplementedAccessServiceHandler) LegacyPublicKey(context.Context, *kas.LegacyPublicKeyRequest) (*wrapperspb.StringValue, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "kas.AccessService.LegacyPublicKey is not implemented") +} + +func (UnimplementedAccessServiceHandler) Rewrap(context.Context, *kas.RewrapRequest) (*kas.RewrapResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "kas.AccessService.Rewrap is not implemented") +} + +type accessServiceClient struct { + client *connect.Client +} + +func (c *accessServiceClient) PublicKey(ctx context.Context, req *kas.PublicKeyRequest) (*kas.PublicKeyResponse, error) { + var res kas.PublicKeyResponse + if err := c.client.CallUnary(ctx, accessServicePublicKeySpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *accessServiceClient) LegacyPublicKey(ctx context.Context, req *kas.LegacyPublicKeyRequest) (*wrapperspb.StringValue, error) { + var res wrapperspb.StringValue + if err := c.client.CallUnary(ctx, accessServiceLegacyPublicKeySpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *accessServiceClient) Rewrap(ctx context.Context, req *kas.RewrapRequest) (*kas.RewrapResponse, error) { + var res kas.RewrapResponse + if err := c.client.CallUnary(ctx, accessServiceRewrapSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +type accessServiceHandler struct{ svc AccessServiceHandler } + +func (h accessServiceHandler) publicKey(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req kas.PublicKeyRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.PublicKey(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h accessServiceHandler) legacyPublicKey(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req kas.LegacyPublicKeyRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.LegacyPublicKey(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h accessServiceHandler) rewrap(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req kas.RewrapRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.Rewrap(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} diff --git a/protocol/go/policy/actions/actionsconnectv2/actions.connect.go b/protocol/go/policy/actions/actionsconnectv2/actions.connect.go new file mode 100644 index 0000000000..0c3481ee3a --- /dev/null +++ b/protocol/go/policy/actions/actionsconnectv2/actions.connect.go @@ -0,0 +1,241 @@ +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: policy/actions/actions.proto + +package actionsconnectv2 + +import ( + connect "connectrpc.com/connect/v2" + context "context" + actions "github.com/opentdf/platform/protocol/go/policy/actions" + sync "sync" +) + +const ( + // ActionServiceName is the fully-qualified name of the ActionService service. + ActionServiceName = "policy.actions.ActionService" +) + +// These constants are the procedure names of the RPCs defined in this package. They're exposed at +// runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // ActionServiceGetActionProcedure is the procedure name of the ActionService's GetAction RPC. + ActionServiceGetActionProcedure = "/policy.actions.ActionService/GetAction" + // ActionServiceListActionsProcedure is the procedure name of the ActionService's ListActions RPC. + ActionServiceListActionsProcedure = "/policy.actions.ActionService/ListActions" + // ActionServiceCreateActionProcedure is the procedure name of the ActionService's CreateAction RPC. + ActionServiceCreateActionProcedure = "/policy.actions.ActionService/CreateAction" + // ActionServiceUpdateActionProcedure is the procedure name of the ActionService's UpdateAction RPC. + ActionServiceUpdateActionProcedure = "/policy.actions.ActionService/UpdateAction" + // ActionServiceDeleteActionProcedure is the procedure name of the ActionService's DeleteAction RPC. + ActionServiceDeleteActionProcedure = "/policy.actions.ActionService/DeleteAction" +) + +var ( + actionServiceGetActionSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: actions.File_policy_actions_actions_proto.Services().ByName("ActionService").Methods().ByName("GetAction"), + Procedure: ActionServiceGetActionProcedure, + } + }) + actionServiceListActionsSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: actions.File_policy_actions_actions_proto.Services().ByName("ActionService").Methods().ByName("ListActions"), + Procedure: ActionServiceListActionsProcedure, + } + }) + actionServiceCreateActionSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: actions.File_policy_actions_actions_proto.Services().ByName("ActionService").Methods().ByName("CreateAction"), + Procedure: ActionServiceCreateActionProcedure, + } + }) + actionServiceUpdateActionSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: actions.File_policy_actions_actions_proto.Services().ByName("ActionService").Methods().ByName("UpdateAction"), + Procedure: ActionServiceUpdateActionProcedure, + } + }) + actionServiceDeleteActionSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: actions.File_policy_actions_actions_proto.Services().ByName("ActionService").Methods().ByName("DeleteAction"), + Procedure: ActionServiceDeleteActionProcedure, + } + }) +) + +// ActionServiceClient is a client for the policy.actions.ActionService service. +type ActionServiceClient interface { + GetAction(context.Context, *actions.GetActionRequest) (*actions.GetActionResponse, error) + ListActions(context.Context, *actions.ListActionsRequest) (*actions.ListActionsResponse, error) + CreateAction(context.Context, *actions.CreateActionRequest) (*actions.CreateActionResponse, error) + UpdateAction(context.Context, *actions.UpdateActionRequest) (*actions.UpdateActionResponse, error) + DeleteAction(context.Context, *actions.DeleteActionRequest) (*actions.DeleteActionResponse, error) +} + +// NewActionServiceClient constructs a client for the policy.actions.ActionService service. Multiple +// service clients may share a single connect.Client. +func NewActionServiceClient(client *connect.Client) ActionServiceClient { + return &actionServiceClient{client: client} +} + +// ActionServiceHandler is an implementation of the policy.actions.ActionService service. +type ActionServiceHandler interface { + GetAction(context.Context, *actions.GetActionRequest) (*actions.GetActionResponse, error) + ListActions(context.Context, *actions.ListActionsRequest) (*actions.ListActionsResponse, error) + CreateAction(context.Context, *actions.CreateActionRequest) (*actions.CreateActionResponse, error) + UpdateAction(context.Context, *actions.UpdateActionRequest) (*actions.UpdateActionResponse, error) + DeleteAction(context.Context, *actions.DeleteActionRequest) (*actions.DeleteActionResponse, error) +} + +// RegisterActionServiceHandler registers svc as the policy.actions.ActionService implementation on +// server. +func RegisterActionServiceHandler(server *connect.Server, svc ActionServiceHandler) { + adapter := actionServiceHandler{svc: svc} + server.Register( + connect.Method{Spec: actionServiceGetActionSpec(), Handler: adapter.getAction}, + connect.Method{Spec: actionServiceListActionsSpec(), Handler: adapter.listActions}, + connect.Method{Spec: actionServiceCreateActionSpec(), Handler: adapter.createAction}, + connect.Method{Spec: actionServiceUpdateActionSpec(), Handler: adapter.updateAction}, + connect.Method{Spec: actionServiceDeleteActionSpec(), Handler: adapter.deleteAction}, + ) +} + +// UnimplementedActionServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedActionServiceHandler struct{} + +func (UnimplementedActionServiceHandler) GetAction(context.Context, *actions.GetActionRequest) (*actions.GetActionResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.actions.ActionService.GetAction is not implemented") +} + +func (UnimplementedActionServiceHandler) ListActions(context.Context, *actions.ListActionsRequest) (*actions.ListActionsResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.actions.ActionService.ListActions is not implemented") +} + +func (UnimplementedActionServiceHandler) CreateAction(context.Context, *actions.CreateActionRequest) (*actions.CreateActionResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.actions.ActionService.CreateAction is not implemented") +} + +func (UnimplementedActionServiceHandler) UpdateAction(context.Context, *actions.UpdateActionRequest) (*actions.UpdateActionResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.actions.ActionService.UpdateAction is not implemented") +} + +func (UnimplementedActionServiceHandler) DeleteAction(context.Context, *actions.DeleteActionRequest) (*actions.DeleteActionResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.actions.ActionService.DeleteAction is not implemented") +} + +type actionServiceClient struct { + client *connect.Client +} + +func (c *actionServiceClient) GetAction(ctx context.Context, req *actions.GetActionRequest) (*actions.GetActionResponse, error) { + var res actions.GetActionResponse + if err := c.client.CallUnary(ctx, actionServiceGetActionSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *actionServiceClient) ListActions(ctx context.Context, req *actions.ListActionsRequest) (*actions.ListActionsResponse, error) { + var res actions.ListActionsResponse + if err := c.client.CallUnary(ctx, actionServiceListActionsSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *actionServiceClient) CreateAction(ctx context.Context, req *actions.CreateActionRequest) (*actions.CreateActionResponse, error) { + var res actions.CreateActionResponse + if err := c.client.CallUnary(ctx, actionServiceCreateActionSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *actionServiceClient) UpdateAction(ctx context.Context, req *actions.UpdateActionRequest) (*actions.UpdateActionResponse, error) { + var res actions.UpdateActionResponse + if err := c.client.CallUnary(ctx, actionServiceUpdateActionSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *actionServiceClient) DeleteAction(ctx context.Context, req *actions.DeleteActionRequest) (*actions.DeleteActionResponse, error) { + var res actions.DeleteActionResponse + if err := c.client.CallUnary(ctx, actionServiceDeleteActionSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +type actionServiceHandler struct{ svc ActionServiceHandler } + +func (h actionServiceHandler) getAction(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req actions.GetActionRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.GetAction(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h actionServiceHandler) listActions(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req actions.ListActionsRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.ListActions(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h actionServiceHandler) createAction(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req actions.CreateActionRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.CreateAction(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h actionServiceHandler) updateAction(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req actions.UpdateActionRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.UpdateAction(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h actionServiceHandler) deleteAction(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req actions.DeleteActionRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.DeleteAction(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} diff --git a/protocol/go/policy/attributes/attributesconnectv2/attributes.connect.go b/protocol/go/policy/attributes/attributesconnectv2/attributes.connect.go new file mode 100644 index 0000000000..a801eb0dec --- /dev/null +++ b/protocol/go/policy/attributes/attributesconnectv2/attributes.connect.go @@ -0,0 +1,907 @@ +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: policy/attributes/attributes.proto + +package attributesconnectv2 + +import ( + connect "connectrpc.com/connect/v2" + context "context" + attributes "github.com/opentdf/platform/protocol/go/policy/attributes" + sync "sync" +) + +const ( + // AttributesServiceName is the fully-qualified name of the AttributesService service. + AttributesServiceName = "policy.attributes.AttributesService" +) + +// These constants are the procedure names of the RPCs defined in this package. They're exposed at +// runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // AttributesServiceListAttributesProcedure is the procedure name of the AttributesService's + // ListAttributes RPC. + AttributesServiceListAttributesProcedure = "/policy.attributes.AttributesService/ListAttributes" + // AttributesServiceListAttributeValuesProcedure is the procedure name of the AttributesService's + // ListAttributeValues RPC. + AttributesServiceListAttributeValuesProcedure = "/policy.attributes.AttributesService/ListAttributeValues" + // AttributesServiceGetAttributeProcedure is the procedure name of the AttributesService's + // GetAttribute RPC. + AttributesServiceGetAttributeProcedure = "/policy.attributes.AttributesService/GetAttribute" + // AttributesServiceGetAttributeValuesByFqnsProcedure is the procedure name of the + // AttributesService's GetAttributeValuesByFqns RPC. + AttributesServiceGetAttributeValuesByFqnsProcedure = "/policy.attributes.AttributesService/GetAttributeValuesByFqns" + // AttributesServiceGetKeyMappingsByFqnsProcedure is the procedure name of the AttributesService's + // GetKeyMappingsByFqns RPC. + AttributesServiceGetKeyMappingsByFqnsProcedure = "/policy.attributes.AttributesService/GetKeyMappingsByFqns" + // AttributesServiceGetEntitleableAttributesByFqnsProcedure is the procedure name of the + // AttributesService's GetEntitleableAttributesByFqns RPC. + AttributesServiceGetEntitleableAttributesByFqnsProcedure = "/policy.attributes.AttributesService/GetEntitleableAttributesByFqns" + // AttributesServiceCreateAttributeProcedure is the procedure name of the AttributesService's + // CreateAttribute RPC. + AttributesServiceCreateAttributeProcedure = "/policy.attributes.AttributesService/CreateAttribute" + // AttributesServiceUpdateAttributeProcedure is the procedure name of the AttributesService's + // UpdateAttribute RPC. + AttributesServiceUpdateAttributeProcedure = "/policy.attributes.AttributesService/UpdateAttribute" + // AttributesServiceDeactivateAttributeProcedure is the procedure name of the AttributesService's + // DeactivateAttribute RPC. + AttributesServiceDeactivateAttributeProcedure = "/policy.attributes.AttributesService/DeactivateAttribute" + // AttributesServiceGetAttributeValueProcedure is the procedure name of the AttributesService's + // GetAttributeValue RPC. + AttributesServiceGetAttributeValueProcedure = "/policy.attributes.AttributesService/GetAttributeValue" + // AttributesServiceCreateAttributeValueProcedure is the procedure name of the AttributesService's + // CreateAttributeValue RPC. + AttributesServiceCreateAttributeValueProcedure = "/policy.attributes.AttributesService/CreateAttributeValue" + // AttributesServiceUpdateAttributeValueProcedure is the procedure name of the AttributesService's + // UpdateAttributeValue RPC. + AttributesServiceUpdateAttributeValueProcedure = "/policy.attributes.AttributesService/UpdateAttributeValue" + // AttributesServiceDeactivateAttributeValueProcedure is the procedure name of the + // AttributesService's DeactivateAttributeValue RPC. + AttributesServiceDeactivateAttributeValueProcedure = "/policy.attributes.AttributesService/DeactivateAttributeValue" + // AttributesServiceAssignKeyAccessServerToAttributeProcedure is the procedure name of the + // AttributesService's AssignKeyAccessServerToAttribute RPC. + AttributesServiceAssignKeyAccessServerToAttributeProcedure = "/policy.attributes.AttributesService/AssignKeyAccessServerToAttribute" + // AttributesServiceRemoveKeyAccessServerFromAttributeProcedure is the procedure name of the + // AttributesService's RemoveKeyAccessServerFromAttribute RPC. + AttributesServiceRemoveKeyAccessServerFromAttributeProcedure = "/policy.attributes.AttributesService/RemoveKeyAccessServerFromAttribute" + // AttributesServiceAssignKeyAccessServerToValueProcedure is the procedure name of the + // AttributesService's AssignKeyAccessServerToValue RPC. + AttributesServiceAssignKeyAccessServerToValueProcedure = "/policy.attributes.AttributesService/AssignKeyAccessServerToValue" + // AttributesServiceRemoveKeyAccessServerFromValueProcedure is the procedure name of the + // AttributesService's RemoveKeyAccessServerFromValue RPC. + AttributesServiceRemoveKeyAccessServerFromValueProcedure = "/policy.attributes.AttributesService/RemoveKeyAccessServerFromValue" + // AttributesServiceAssignPublicKeyToAttributeProcedure is the procedure name of the + // AttributesService's AssignPublicKeyToAttribute RPC. + AttributesServiceAssignPublicKeyToAttributeProcedure = "/policy.attributes.AttributesService/AssignPublicKeyToAttribute" + // AttributesServiceRemovePublicKeyFromAttributeProcedure is the procedure name of the + // AttributesService's RemovePublicKeyFromAttribute RPC. + AttributesServiceRemovePublicKeyFromAttributeProcedure = "/policy.attributes.AttributesService/RemovePublicKeyFromAttribute" + // AttributesServiceAssignPublicKeyToValueProcedure is the procedure name of the AttributesService's + // AssignPublicKeyToValue RPC. + AttributesServiceAssignPublicKeyToValueProcedure = "/policy.attributes.AttributesService/AssignPublicKeyToValue" + // AttributesServiceRemovePublicKeyFromValueProcedure is the procedure name of the + // AttributesService's RemovePublicKeyFromValue RPC. + AttributesServiceRemovePublicKeyFromValueProcedure = "/policy.attributes.AttributesService/RemovePublicKeyFromValue" +) + +var ( + attributesServiceListAttributesSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: attributes.File_policy_attributes_attributes_proto.Services().ByName("AttributesService").Methods().ByName("ListAttributes"), + Procedure: AttributesServiceListAttributesProcedure, + IdempotencyLevel: connect.IdempotencyNoSideEffects, + } + }) + attributesServiceListAttributeValuesSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: attributes.File_policy_attributes_attributes_proto.Services().ByName("AttributesService").Methods().ByName("ListAttributeValues"), + Procedure: AttributesServiceListAttributeValuesProcedure, + IdempotencyLevel: connect.IdempotencyNoSideEffects, + } + }) + attributesServiceGetAttributeSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: attributes.File_policy_attributes_attributes_proto.Services().ByName("AttributesService").Methods().ByName("GetAttribute"), + Procedure: AttributesServiceGetAttributeProcedure, + IdempotencyLevel: connect.IdempotencyNoSideEffects, + } + }) + attributesServiceGetAttributeValuesByFqnsSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: attributes.File_policy_attributes_attributes_proto.Services().ByName("AttributesService").Methods().ByName("GetAttributeValuesByFqns"), + Procedure: AttributesServiceGetAttributeValuesByFqnsProcedure, + IdempotencyLevel: connect.IdempotencyNoSideEffects, + } + }) + attributesServiceGetKeyMappingsByFqnsSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: attributes.File_policy_attributes_attributes_proto.Services().ByName("AttributesService").Methods().ByName("GetKeyMappingsByFqns"), + Procedure: AttributesServiceGetKeyMappingsByFqnsProcedure, + IdempotencyLevel: connect.IdempotencyNoSideEffects, + } + }) + attributesServiceGetEntitleableAttributesByFqnsSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: attributes.File_policy_attributes_attributes_proto.Services().ByName("AttributesService").Methods().ByName("GetEntitleableAttributesByFqns"), + Procedure: AttributesServiceGetEntitleableAttributesByFqnsProcedure, + IdempotencyLevel: connect.IdempotencyNoSideEffects, + } + }) + attributesServiceCreateAttributeSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: attributes.File_policy_attributes_attributes_proto.Services().ByName("AttributesService").Methods().ByName("CreateAttribute"), + Procedure: AttributesServiceCreateAttributeProcedure, + } + }) + attributesServiceUpdateAttributeSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: attributes.File_policy_attributes_attributes_proto.Services().ByName("AttributesService").Methods().ByName("UpdateAttribute"), + Procedure: AttributesServiceUpdateAttributeProcedure, + } + }) + attributesServiceDeactivateAttributeSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: attributes.File_policy_attributes_attributes_proto.Services().ByName("AttributesService").Methods().ByName("DeactivateAttribute"), + Procedure: AttributesServiceDeactivateAttributeProcedure, + } + }) + attributesServiceGetAttributeValueSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: attributes.File_policy_attributes_attributes_proto.Services().ByName("AttributesService").Methods().ByName("GetAttributeValue"), + Procedure: AttributesServiceGetAttributeValueProcedure, + IdempotencyLevel: connect.IdempotencyNoSideEffects, + } + }) + attributesServiceCreateAttributeValueSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: attributes.File_policy_attributes_attributes_proto.Services().ByName("AttributesService").Methods().ByName("CreateAttributeValue"), + Procedure: AttributesServiceCreateAttributeValueProcedure, + } + }) + attributesServiceUpdateAttributeValueSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: attributes.File_policy_attributes_attributes_proto.Services().ByName("AttributesService").Methods().ByName("UpdateAttributeValue"), + Procedure: AttributesServiceUpdateAttributeValueProcedure, + } + }) + attributesServiceDeactivateAttributeValueSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: attributes.File_policy_attributes_attributes_proto.Services().ByName("AttributesService").Methods().ByName("DeactivateAttributeValue"), + Procedure: AttributesServiceDeactivateAttributeValueProcedure, + } + }) + attributesServiceAssignKeyAccessServerToAttributeSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: attributes.File_policy_attributes_attributes_proto.Services().ByName("AttributesService").Methods().ByName("AssignKeyAccessServerToAttribute"), + Procedure: AttributesServiceAssignKeyAccessServerToAttributeProcedure, + } + }) + attributesServiceRemoveKeyAccessServerFromAttributeSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: attributes.File_policy_attributes_attributes_proto.Services().ByName("AttributesService").Methods().ByName("RemoveKeyAccessServerFromAttribute"), + Procedure: AttributesServiceRemoveKeyAccessServerFromAttributeProcedure, + } + }) + attributesServiceAssignKeyAccessServerToValueSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: attributes.File_policy_attributes_attributes_proto.Services().ByName("AttributesService").Methods().ByName("AssignKeyAccessServerToValue"), + Procedure: AttributesServiceAssignKeyAccessServerToValueProcedure, + } + }) + attributesServiceRemoveKeyAccessServerFromValueSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: attributes.File_policy_attributes_attributes_proto.Services().ByName("AttributesService").Methods().ByName("RemoveKeyAccessServerFromValue"), + Procedure: AttributesServiceRemoveKeyAccessServerFromValueProcedure, + } + }) + attributesServiceAssignPublicKeyToAttributeSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: attributes.File_policy_attributes_attributes_proto.Services().ByName("AttributesService").Methods().ByName("AssignPublicKeyToAttribute"), + Procedure: AttributesServiceAssignPublicKeyToAttributeProcedure, + } + }) + attributesServiceRemovePublicKeyFromAttributeSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: attributes.File_policy_attributes_attributes_proto.Services().ByName("AttributesService").Methods().ByName("RemovePublicKeyFromAttribute"), + Procedure: AttributesServiceRemovePublicKeyFromAttributeProcedure, + } + }) + attributesServiceAssignPublicKeyToValueSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: attributes.File_policy_attributes_attributes_proto.Services().ByName("AttributesService").Methods().ByName("AssignPublicKeyToValue"), + Procedure: AttributesServiceAssignPublicKeyToValueProcedure, + } + }) + attributesServiceRemovePublicKeyFromValueSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: attributes.File_policy_attributes_attributes_proto.Services().ByName("AttributesService").Methods().ByName("RemovePublicKeyFromValue"), + Procedure: AttributesServiceRemovePublicKeyFromValueProcedure, + } + }) +) + +// AttributesServiceClient is a client for the policy.attributes.AttributesService service. +type AttributesServiceClient interface { + //--------------------------------------* + // Attribute RPCs + //--------------------------------------- + ListAttributes(context.Context, *attributes.ListAttributesRequest) (*attributes.ListAttributesResponse, error) + // Deprecated + // Use GetAttribute + // + // Deprecated: do not use. + ListAttributeValues(context.Context, *attributes.ListAttributeValuesRequest) (*attributes.ListAttributeValuesResponse, error) + GetAttribute(context.Context, *attributes.GetAttributeRequest) (*attributes.GetAttributeResponse, error) + // Deprecated: Use GetKeyMappingsByFqns for client-side key splits and + // GetEntitleableAttributesByFqns for server-side entitlement resolution. + // + // Deprecated: do not use. + GetAttributeValuesByFqns(context.Context, *attributes.GetAttributeValuesByFqnsRequest) (*attributes.GetAttributeValuesByFqnsResponse, error) + // Returns only key-mapping information (rule and effective KAS keys) for the + // requested attribute value FQNs, for client-side key split construction. + GetKeyMappingsByFqns(context.Context, *attributes.GetKeyMappingsByFqnsRequest) (*attributes.GetKeyMappingsByFqnsResponse, error) + // Returns only entitlement-relevant information (rule, value identity, ordered + // definition values, subject mappings, and dynamic mappings) for the requested attribute value + // FQNs, for server-side decisioning / entitlement resolution. + GetEntitleableAttributesByFqns(context.Context, *attributes.GetEntitleableAttributesByFqnsRequest) (*attributes.GetEntitleableAttributesByFqnsResponse, error) + CreateAttribute(context.Context, *attributes.CreateAttributeRequest) (*attributes.CreateAttributeResponse, error) + UpdateAttribute(context.Context, *attributes.UpdateAttributeRequest) (*attributes.UpdateAttributeResponse, error) + DeactivateAttribute(context.Context, *attributes.DeactivateAttributeRequest) (*attributes.DeactivateAttributeResponse, error) + //--------------------------------------* + // Value RPCs + //--------------------------------------- + GetAttributeValue(context.Context, *attributes.GetAttributeValueRequest) (*attributes.GetAttributeValueResponse, error) + CreateAttributeValue(context.Context, *attributes.CreateAttributeValueRequest) (*attributes.CreateAttributeValueResponse, error) + UpdateAttributeValue(context.Context, *attributes.UpdateAttributeValueRequest) (*attributes.UpdateAttributeValueResponse, error) + DeactivateAttributeValue(context.Context, *attributes.DeactivateAttributeValueRequest) (*attributes.DeactivateAttributeValueResponse, error) + // Deprecated: utilize AssignPublicKeyToAttribute + // + // Deprecated: do not use. + AssignKeyAccessServerToAttribute(context.Context, *attributes.AssignKeyAccessServerToAttributeRequest) (*attributes.AssignKeyAccessServerToAttributeResponse, error) + // Deprecated: utilize RemovePublicKeyFromAttribute + // + // Deprecated: do not use. + RemoveKeyAccessServerFromAttribute(context.Context, *attributes.RemoveKeyAccessServerFromAttributeRequest) (*attributes.RemoveKeyAccessServerFromAttributeResponse, error) + // Deprecated: utilize AssignPublicKeyToValue + // + // Deprecated: do not use. + AssignKeyAccessServerToValue(context.Context, *attributes.AssignKeyAccessServerToValueRequest) (*attributes.AssignKeyAccessServerToValueResponse, error) + // Deprecated: utilize RemovePublicKeyFromValue + // + // Deprecated: do not use. + RemoveKeyAccessServerFromValue(context.Context, *attributes.RemoveKeyAccessServerFromValueRequest) (*attributes.RemoveKeyAccessServerFromValueResponse, error) + AssignPublicKeyToAttribute(context.Context, *attributes.AssignPublicKeyToAttributeRequest) (*attributes.AssignPublicKeyToAttributeResponse, error) + RemovePublicKeyFromAttribute(context.Context, *attributes.RemovePublicKeyFromAttributeRequest) (*attributes.RemovePublicKeyFromAttributeResponse, error) + AssignPublicKeyToValue(context.Context, *attributes.AssignPublicKeyToValueRequest) (*attributes.AssignPublicKeyToValueResponse, error) + RemovePublicKeyFromValue(context.Context, *attributes.RemovePublicKeyFromValueRequest) (*attributes.RemovePublicKeyFromValueResponse, error) +} + +// NewAttributesServiceClient constructs a client for the policy.attributes.AttributesService +// service. Multiple service clients may share a single connect.Client. +func NewAttributesServiceClient(client *connect.Client) AttributesServiceClient { + return &attributesServiceClient{client: client} +} + +// AttributesServiceHandler is an implementation of the policy.attributes.AttributesService service. +type AttributesServiceHandler interface { + //--------------------------------------* + // Attribute RPCs + //--------------------------------------- + ListAttributes(context.Context, *attributes.ListAttributesRequest) (*attributes.ListAttributesResponse, error) + // Deprecated + // Use GetAttribute + // + // Deprecated: do not use. + ListAttributeValues(context.Context, *attributes.ListAttributeValuesRequest) (*attributes.ListAttributeValuesResponse, error) + GetAttribute(context.Context, *attributes.GetAttributeRequest) (*attributes.GetAttributeResponse, error) + // Deprecated: Use GetKeyMappingsByFqns for client-side key splits and + // GetEntitleableAttributesByFqns for server-side entitlement resolution. + // + // Deprecated: do not use. + GetAttributeValuesByFqns(context.Context, *attributes.GetAttributeValuesByFqnsRequest) (*attributes.GetAttributeValuesByFqnsResponse, error) + // Returns only key-mapping information (rule and effective KAS keys) for the + // requested attribute value FQNs, for client-side key split construction. + GetKeyMappingsByFqns(context.Context, *attributes.GetKeyMappingsByFqnsRequest) (*attributes.GetKeyMappingsByFqnsResponse, error) + // Returns only entitlement-relevant information (rule, value identity, ordered + // definition values, subject mappings, and dynamic mappings) for the requested attribute value + // FQNs, for server-side decisioning / entitlement resolution. + GetEntitleableAttributesByFqns(context.Context, *attributes.GetEntitleableAttributesByFqnsRequest) (*attributes.GetEntitleableAttributesByFqnsResponse, error) + CreateAttribute(context.Context, *attributes.CreateAttributeRequest) (*attributes.CreateAttributeResponse, error) + UpdateAttribute(context.Context, *attributes.UpdateAttributeRequest) (*attributes.UpdateAttributeResponse, error) + DeactivateAttribute(context.Context, *attributes.DeactivateAttributeRequest) (*attributes.DeactivateAttributeResponse, error) + //--------------------------------------* + // Value RPCs + //--------------------------------------- + GetAttributeValue(context.Context, *attributes.GetAttributeValueRequest) (*attributes.GetAttributeValueResponse, error) + CreateAttributeValue(context.Context, *attributes.CreateAttributeValueRequest) (*attributes.CreateAttributeValueResponse, error) + UpdateAttributeValue(context.Context, *attributes.UpdateAttributeValueRequest) (*attributes.UpdateAttributeValueResponse, error) + DeactivateAttributeValue(context.Context, *attributes.DeactivateAttributeValueRequest) (*attributes.DeactivateAttributeValueResponse, error) + // Deprecated: utilize AssignPublicKeyToAttribute + // + // Deprecated: do not use. + AssignKeyAccessServerToAttribute(context.Context, *attributes.AssignKeyAccessServerToAttributeRequest) (*attributes.AssignKeyAccessServerToAttributeResponse, error) + // Deprecated: utilize RemovePublicKeyFromAttribute + // + // Deprecated: do not use. + RemoveKeyAccessServerFromAttribute(context.Context, *attributes.RemoveKeyAccessServerFromAttributeRequest) (*attributes.RemoveKeyAccessServerFromAttributeResponse, error) + // Deprecated: utilize AssignPublicKeyToValue + // + // Deprecated: do not use. + AssignKeyAccessServerToValue(context.Context, *attributes.AssignKeyAccessServerToValueRequest) (*attributes.AssignKeyAccessServerToValueResponse, error) + // Deprecated: utilize RemovePublicKeyFromValue + // + // Deprecated: do not use. + RemoveKeyAccessServerFromValue(context.Context, *attributes.RemoveKeyAccessServerFromValueRequest) (*attributes.RemoveKeyAccessServerFromValueResponse, error) + AssignPublicKeyToAttribute(context.Context, *attributes.AssignPublicKeyToAttributeRequest) (*attributes.AssignPublicKeyToAttributeResponse, error) + RemovePublicKeyFromAttribute(context.Context, *attributes.RemovePublicKeyFromAttributeRequest) (*attributes.RemovePublicKeyFromAttributeResponse, error) + AssignPublicKeyToValue(context.Context, *attributes.AssignPublicKeyToValueRequest) (*attributes.AssignPublicKeyToValueResponse, error) + RemovePublicKeyFromValue(context.Context, *attributes.RemovePublicKeyFromValueRequest) (*attributes.RemovePublicKeyFromValueResponse, error) +} + +// RegisterAttributesServiceHandler registers svc as the policy.attributes.AttributesService +// implementation on server. +func RegisterAttributesServiceHandler(server *connect.Server, svc AttributesServiceHandler) { + adapter := attributesServiceHandler{svc: svc} + server.Register( + connect.Method{Spec: attributesServiceListAttributesSpec(), Handler: adapter.listAttributes}, + connect.Method{Spec: attributesServiceListAttributeValuesSpec(), Handler: adapter.listAttributeValues}, + connect.Method{Spec: attributesServiceGetAttributeSpec(), Handler: adapter.getAttribute}, + connect.Method{Spec: attributesServiceGetAttributeValuesByFqnsSpec(), Handler: adapter.getAttributeValuesByFqns}, + connect.Method{Spec: attributesServiceGetKeyMappingsByFqnsSpec(), Handler: adapter.getKeyMappingsByFqns}, + connect.Method{Spec: attributesServiceGetEntitleableAttributesByFqnsSpec(), Handler: adapter.getEntitleableAttributesByFqns}, + connect.Method{Spec: attributesServiceCreateAttributeSpec(), Handler: adapter.createAttribute}, + connect.Method{Spec: attributesServiceUpdateAttributeSpec(), Handler: adapter.updateAttribute}, + connect.Method{Spec: attributesServiceDeactivateAttributeSpec(), Handler: adapter.deactivateAttribute}, + connect.Method{Spec: attributesServiceGetAttributeValueSpec(), Handler: adapter.getAttributeValue}, + connect.Method{Spec: attributesServiceCreateAttributeValueSpec(), Handler: adapter.createAttributeValue}, + connect.Method{Spec: attributesServiceUpdateAttributeValueSpec(), Handler: adapter.updateAttributeValue}, + connect.Method{Spec: attributesServiceDeactivateAttributeValueSpec(), Handler: adapter.deactivateAttributeValue}, + connect.Method{Spec: attributesServiceAssignKeyAccessServerToAttributeSpec(), Handler: adapter.assignKeyAccessServerToAttribute}, + connect.Method{Spec: attributesServiceRemoveKeyAccessServerFromAttributeSpec(), Handler: adapter.removeKeyAccessServerFromAttribute}, + connect.Method{Spec: attributesServiceAssignKeyAccessServerToValueSpec(), Handler: adapter.assignKeyAccessServerToValue}, + connect.Method{Spec: attributesServiceRemoveKeyAccessServerFromValueSpec(), Handler: adapter.removeKeyAccessServerFromValue}, + connect.Method{Spec: attributesServiceAssignPublicKeyToAttributeSpec(), Handler: adapter.assignPublicKeyToAttribute}, + connect.Method{Spec: attributesServiceRemovePublicKeyFromAttributeSpec(), Handler: adapter.removePublicKeyFromAttribute}, + connect.Method{Spec: attributesServiceAssignPublicKeyToValueSpec(), Handler: adapter.assignPublicKeyToValue}, + connect.Method{Spec: attributesServiceRemovePublicKeyFromValueSpec(), Handler: adapter.removePublicKeyFromValue}, + ) +} + +// UnimplementedAttributesServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedAttributesServiceHandler struct{} + +func (UnimplementedAttributesServiceHandler) ListAttributes(context.Context, *attributes.ListAttributesRequest) (*attributes.ListAttributesResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.attributes.AttributesService.ListAttributes is not implemented") +} + +func (UnimplementedAttributesServiceHandler) ListAttributeValues(context.Context, *attributes.ListAttributeValuesRequest) (*attributes.ListAttributeValuesResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.attributes.AttributesService.ListAttributeValues is not implemented") +} + +func (UnimplementedAttributesServiceHandler) GetAttribute(context.Context, *attributes.GetAttributeRequest) (*attributes.GetAttributeResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.attributes.AttributesService.GetAttribute is not implemented") +} + +func (UnimplementedAttributesServiceHandler) GetAttributeValuesByFqns(context.Context, *attributes.GetAttributeValuesByFqnsRequest) (*attributes.GetAttributeValuesByFqnsResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.attributes.AttributesService.GetAttributeValuesByFqns is not implemented") +} + +func (UnimplementedAttributesServiceHandler) GetKeyMappingsByFqns(context.Context, *attributes.GetKeyMappingsByFqnsRequest) (*attributes.GetKeyMappingsByFqnsResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.attributes.AttributesService.GetKeyMappingsByFqns is not implemented") +} + +func (UnimplementedAttributesServiceHandler) GetEntitleableAttributesByFqns(context.Context, *attributes.GetEntitleableAttributesByFqnsRequest) (*attributes.GetEntitleableAttributesByFqnsResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.attributes.AttributesService.GetEntitleableAttributesByFqns is not implemented") +} + +func (UnimplementedAttributesServiceHandler) CreateAttribute(context.Context, *attributes.CreateAttributeRequest) (*attributes.CreateAttributeResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.attributes.AttributesService.CreateAttribute is not implemented") +} + +func (UnimplementedAttributesServiceHandler) UpdateAttribute(context.Context, *attributes.UpdateAttributeRequest) (*attributes.UpdateAttributeResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.attributes.AttributesService.UpdateAttribute is not implemented") +} + +func (UnimplementedAttributesServiceHandler) DeactivateAttribute(context.Context, *attributes.DeactivateAttributeRequest) (*attributes.DeactivateAttributeResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.attributes.AttributesService.DeactivateAttribute is not implemented") +} + +func (UnimplementedAttributesServiceHandler) GetAttributeValue(context.Context, *attributes.GetAttributeValueRequest) (*attributes.GetAttributeValueResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.attributes.AttributesService.GetAttributeValue is not implemented") +} + +func (UnimplementedAttributesServiceHandler) CreateAttributeValue(context.Context, *attributes.CreateAttributeValueRequest) (*attributes.CreateAttributeValueResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.attributes.AttributesService.CreateAttributeValue is not implemented") +} + +func (UnimplementedAttributesServiceHandler) UpdateAttributeValue(context.Context, *attributes.UpdateAttributeValueRequest) (*attributes.UpdateAttributeValueResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.attributes.AttributesService.UpdateAttributeValue is not implemented") +} + +func (UnimplementedAttributesServiceHandler) DeactivateAttributeValue(context.Context, *attributes.DeactivateAttributeValueRequest) (*attributes.DeactivateAttributeValueResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.attributes.AttributesService.DeactivateAttributeValue is not implemented") +} + +func (UnimplementedAttributesServiceHandler) AssignKeyAccessServerToAttribute(context.Context, *attributes.AssignKeyAccessServerToAttributeRequest) (*attributes.AssignKeyAccessServerToAttributeResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.attributes.AttributesService.AssignKeyAccessServerToAttribute is not implemented") +} + +func (UnimplementedAttributesServiceHandler) RemoveKeyAccessServerFromAttribute(context.Context, *attributes.RemoveKeyAccessServerFromAttributeRequest) (*attributes.RemoveKeyAccessServerFromAttributeResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.attributes.AttributesService.RemoveKeyAccessServerFromAttribute is not implemented") +} + +func (UnimplementedAttributesServiceHandler) AssignKeyAccessServerToValue(context.Context, *attributes.AssignKeyAccessServerToValueRequest) (*attributes.AssignKeyAccessServerToValueResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.attributes.AttributesService.AssignKeyAccessServerToValue is not implemented") +} + +func (UnimplementedAttributesServiceHandler) RemoveKeyAccessServerFromValue(context.Context, *attributes.RemoveKeyAccessServerFromValueRequest) (*attributes.RemoveKeyAccessServerFromValueResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.attributes.AttributesService.RemoveKeyAccessServerFromValue is not implemented") +} + +func (UnimplementedAttributesServiceHandler) AssignPublicKeyToAttribute(context.Context, *attributes.AssignPublicKeyToAttributeRequest) (*attributes.AssignPublicKeyToAttributeResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.attributes.AttributesService.AssignPublicKeyToAttribute is not implemented") +} + +func (UnimplementedAttributesServiceHandler) RemovePublicKeyFromAttribute(context.Context, *attributes.RemovePublicKeyFromAttributeRequest) (*attributes.RemovePublicKeyFromAttributeResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.attributes.AttributesService.RemovePublicKeyFromAttribute is not implemented") +} + +func (UnimplementedAttributesServiceHandler) AssignPublicKeyToValue(context.Context, *attributes.AssignPublicKeyToValueRequest) (*attributes.AssignPublicKeyToValueResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.attributes.AttributesService.AssignPublicKeyToValue is not implemented") +} + +func (UnimplementedAttributesServiceHandler) RemovePublicKeyFromValue(context.Context, *attributes.RemovePublicKeyFromValueRequest) (*attributes.RemovePublicKeyFromValueResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.attributes.AttributesService.RemovePublicKeyFromValue is not implemented") +} + +type attributesServiceClient struct { + client *connect.Client +} + +func (c *attributesServiceClient) ListAttributes(ctx context.Context, req *attributes.ListAttributesRequest) (*attributes.ListAttributesResponse, error) { + var res attributes.ListAttributesResponse + if err := c.client.CallUnary(ctx, attributesServiceListAttributesSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *attributesServiceClient) ListAttributeValues(ctx context.Context, req *attributes.ListAttributeValuesRequest) (*attributes.ListAttributeValuesResponse, error) { + var res attributes.ListAttributeValuesResponse + if err := c.client.CallUnary(ctx, attributesServiceListAttributeValuesSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *attributesServiceClient) GetAttribute(ctx context.Context, req *attributes.GetAttributeRequest) (*attributes.GetAttributeResponse, error) { + var res attributes.GetAttributeResponse + if err := c.client.CallUnary(ctx, attributesServiceGetAttributeSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *attributesServiceClient) GetAttributeValuesByFqns(ctx context.Context, req *attributes.GetAttributeValuesByFqnsRequest) (*attributes.GetAttributeValuesByFqnsResponse, error) { + var res attributes.GetAttributeValuesByFqnsResponse + if err := c.client.CallUnary(ctx, attributesServiceGetAttributeValuesByFqnsSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *attributesServiceClient) GetKeyMappingsByFqns(ctx context.Context, req *attributes.GetKeyMappingsByFqnsRequest) (*attributes.GetKeyMappingsByFqnsResponse, error) { + var res attributes.GetKeyMappingsByFqnsResponse + if err := c.client.CallUnary(ctx, attributesServiceGetKeyMappingsByFqnsSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *attributesServiceClient) GetEntitleableAttributesByFqns(ctx context.Context, req *attributes.GetEntitleableAttributesByFqnsRequest) (*attributes.GetEntitleableAttributesByFqnsResponse, error) { + var res attributes.GetEntitleableAttributesByFqnsResponse + if err := c.client.CallUnary(ctx, attributesServiceGetEntitleableAttributesByFqnsSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *attributesServiceClient) CreateAttribute(ctx context.Context, req *attributes.CreateAttributeRequest) (*attributes.CreateAttributeResponse, error) { + var res attributes.CreateAttributeResponse + if err := c.client.CallUnary(ctx, attributesServiceCreateAttributeSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *attributesServiceClient) UpdateAttribute(ctx context.Context, req *attributes.UpdateAttributeRequest) (*attributes.UpdateAttributeResponse, error) { + var res attributes.UpdateAttributeResponse + if err := c.client.CallUnary(ctx, attributesServiceUpdateAttributeSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *attributesServiceClient) DeactivateAttribute(ctx context.Context, req *attributes.DeactivateAttributeRequest) (*attributes.DeactivateAttributeResponse, error) { + var res attributes.DeactivateAttributeResponse + if err := c.client.CallUnary(ctx, attributesServiceDeactivateAttributeSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *attributesServiceClient) GetAttributeValue(ctx context.Context, req *attributes.GetAttributeValueRequest) (*attributes.GetAttributeValueResponse, error) { + var res attributes.GetAttributeValueResponse + if err := c.client.CallUnary(ctx, attributesServiceGetAttributeValueSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *attributesServiceClient) CreateAttributeValue(ctx context.Context, req *attributes.CreateAttributeValueRequest) (*attributes.CreateAttributeValueResponse, error) { + var res attributes.CreateAttributeValueResponse + if err := c.client.CallUnary(ctx, attributesServiceCreateAttributeValueSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *attributesServiceClient) UpdateAttributeValue(ctx context.Context, req *attributes.UpdateAttributeValueRequest) (*attributes.UpdateAttributeValueResponse, error) { + var res attributes.UpdateAttributeValueResponse + if err := c.client.CallUnary(ctx, attributesServiceUpdateAttributeValueSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *attributesServiceClient) DeactivateAttributeValue(ctx context.Context, req *attributes.DeactivateAttributeValueRequest) (*attributes.DeactivateAttributeValueResponse, error) { + var res attributes.DeactivateAttributeValueResponse + if err := c.client.CallUnary(ctx, attributesServiceDeactivateAttributeValueSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *attributesServiceClient) AssignKeyAccessServerToAttribute(ctx context.Context, req *attributes.AssignKeyAccessServerToAttributeRequest) (*attributes.AssignKeyAccessServerToAttributeResponse, error) { + var res attributes.AssignKeyAccessServerToAttributeResponse + if err := c.client.CallUnary(ctx, attributesServiceAssignKeyAccessServerToAttributeSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *attributesServiceClient) RemoveKeyAccessServerFromAttribute(ctx context.Context, req *attributes.RemoveKeyAccessServerFromAttributeRequest) (*attributes.RemoveKeyAccessServerFromAttributeResponse, error) { + var res attributes.RemoveKeyAccessServerFromAttributeResponse + if err := c.client.CallUnary(ctx, attributesServiceRemoveKeyAccessServerFromAttributeSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *attributesServiceClient) AssignKeyAccessServerToValue(ctx context.Context, req *attributes.AssignKeyAccessServerToValueRequest) (*attributes.AssignKeyAccessServerToValueResponse, error) { + var res attributes.AssignKeyAccessServerToValueResponse + if err := c.client.CallUnary(ctx, attributesServiceAssignKeyAccessServerToValueSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *attributesServiceClient) RemoveKeyAccessServerFromValue(ctx context.Context, req *attributes.RemoveKeyAccessServerFromValueRequest) (*attributes.RemoveKeyAccessServerFromValueResponse, error) { + var res attributes.RemoveKeyAccessServerFromValueResponse + if err := c.client.CallUnary(ctx, attributesServiceRemoveKeyAccessServerFromValueSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *attributesServiceClient) AssignPublicKeyToAttribute(ctx context.Context, req *attributes.AssignPublicKeyToAttributeRequest) (*attributes.AssignPublicKeyToAttributeResponse, error) { + var res attributes.AssignPublicKeyToAttributeResponse + if err := c.client.CallUnary(ctx, attributesServiceAssignPublicKeyToAttributeSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *attributesServiceClient) RemovePublicKeyFromAttribute(ctx context.Context, req *attributes.RemovePublicKeyFromAttributeRequest) (*attributes.RemovePublicKeyFromAttributeResponse, error) { + var res attributes.RemovePublicKeyFromAttributeResponse + if err := c.client.CallUnary(ctx, attributesServiceRemovePublicKeyFromAttributeSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *attributesServiceClient) AssignPublicKeyToValue(ctx context.Context, req *attributes.AssignPublicKeyToValueRequest) (*attributes.AssignPublicKeyToValueResponse, error) { + var res attributes.AssignPublicKeyToValueResponse + if err := c.client.CallUnary(ctx, attributesServiceAssignPublicKeyToValueSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *attributesServiceClient) RemovePublicKeyFromValue(ctx context.Context, req *attributes.RemovePublicKeyFromValueRequest) (*attributes.RemovePublicKeyFromValueResponse, error) { + var res attributes.RemovePublicKeyFromValueResponse + if err := c.client.CallUnary(ctx, attributesServiceRemovePublicKeyFromValueSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +type attributesServiceHandler struct{ svc AttributesServiceHandler } + +func (h attributesServiceHandler) listAttributes(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req attributes.ListAttributesRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.ListAttributes(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h attributesServiceHandler) listAttributeValues(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req attributes.ListAttributeValuesRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.ListAttributeValues(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h attributesServiceHandler) getAttribute(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req attributes.GetAttributeRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.GetAttribute(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h attributesServiceHandler) getAttributeValuesByFqns(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req attributes.GetAttributeValuesByFqnsRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.GetAttributeValuesByFqns(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h attributesServiceHandler) getKeyMappingsByFqns(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req attributes.GetKeyMappingsByFqnsRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.GetKeyMappingsByFqns(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h attributesServiceHandler) getEntitleableAttributesByFqns(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req attributes.GetEntitleableAttributesByFqnsRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.GetEntitleableAttributesByFqns(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h attributesServiceHandler) createAttribute(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req attributes.CreateAttributeRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.CreateAttribute(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h attributesServiceHandler) updateAttribute(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req attributes.UpdateAttributeRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.UpdateAttribute(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h attributesServiceHandler) deactivateAttribute(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req attributes.DeactivateAttributeRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.DeactivateAttribute(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h attributesServiceHandler) getAttributeValue(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req attributes.GetAttributeValueRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.GetAttributeValue(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h attributesServiceHandler) createAttributeValue(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req attributes.CreateAttributeValueRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.CreateAttributeValue(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h attributesServiceHandler) updateAttributeValue(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req attributes.UpdateAttributeValueRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.UpdateAttributeValue(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h attributesServiceHandler) deactivateAttributeValue(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req attributes.DeactivateAttributeValueRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.DeactivateAttributeValue(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h attributesServiceHandler) assignKeyAccessServerToAttribute(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req attributes.AssignKeyAccessServerToAttributeRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.AssignKeyAccessServerToAttribute(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h attributesServiceHandler) removeKeyAccessServerFromAttribute(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req attributes.RemoveKeyAccessServerFromAttributeRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.RemoveKeyAccessServerFromAttribute(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h attributesServiceHandler) assignKeyAccessServerToValue(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req attributes.AssignKeyAccessServerToValueRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.AssignKeyAccessServerToValue(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h attributesServiceHandler) removeKeyAccessServerFromValue(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req attributes.RemoveKeyAccessServerFromValueRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.RemoveKeyAccessServerFromValue(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h attributesServiceHandler) assignPublicKeyToAttribute(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req attributes.AssignPublicKeyToAttributeRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.AssignPublicKeyToAttribute(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h attributesServiceHandler) removePublicKeyFromAttribute(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req attributes.RemovePublicKeyFromAttributeRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.RemovePublicKeyFromAttribute(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h attributesServiceHandler) assignPublicKeyToValue(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req attributes.AssignPublicKeyToValueRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.AssignPublicKeyToValue(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h attributesServiceHandler) removePublicKeyFromValue(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req attributes.RemovePublicKeyFromValueRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.RemovePublicKeyFromValue(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} diff --git a/protocol/go/policy/dynamicvaluemapping/dynamicvaluemappingconnectv2/dynamic_value_mapping.connect.go b/protocol/go/policy/dynamicvaluemapping/dynamicvaluemappingconnectv2/dynamic_value_mapping.connect.go new file mode 100644 index 0000000000..7daa8f10d1 --- /dev/null +++ b/protocol/go/policy/dynamicvaluemapping/dynamicvaluemappingconnectv2/dynamic_value_mapping.connect.go @@ -0,0 +1,254 @@ +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: policy/dynamicvaluemapping/dynamic_value_mapping.proto + +package dynamicvaluemappingconnectv2 + +import ( + connect "connectrpc.com/connect/v2" + context "context" + dynamicvaluemapping "github.com/opentdf/platform/protocol/go/policy/dynamicvaluemapping" + sync "sync" +) + +const ( + // DynamicValueMappingServiceName is the fully-qualified name of the DynamicValueMappingService + // service. + DynamicValueMappingServiceName = "policy.dynamicvaluemapping.DynamicValueMappingService" +) + +// These constants are the procedure names of the RPCs defined in this package. They're exposed at +// runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // DynamicValueMappingServiceListDynamicValueMappingsProcedure is the procedure name of the + // DynamicValueMappingService's ListDynamicValueMappings RPC. + DynamicValueMappingServiceListDynamicValueMappingsProcedure = "/policy.dynamicvaluemapping.DynamicValueMappingService/ListDynamicValueMappings" + // DynamicValueMappingServiceGetDynamicValueMappingProcedure is the procedure name of the + // DynamicValueMappingService's GetDynamicValueMapping RPC. + DynamicValueMappingServiceGetDynamicValueMappingProcedure = "/policy.dynamicvaluemapping.DynamicValueMappingService/GetDynamicValueMapping" + // DynamicValueMappingServiceCreateDynamicValueMappingProcedure is the procedure name of the + // DynamicValueMappingService's CreateDynamicValueMapping RPC. + DynamicValueMappingServiceCreateDynamicValueMappingProcedure = "/policy.dynamicvaluemapping.DynamicValueMappingService/CreateDynamicValueMapping" + // DynamicValueMappingServiceUpdateDynamicValueMappingProcedure is the procedure name of the + // DynamicValueMappingService's UpdateDynamicValueMapping RPC. + DynamicValueMappingServiceUpdateDynamicValueMappingProcedure = "/policy.dynamicvaluemapping.DynamicValueMappingService/UpdateDynamicValueMapping" + // DynamicValueMappingServiceDeleteDynamicValueMappingProcedure is the procedure name of the + // DynamicValueMappingService's DeleteDynamicValueMapping RPC. + DynamicValueMappingServiceDeleteDynamicValueMappingProcedure = "/policy.dynamicvaluemapping.DynamicValueMappingService/DeleteDynamicValueMapping" +) + +var ( + dynamicValueMappingServiceListDynamicValueMappingsSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: dynamicvaluemapping.File_policy_dynamicvaluemapping_dynamic_value_mapping_proto.Services().ByName("DynamicValueMappingService").Methods().ByName("ListDynamicValueMappings"), + Procedure: DynamicValueMappingServiceListDynamicValueMappingsProcedure, + IdempotencyLevel: connect.IdempotencyNoSideEffects, + } + }) + dynamicValueMappingServiceGetDynamicValueMappingSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: dynamicvaluemapping.File_policy_dynamicvaluemapping_dynamic_value_mapping_proto.Services().ByName("DynamicValueMappingService").Methods().ByName("GetDynamicValueMapping"), + Procedure: DynamicValueMappingServiceGetDynamicValueMappingProcedure, + IdempotencyLevel: connect.IdempotencyNoSideEffects, + } + }) + dynamicValueMappingServiceCreateDynamicValueMappingSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: dynamicvaluemapping.File_policy_dynamicvaluemapping_dynamic_value_mapping_proto.Services().ByName("DynamicValueMappingService").Methods().ByName("CreateDynamicValueMapping"), + Procedure: DynamicValueMappingServiceCreateDynamicValueMappingProcedure, + } + }) + dynamicValueMappingServiceUpdateDynamicValueMappingSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: dynamicvaluemapping.File_policy_dynamicvaluemapping_dynamic_value_mapping_proto.Services().ByName("DynamicValueMappingService").Methods().ByName("UpdateDynamicValueMapping"), + Procedure: DynamicValueMappingServiceUpdateDynamicValueMappingProcedure, + } + }) + dynamicValueMappingServiceDeleteDynamicValueMappingSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: dynamicvaluemapping.File_policy_dynamicvaluemapping_dynamic_value_mapping_proto.Services().ByName("DynamicValueMappingService").Methods().ByName("DeleteDynamicValueMapping"), + Procedure: DynamicValueMappingServiceDeleteDynamicValueMappingProcedure, + } + }) +) + +// DynamicValueMappingServiceClient is a client for the +// policy.dynamicvaluemapping.DynamicValueMappingService service. +type DynamicValueMappingServiceClient interface { + ListDynamicValueMappings(context.Context, *dynamicvaluemapping.ListDynamicValueMappingsRequest) (*dynamicvaluemapping.ListDynamicValueMappingsResponse, error) + GetDynamicValueMapping(context.Context, *dynamicvaluemapping.GetDynamicValueMappingRequest) (*dynamicvaluemapping.GetDynamicValueMappingResponse, error) + CreateDynamicValueMapping(context.Context, *dynamicvaluemapping.CreateDynamicValueMappingRequest) (*dynamicvaluemapping.CreateDynamicValueMappingResponse, error) + UpdateDynamicValueMapping(context.Context, *dynamicvaluemapping.UpdateDynamicValueMappingRequest) (*dynamicvaluemapping.UpdateDynamicValueMappingResponse, error) + DeleteDynamicValueMapping(context.Context, *dynamicvaluemapping.DeleteDynamicValueMappingRequest) (*dynamicvaluemapping.DeleteDynamicValueMappingResponse, error) +} + +// NewDynamicValueMappingServiceClient constructs a client for the +// policy.dynamicvaluemapping.DynamicValueMappingService service. Multiple service clients may share +// a single connect.Client. +func NewDynamicValueMappingServiceClient(client *connect.Client) DynamicValueMappingServiceClient { + return &dynamicValueMappingServiceClient{client: client} +} + +// DynamicValueMappingServiceHandler is an implementation of the +// policy.dynamicvaluemapping.DynamicValueMappingService service. +type DynamicValueMappingServiceHandler interface { + ListDynamicValueMappings(context.Context, *dynamicvaluemapping.ListDynamicValueMappingsRequest) (*dynamicvaluemapping.ListDynamicValueMappingsResponse, error) + GetDynamicValueMapping(context.Context, *dynamicvaluemapping.GetDynamicValueMappingRequest) (*dynamicvaluemapping.GetDynamicValueMappingResponse, error) + CreateDynamicValueMapping(context.Context, *dynamicvaluemapping.CreateDynamicValueMappingRequest) (*dynamicvaluemapping.CreateDynamicValueMappingResponse, error) + UpdateDynamicValueMapping(context.Context, *dynamicvaluemapping.UpdateDynamicValueMappingRequest) (*dynamicvaluemapping.UpdateDynamicValueMappingResponse, error) + DeleteDynamicValueMapping(context.Context, *dynamicvaluemapping.DeleteDynamicValueMappingRequest) (*dynamicvaluemapping.DeleteDynamicValueMappingResponse, error) +} + +// RegisterDynamicValueMappingServiceHandler registers svc as the +// policy.dynamicvaluemapping.DynamicValueMappingService implementation on server. +func RegisterDynamicValueMappingServiceHandler(server *connect.Server, svc DynamicValueMappingServiceHandler) { + adapter := dynamicValueMappingServiceHandler{svc: svc} + server.Register( + connect.Method{Spec: dynamicValueMappingServiceListDynamicValueMappingsSpec(), Handler: adapter.listDynamicValueMappings}, + connect.Method{Spec: dynamicValueMappingServiceGetDynamicValueMappingSpec(), Handler: adapter.getDynamicValueMapping}, + connect.Method{Spec: dynamicValueMappingServiceCreateDynamicValueMappingSpec(), Handler: adapter.createDynamicValueMapping}, + connect.Method{Spec: dynamicValueMappingServiceUpdateDynamicValueMappingSpec(), Handler: adapter.updateDynamicValueMapping}, + connect.Method{Spec: dynamicValueMappingServiceDeleteDynamicValueMappingSpec(), Handler: adapter.deleteDynamicValueMapping}, + ) +} + +// UnimplementedDynamicValueMappingServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedDynamicValueMappingServiceHandler struct{} + +func (UnimplementedDynamicValueMappingServiceHandler) ListDynamicValueMappings(context.Context, *dynamicvaluemapping.ListDynamicValueMappingsRequest) (*dynamicvaluemapping.ListDynamicValueMappingsResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.dynamicvaluemapping.DynamicValueMappingService.ListDynamicValueMappings is not implemented") +} + +func (UnimplementedDynamicValueMappingServiceHandler) GetDynamicValueMapping(context.Context, *dynamicvaluemapping.GetDynamicValueMappingRequest) (*dynamicvaluemapping.GetDynamicValueMappingResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.dynamicvaluemapping.DynamicValueMappingService.GetDynamicValueMapping is not implemented") +} + +func (UnimplementedDynamicValueMappingServiceHandler) CreateDynamicValueMapping(context.Context, *dynamicvaluemapping.CreateDynamicValueMappingRequest) (*dynamicvaluemapping.CreateDynamicValueMappingResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.dynamicvaluemapping.DynamicValueMappingService.CreateDynamicValueMapping is not implemented") +} + +func (UnimplementedDynamicValueMappingServiceHandler) UpdateDynamicValueMapping(context.Context, *dynamicvaluemapping.UpdateDynamicValueMappingRequest) (*dynamicvaluemapping.UpdateDynamicValueMappingResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.dynamicvaluemapping.DynamicValueMappingService.UpdateDynamicValueMapping is not implemented") +} + +func (UnimplementedDynamicValueMappingServiceHandler) DeleteDynamicValueMapping(context.Context, *dynamicvaluemapping.DeleteDynamicValueMappingRequest) (*dynamicvaluemapping.DeleteDynamicValueMappingResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.dynamicvaluemapping.DynamicValueMappingService.DeleteDynamicValueMapping is not implemented") +} + +type dynamicValueMappingServiceClient struct { + client *connect.Client +} + +func (c *dynamicValueMappingServiceClient) ListDynamicValueMappings(ctx context.Context, req *dynamicvaluemapping.ListDynamicValueMappingsRequest) (*dynamicvaluemapping.ListDynamicValueMappingsResponse, error) { + var res dynamicvaluemapping.ListDynamicValueMappingsResponse + if err := c.client.CallUnary(ctx, dynamicValueMappingServiceListDynamicValueMappingsSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *dynamicValueMappingServiceClient) GetDynamicValueMapping(ctx context.Context, req *dynamicvaluemapping.GetDynamicValueMappingRequest) (*dynamicvaluemapping.GetDynamicValueMappingResponse, error) { + var res dynamicvaluemapping.GetDynamicValueMappingResponse + if err := c.client.CallUnary(ctx, dynamicValueMappingServiceGetDynamicValueMappingSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *dynamicValueMappingServiceClient) CreateDynamicValueMapping(ctx context.Context, req *dynamicvaluemapping.CreateDynamicValueMappingRequest) (*dynamicvaluemapping.CreateDynamicValueMappingResponse, error) { + var res dynamicvaluemapping.CreateDynamicValueMappingResponse + if err := c.client.CallUnary(ctx, dynamicValueMappingServiceCreateDynamicValueMappingSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *dynamicValueMappingServiceClient) UpdateDynamicValueMapping(ctx context.Context, req *dynamicvaluemapping.UpdateDynamicValueMappingRequest) (*dynamicvaluemapping.UpdateDynamicValueMappingResponse, error) { + var res dynamicvaluemapping.UpdateDynamicValueMappingResponse + if err := c.client.CallUnary(ctx, dynamicValueMappingServiceUpdateDynamicValueMappingSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *dynamicValueMappingServiceClient) DeleteDynamicValueMapping(ctx context.Context, req *dynamicvaluemapping.DeleteDynamicValueMappingRequest) (*dynamicvaluemapping.DeleteDynamicValueMappingResponse, error) { + var res dynamicvaluemapping.DeleteDynamicValueMappingResponse + if err := c.client.CallUnary(ctx, dynamicValueMappingServiceDeleteDynamicValueMappingSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +type dynamicValueMappingServiceHandler struct { + svc DynamicValueMappingServiceHandler +} + +func (h dynamicValueMappingServiceHandler) listDynamicValueMappings(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req dynamicvaluemapping.ListDynamicValueMappingsRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.ListDynamicValueMappings(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h dynamicValueMappingServiceHandler) getDynamicValueMapping(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req dynamicvaluemapping.GetDynamicValueMappingRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.GetDynamicValueMapping(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h dynamicValueMappingServiceHandler) createDynamicValueMapping(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req dynamicvaluemapping.CreateDynamicValueMappingRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.CreateDynamicValueMapping(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h dynamicValueMappingServiceHandler) updateDynamicValueMapping(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req dynamicvaluemapping.UpdateDynamicValueMappingRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.UpdateDynamicValueMapping(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h dynamicValueMappingServiceHandler) deleteDynamicValueMapping(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req dynamicvaluemapping.DeleteDynamicValueMappingRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.DeleteDynamicValueMapping(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} diff --git a/protocol/go/policy/kasregistry/kasregistryconnectv2/key_access_server_registry.connect.go b/protocol/go/policy/kasregistry/kasregistryconnectv2/key_access_server_registry.connect.go new file mode 100644 index 0000000000..40c3883559 --- /dev/null +++ b/protocol/go/policy/kasregistry/kasregistryconnectv2/key_access_server_registry.connect.go @@ -0,0 +1,612 @@ +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: policy/kasregistry/key_access_server_registry.proto + +package kasregistryconnectv2 + +import ( + connect "connectrpc.com/connect/v2" + context "context" + kasregistry "github.com/opentdf/platform/protocol/go/policy/kasregistry" + sync "sync" +) + +const ( + // KeyAccessServerRegistryServiceName is the fully-qualified name of the + // KeyAccessServerRegistryService service. + KeyAccessServerRegistryServiceName = "policy.kasregistry.KeyAccessServerRegistryService" +) + +// These constants are the procedure names of the RPCs defined in this package. They're exposed at +// runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // KeyAccessServerRegistryServiceListKeyAccessServersProcedure is the procedure name of the + // KeyAccessServerRegistryService's ListKeyAccessServers RPC. + KeyAccessServerRegistryServiceListKeyAccessServersProcedure = "/policy.kasregistry.KeyAccessServerRegistryService/ListKeyAccessServers" + // KeyAccessServerRegistryServiceGetKeyAccessServerProcedure is the procedure name of the + // KeyAccessServerRegistryService's GetKeyAccessServer RPC. + KeyAccessServerRegistryServiceGetKeyAccessServerProcedure = "/policy.kasregistry.KeyAccessServerRegistryService/GetKeyAccessServer" + // KeyAccessServerRegistryServiceCreateKeyAccessServerProcedure is the procedure name of the + // KeyAccessServerRegistryService's CreateKeyAccessServer RPC. + KeyAccessServerRegistryServiceCreateKeyAccessServerProcedure = "/policy.kasregistry.KeyAccessServerRegistryService/CreateKeyAccessServer" + // KeyAccessServerRegistryServiceUpdateKeyAccessServerProcedure is the procedure name of the + // KeyAccessServerRegistryService's UpdateKeyAccessServer RPC. + KeyAccessServerRegistryServiceUpdateKeyAccessServerProcedure = "/policy.kasregistry.KeyAccessServerRegistryService/UpdateKeyAccessServer" + // KeyAccessServerRegistryServiceDeleteKeyAccessServerProcedure is the procedure name of the + // KeyAccessServerRegistryService's DeleteKeyAccessServer RPC. + KeyAccessServerRegistryServiceDeleteKeyAccessServerProcedure = "/policy.kasregistry.KeyAccessServerRegistryService/DeleteKeyAccessServer" + // KeyAccessServerRegistryServiceListKeyAccessServerGrantsProcedure is the procedure name of the + // KeyAccessServerRegistryService's ListKeyAccessServerGrants RPC. + KeyAccessServerRegistryServiceListKeyAccessServerGrantsProcedure = "/policy.kasregistry.KeyAccessServerRegistryService/ListKeyAccessServerGrants" + // KeyAccessServerRegistryServiceCreateKeyProcedure is the procedure name of the + // KeyAccessServerRegistryService's CreateKey RPC. + KeyAccessServerRegistryServiceCreateKeyProcedure = "/policy.kasregistry.KeyAccessServerRegistryService/CreateKey" + // KeyAccessServerRegistryServiceGetKeyProcedure is the procedure name of the + // KeyAccessServerRegistryService's GetKey RPC. + KeyAccessServerRegistryServiceGetKeyProcedure = "/policy.kasregistry.KeyAccessServerRegistryService/GetKey" + // KeyAccessServerRegistryServiceListKeysProcedure is the procedure name of the + // KeyAccessServerRegistryService's ListKeys RPC. + KeyAccessServerRegistryServiceListKeysProcedure = "/policy.kasregistry.KeyAccessServerRegistryService/ListKeys" + // KeyAccessServerRegistryServiceUpdateKeyProcedure is the procedure name of the + // KeyAccessServerRegistryService's UpdateKey RPC. + KeyAccessServerRegistryServiceUpdateKeyProcedure = "/policy.kasregistry.KeyAccessServerRegistryService/UpdateKey" + // KeyAccessServerRegistryServiceRotateKeyProcedure is the procedure name of the + // KeyAccessServerRegistryService's RotateKey RPC. + KeyAccessServerRegistryServiceRotateKeyProcedure = "/policy.kasregistry.KeyAccessServerRegistryService/RotateKey" + // KeyAccessServerRegistryServiceSetBaseKeyProcedure is the procedure name of the + // KeyAccessServerRegistryService's SetBaseKey RPC. + KeyAccessServerRegistryServiceSetBaseKeyProcedure = "/policy.kasregistry.KeyAccessServerRegistryService/SetBaseKey" + // KeyAccessServerRegistryServiceGetBaseKeyProcedure is the procedure name of the + // KeyAccessServerRegistryService's GetBaseKey RPC. + KeyAccessServerRegistryServiceGetBaseKeyProcedure = "/policy.kasregistry.KeyAccessServerRegistryService/GetBaseKey" + // KeyAccessServerRegistryServiceListKeyMappingsProcedure is the procedure name of the + // KeyAccessServerRegistryService's ListKeyMappings RPC. + KeyAccessServerRegistryServiceListKeyMappingsProcedure = "/policy.kasregistry.KeyAccessServerRegistryService/ListKeyMappings" +) + +var ( + keyAccessServerRegistryServiceListKeyAccessServersSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: kasregistry.File_policy_kasregistry_key_access_server_registry_proto.Services().ByName("KeyAccessServerRegistryService").Methods().ByName("ListKeyAccessServers"), + Procedure: KeyAccessServerRegistryServiceListKeyAccessServersProcedure, + IdempotencyLevel: connect.IdempotencyNoSideEffects, + } + }) + keyAccessServerRegistryServiceGetKeyAccessServerSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: kasregistry.File_policy_kasregistry_key_access_server_registry_proto.Services().ByName("KeyAccessServerRegistryService").Methods().ByName("GetKeyAccessServer"), + Procedure: KeyAccessServerRegistryServiceGetKeyAccessServerProcedure, + IdempotencyLevel: connect.IdempotencyNoSideEffects, + } + }) + keyAccessServerRegistryServiceCreateKeyAccessServerSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: kasregistry.File_policy_kasregistry_key_access_server_registry_proto.Services().ByName("KeyAccessServerRegistryService").Methods().ByName("CreateKeyAccessServer"), + Procedure: KeyAccessServerRegistryServiceCreateKeyAccessServerProcedure, + } + }) + keyAccessServerRegistryServiceUpdateKeyAccessServerSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: kasregistry.File_policy_kasregistry_key_access_server_registry_proto.Services().ByName("KeyAccessServerRegistryService").Methods().ByName("UpdateKeyAccessServer"), + Procedure: KeyAccessServerRegistryServiceUpdateKeyAccessServerProcedure, + } + }) + keyAccessServerRegistryServiceDeleteKeyAccessServerSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: kasregistry.File_policy_kasregistry_key_access_server_registry_proto.Services().ByName("KeyAccessServerRegistryService").Methods().ByName("DeleteKeyAccessServer"), + Procedure: KeyAccessServerRegistryServiceDeleteKeyAccessServerProcedure, + } + }) + keyAccessServerRegistryServiceListKeyAccessServerGrantsSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: kasregistry.File_policy_kasregistry_key_access_server_registry_proto.Services().ByName("KeyAccessServerRegistryService").Methods().ByName("ListKeyAccessServerGrants"), + Procedure: KeyAccessServerRegistryServiceListKeyAccessServerGrantsProcedure, + IdempotencyLevel: connect.IdempotencyNoSideEffects, + } + }) + keyAccessServerRegistryServiceCreateKeySpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: kasregistry.File_policy_kasregistry_key_access_server_registry_proto.Services().ByName("KeyAccessServerRegistryService").Methods().ByName("CreateKey"), + Procedure: KeyAccessServerRegistryServiceCreateKeyProcedure, + } + }) + keyAccessServerRegistryServiceGetKeySpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: kasregistry.File_policy_kasregistry_key_access_server_registry_proto.Services().ByName("KeyAccessServerRegistryService").Methods().ByName("GetKey"), + Procedure: KeyAccessServerRegistryServiceGetKeyProcedure, + } + }) + keyAccessServerRegistryServiceListKeysSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: kasregistry.File_policy_kasregistry_key_access_server_registry_proto.Services().ByName("KeyAccessServerRegistryService").Methods().ByName("ListKeys"), + Procedure: KeyAccessServerRegistryServiceListKeysProcedure, + } + }) + keyAccessServerRegistryServiceUpdateKeySpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: kasregistry.File_policy_kasregistry_key_access_server_registry_proto.Services().ByName("KeyAccessServerRegistryService").Methods().ByName("UpdateKey"), + Procedure: KeyAccessServerRegistryServiceUpdateKeyProcedure, + } + }) + keyAccessServerRegistryServiceRotateKeySpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: kasregistry.File_policy_kasregistry_key_access_server_registry_proto.Services().ByName("KeyAccessServerRegistryService").Methods().ByName("RotateKey"), + Procedure: KeyAccessServerRegistryServiceRotateKeyProcedure, + } + }) + keyAccessServerRegistryServiceSetBaseKeySpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: kasregistry.File_policy_kasregistry_key_access_server_registry_proto.Services().ByName("KeyAccessServerRegistryService").Methods().ByName("SetBaseKey"), + Procedure: KeyAccessServerRegistryServiceSetBaseKeyProcedure, + } + }) + keyAccessServerRegistryServiceGetBaseKeySpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: kasregistry.File_policy_kasregistry_key_access_server_registry_proto.Services().ByName("KeyAccessServerRegistryService").Methods().ByName("GetBaseKey"), + Procedure: KeyAccessServerRegistryServiceGetBaseKeyProcedure, + } + }) + keyAccessServerRegistryServiceListKeyMappingsSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: kasregistry.File_policy_kasregistry_key_access_server_registry_proto.Services().ByName("KeyAccessServerRegistryService").Methods().ByName("ListKeyMappings"), + Procedure: KeyAccessServerRegistryServiceListKeyMappingsProcedure, + } + }) +) + +// KeyAccessServerRegistryServiceClient is a client for the +// policy.kasregistry.KeyAccessServerRegistryService service. +type KeyAccessServerRegistryServiceClient interface { + ListKeyAccessServers(context.Context, *kasregistry.ListKeyAccessServersRequest) (*kasregistry.ListKeyAccessServersResponse, error) + GetKeyAccessServer(context.Context, *kasregistry.GetKeyAccessServerRequest) (*kasregistry.GetKeyAccessServerResponse, error) + CreateKeyAccessServer(context.Context, *kasregistry.CreateKeyAccessServerRequest) (*kasregistry.CreateKeyAccessServerResponse, error) + UpdateKeyAccessServer(context.Context, *kasregistry.UpdateKeyAccessServerRequest) (*kasregistry.UpdateKeyAccessServerResponse, error) + DeleteKeyAccessServer(context.Context, *kasregistry.DeleteKeyAccessServerRequest) (*kasregistry.DeleteKeyAccessServerResponse, error) + // Deprecated + // + // Deprecated: do not use. + ListKeyAccessServerGrants(context.Context, *kasregistry.ListKeyAccessServerGrantsRequest) (*kasregistry.ListKeyAccessServerGrantsResponse, error) + // KAS Key Management + // Request to create a new key in the Key Access Service. + CreateKey(context.Context, *kasregistry.CreateKeyRequest) (*kasregistry.CreateKeyResponse, error) + // Request to retrieve a key from the Key Access Service. + GetKey(context.Context, *kasregistry.GetKeyRequest) (*kasregistry.GetKeyResponse, error) + // Request to list keys in the Key Access Service. + ListKeys(context.Context, *kasregistry.ListKeysRequest) (*kasregistry.ListKeysResponse, error) + // Request to update a key in the Key Access Service. + UpdateKey(context.Context, *kasregistry.UpdateKeyRequest) (*kasregistry.UpdateKeyResponse, error) + // Request to rotate a key in the Key Access Service. + RotateKey(context.Context, *kasregistry.RotateKeyRequest) (*kasregistry.RotateKeyResponse, error) + // Request to set the default a default kas key. + SetBaseKey(context.Context, *kasregistry.SetBaseKeyRequest) (*kasregistry.SetBaseKeyResponse, error) + // Get Default kas keys + GetBaseKey(context.Context, *kasregistry.GetBaseKeyRequest) (*kasregistry.GetBaseKeyResponse, error) + // Request to list key mappings in the Key Access Service. + ListKeyMappings(context.Context, *kasregistry.ListKeyMappingsRequest) (*kasregistry.ListKeyMappingsResponse, error) +} + +// NewKeyAccessServerRegistryServiceClient constructs a client for the +// policy.kasregistry.KeyAccessServerRegistryService service. Multiple service clients may share a +// single connect.Client. +func NewKeyAccessServerRegistryServiceClient(client *connect.Client) KeyAccessServerRegistryServiceClient { + return &keyAccessServerRegistryServiceClient{client: client} +} + +// KeyAccessServerRegistryServiceHandler is an implementation of the +// policy.kasregistry.KeyAccessServerRegistryService service. +type KeyAccessServerRegistryServiceHandler interface { + ListKeyAccessServers(context.Context, *kasregistry.ListKeyAccessServersRequest) (*kasregistry.ListKeyAccessServersResponse, error) + GetKeyAccessServer(context.Context, *kasregistry.GetKeyAccessServerRequest) (*kasregistry.GetKeyAccessServerResponse, error) + CreateKeyAccessServer(context.Context, *kasregistry.CreateKeyAccessServerRequest) (*kasregistry.CreateKeyAccessServerResponse, error) + UpdateKeyAccessServer(context.Context, *kasregistry.UpdateKeyAccessServerRequest) (*kasregistry.UpdateKeyAccessServerResponse, error) + DeleteKeyAccessServer(context.Context, *kasregistry.DeleteKeyAccessServerRequest) (*kasregistry.DeleteKeyAccessServerResponse, error) + // Deprecated + // + // Deprecated: do not use. + ListKeyAccessServerGrants(context.Context, *kasregistry.ListKeyAccessServerGrantsRequest) (*kasregistry.ListKeyAccessServerGrantsResponse, error) + // KAS Key Management + // Request to create a new key in the Key Access Service. + CreateKey(context.Context, *kasregistry.CreateKeyRequest) (*kasregistry.CreateKeyResponse, error) + // Request to retrieve a key from the Key Access Service. + GetKey(context.Context, *kasregistry.GetKeyRequest) (*kasregistry.GetKeyResponse, error) + // Request to list keys in the Key Access Service. + ListKeys(context.Context, *kasregistry.ListKeysRequest) (*kasregistry.ListKeysResponse, error) + // Request to update a key in the Key Access Service. + UpdateKey(context.Context, *kasregistry.UpdateKeyRequest) (*kasregistry.UpdateKeyResponse, error) + // Request to rotate a key in the Key Access Service. + RotateKey(context.Context, *kasregistry.RotateKeyRequest) (*kasregistry.RotateKeyResponse, error) + // Request to set the default a default kas key. + SetBaseKey(context.Context, *kasregistry.SetBaseKeyRequest) (*kasregistry.SetBaseKeyResponse, error) + // Get Default kas keys + GetBaseKey(context.Context, *kasregistry.GetBaseKeyRequest) (*kasregistry.GetBaseKeyResponse, error) + // Request to list key mappings in the Key Access Service. + ListKeyMappings(context.Context, *kasregistry.ListKeyMappingsRequest) (*kasregistry.ListKeyMappingsResponse, error) +} + +// RegisterKeyAccessServerRegistryServiceHandler registers svc as the +// policy.kasregistry.KeyAccessServerRegistryService implementation on server. +func RegisterKeyAccessServerRegistryServiceHandler(server *connect.Server, svc KeyAccessServerRegistryServiceHandler) { + adapter := keyAccessServerRegistryServiceHandler{svc: svc} + server.Register( + connect.Method{Spec: keyAccessServerRegistryServiceListKeyAccessServersSpec(), Handler: adapter.listKeyAccessServers}, + connect.Method{Spec: keyAccessServerRegistryServiceGetKeyAccessServerSpec(), Handler: adapter.getKeyAccessServer}, + connect.Method{Spec: keyAccessServerRegistryServiceCreateKeyAccessServerSpec(), Handler: adapter.createKeyAccessServer}, + connect.Method{Spec: keyAccessServerRegistryServiceUpdateKeyAccessServerSpec(), Handler: adapter.updateKeyAccessServer}, + connect.Method{Spec: keyAccessServerRegistryServiceDeleteKeyAccessServerSpec(), Handler: adapter.deleteKeyAccessServer}, + connect.Method{Spec: keyAccessServerRegistryServiceListKeyAccessServerGrantsSpec(), Handler: adapter.listKeyAccessServerGrants}, + connect.Method{Spec: keyAccessServerRegistryServiceCreateKeySpec(), Handler: adapter.createKey}, + connect.Method{Spec: keyAccessServerRegistryServiceGetKeySpec(), Handler: adapter.getKey}, + connect.Method{Spec: keyAccessServerRegistryServiceListKeysSpec(), Handler: adapter.listKeys}, + connect.Method{Spec: keyAccessServerRegistryServiceUpdateKeySpec(), Handler: adapter.updateKey}, + connect.Method{Spec: keyAccessServerRegistryServiceRotateKeySpec(), Handler: adapter.rotateKey}, + connect.Method{Spec: keyAccessServerRegistryServiceSetBaseKeySpec(), Handler: adapter.setBaseKey}, + connect.Method{Spec: keyAccessServerRegistryServiceGetBaseKeySpec(), Handler: adapter.getBaseKey}, + connect.Method{Spec: keyAccessServerRegistryServiceListKeyMappingsSpec(), Handler: adapter.listKeyMappings}, + ) +} + +// UnimplementedKeyAccessServerRegistryServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedKeyAccessServerRegistryServiceHandler struct{} + +func (UnimplementedKeyAccessServerRegistryServiceHandler) ListKeyAccessServers(context.Context, *kasregistry.ListKeyAccessServersRequest) (*kasregistry.ListKeyAccessServersResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.kasregistry.KeyAccessServerRegistryService.ListKeyAccessServers is not implemented") +} + +func (UnimplementedKeyAccessServerRegistryServiceHandler) GetKeyAccessServer(context.Context, *kasregistry.GetKeyAccessServerRequest) (*kasregistry.GetKeyAccessServerResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.kasregistry.KeyAccessServerRegistryService.GetKeyAccessServer is not implemented") +} + +func (UnimplementedKeyAccessServerRegistryServiceHandler) CreateKeyAccessServer(context.Context, *kasregistry.CreateKeyAccessServerRequest) (*kasregistry.CreateKeyAccessServerResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.kasregistry.KeyAccessServerRegistryService.CreateKeyAccessServer is not implemented") +} + +func (UnimplementedKeyAccessServerRegistryServiceHandler) UpdateKeyAccessServer(context.Context, *kasregistry.UpdateKeyAccessServerRequest) (*kasregistry.UpdateKeyAccessServerResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.kasregistry.KeyAccessServerRegistryService.UpdateKeyAccessServer is not implemented") +} + +func (UnimplementedKeyAccessServerRegistryServiceHandler) DeleteKeyAccessServer(context.Context, *kasregistry.DeleteKeyAccessServerRequest) (*kasregistry.DeleteKeyAccessServerResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.kasregistry.KeyAccessServerRegistryService.DeleteKeyAccessServer is not implemented") +} + +func (UnimplementedKeyAccessServerRegistryServiceHandler) ListKeyAccessServerGrants(context.Context, *kasregistry.ListKeyAccessServerGrantsRequest) (*kasregistry.ListKeyAccessServerGrantsResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.kasregistry.KeyAccessServerRegistryService.ListKeyAccessServerGrants is not implemented") +} + +func (UnimplementedKeyAccessServerRegistryServiceHandler) CreateKey(context.Context, *kasregistry.CreateKeyRequest) (*kasregistry.CreateKeyResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.kasregistry.KeyAccessServerRegistryService.CreateKey is not implemented") +} + +func (UnimplementedKeyAccessServerRegistryServiceHandler) GetKey(context.Context, *kasregistry.GetKeyRequest) (*kasregistry.GetKeyResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.kasregistry.KeyAccessServerRegistryService.GetKey is not implemented") +} + +func (UnimplementedKeyAccessServerRegistryServiceHandler) ListKeys(context.Context, *kasregistry.ListKeysRequest) (*kasregistry.ListKeysResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.kasregistry.KeyAccessServerRegistryService.ListKeys is not implemented") +} + +func (UnimplementedKeyAccessServerRegistryServiceHandler) UpdateKey(context.Context, *kasregistry.UpdateKeyRequest) (*kasregistry.UpdateKeyResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.kasregistry.KeyAccessServerRegistryService.UpdateKey is not implemented") +} + +func (UnimplementedKeyAccessServerRegistryServiceHandler) RotateKey(context.Context, *kasregistry.RotateKeyRequest) (*kasregistry.RotateKeyResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.kasregistry.KeyAccessServerRegistryService.RotateKey is not implemented") +} + +func (UnimplementedKeyAccessServerRegistryServiceHandler) SetBaseKey(context.Context, *kasregistry.SetBaseKeyRequest) (*kasregistry.SetBaseKeyResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.kasregistry.KeyAccessServerRegistryService.SetBaseKey is not implemented") +} + +func (UnimplementedKeyAccessServerRegistryServiceHandler) GetBaseKey(context.Context, *kasregistry.GetBaseKeyRequest) (*kasregistry.GetBaseKeyResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.kasregistry.KeyAccessServerRegistryService.GetBaseKey is not implemented") +} + +func (UnimplementedKeyAccessServerRegistryServiceHandler) ListKeyMappings(context.Context, *kasregistry.ListKeyMappingsRequest) (*kasregistry.ListKeyMappingsResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.kasregistry.KeyAccessServerRegistryService.ListKeyMappings is not implemented") +} + +type keyAccessServerRegistryServiceClient struct { + client *connect.Client +} + +func (c *keyAccessServerRegistryServiceClient) ListKeyAccessServers(ctx context.Context, req *kasregistry.ListKeyAccessServersRequest) (*kasregistry.ListKeyAccessServersResponse, error) { + var res kasregistry.ListKeyAccessServersResponse + if err := c.client.CallUnary(ctx, keyAccessServerRegistryServiceListKeyAccessServersSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *keyAccessServerRegistryServiceClient) GetKeyAccessServer(ctx context.Context, req *kasregistry.GetKeyAccessServerRequest) (*kasregistry.GetKeyAccessServerResponse, error) { + var res kasregistry.GetKeyAccessServerResponse + if err := c.client.CallUnary(ctx, keyAccessServerRegistryServiceGetKeyAccessServerSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *keyAccessServerRegistryServiceClient) CreateKeyAccessServer(ctx context.Context, req *kasregistry.CreateKeyAccessServerRequest) (*kasregistry.CreateKeyAccessServerResponse, error) { + var res kasregistry.CreateKeyAccessServerResponse + if err := c.client.CallUnary(ctx, keyAccessServerRegistryServiceCreateKeyAccessServerSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *keyAccessServerRegistryServiceClient) UpdateKeyAccessServer(ctx context.Context, req *kasregistry.UpdateKeyAccessServerRequest) (*kasregistry.UpdateKeyAccessServerResponse, error) { + var res kasregistry.UpdateKeyAccessServerResponse + if err := c.client.CallUnary(ctx, keyAccessServerRegistryServiceUpdateKeyAccessServerSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *keyAccessServerRegistryServiceClient) DeleteKeyAccessServer(ctx context.Context, req *kasregistry.DeleteKeyAccessServerRequest) (*kasregistry.DeleteKeyAccessServerResponse, error) { + var res kasregistry.DeleteKeyAccessServerResponse + if err := c.client.CallUnary(ctx, keyAccessServerRegistryServiceDeleteKeyAccessServerSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *keyAccessServerRegistryServiceClient) ListKeyAccessServerGrants(ctx context.Context, req *kasregistry.ListKeyAccessServerGrantsRequest) (*kasregistry.ListKeyAccessServerGrantsResponse, error) { + var res kasregistry.ListKeyAccessServerGrantsResponse + if err := c.client.CallUnary(ctx, keyAccessServerRegistryServiceListKeyAccessServerGrantsSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *keyAccessServerRegistryServiceClient) CreateKey(ctx context.Context, req *kasregistry.CreateKeyRequest) (*kasregistry.CreateKeyResponse, error) { + var res kasregistry.CreateKeyResponse + if err := c.client.CallUnary(ctx, keyAccessServerRegistryServiceCreateKeySpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *keyAccessServerRegistryServiceClient) GetKey(ctx context.Context, req *kasregistry.GetKeyRequest) (*kasregistry.GetKeyResponse, error) { + var res kasregistry.GetKeyResponse + if err := c.client.CallUnary(ctx, keyAccessServerRegistryServiceGetKeySpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *keyAccessServerRegistryServiceClient) ListKeys(ctx context.Context, req *kasregistry.ListKeysRequest) (*kasregistry.ListKeysResponse, error) { + var res kasregistry.ListKeysResponse + if err := c.client.CallUnary(ctx, keyAccessServerRegistryServiceListKeysSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *keyAccessServerRegistryServiceClient) UpdateKey(ctx context.Context, req *kasregistry.UpdateKeyRequest) (*kasregistry.UpdateKeyResponse, error) { + var res kasregistry.UpdateKeyResponse + if err := c.client.CallUnary(ctx, keyAccessServerRegistryServiceUpdateKeySpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *keyAccessServerRegistryServiceClient) RotateKey(ctx context.Context, req *kasregistry.RotateKeyRequest) (*kasregistry.RotateKeyResponse, error) { + var res kasregistry.RotateKeyResponse + if err := c.client.CallUnary(ctx, keyAccessServerRegistryServiceRotateKeySpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *keyAccessServerRegistryServiceClient) SetBaseKey(ctx context.Context, req *kasregistry.SetBaseKeyRequest) (*kasregistry.SetBaseKeyResponse, error) { + var res kasregistry.SetBaseKeyResponse + if err := c.client.CallUnary(ctx, keyAccessServerRegistryServiceSetBaseKeySpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *keyAccessServerRegistryServiceClient) GetBaseKey(ctx context.Context, req *kasregistry.GetBaseKeyRequest) (*kasregistry.GetBaseKeyResponse, error) { + var res kasregistry.GetBaseKeyResponse + if err := c.client.CallUnary(ctx, keyAccessServerRegistryServiceGetBaseKeySpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *keyAccessServerRegistryServiceClient) ListKeyMappings(ctx context.Context, req *kasregistry.ListKeyMappingsRequest) (*kasregistry.ListKeyMappingsResponse, error) { + var res kasregistry.ListKeyMappingsResponse + if err := c.client.CallUnary(ctx, keyAccessServerRegistryServiceListKeyMappingsSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +type keyAccessServerRegistryServiceHandler struct { + svc KeyAccessServerRegistryServiceHandler +} + +func (h keyAccessServerRegistryServiceHandler) listKeyAccessServers(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req kasregistry.ListKeyAccessServersRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.ListKeyAccessServers(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h keyAccessServerRegistryServiceHandler) getKeyAccessServer(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req kasregistry.GetKeyAccessServerRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.GetKeyAccessServer(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h keyAccessServerRegistryServiceHandler) createKeyAccessServer(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req kasregistry.CreateKeyAccessServerRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.CreateKeyAccessServer(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h keyAccessServerRegistryServiceHandler) updateKeyAccessServer(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req kasregistry.UpdateKeyAccessServerRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.UpdateKeyAccessServer(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h keyAccessServerRegistryServiceHandler) deleteKeyAccessServer(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req kasregistry.DeleteKeyAccessServerRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.DeleteKeyAccessServer(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h keyAccessServerRegistryServiceHandler) listKeyAccessServerGrants(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req kasregistry.ListKeyAccessServerGrantsRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.ListKeyAccessServerGrants(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h keyAccessServerRegistryServiceHandler) createKey(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req kasregistry.CreateKeyRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.CreateKey(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h keyAccessServerRegistryServiceHandler) getKey(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req kasregistry.GetKeyRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.GetKey(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h keyAccessServerRegistryServiceHandler) listKeys(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req kasregistry.ListKeysRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.ListKeys(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h keyAccessServerRegistryServiceHandler) updateKey(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req kasregistry.UpdateKeyRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.UpdateKey(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h keyAccessServerRegistryServiceHandler) rotateKey(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req kasregistry.RotateKeyRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.RotateKey(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h keyAccessServerRegistryServiceHandler) setBaseKey(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req kasregistry.SetBaseKeyRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.SetBaseKey(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h keyAccessServerRegistryServiceHandler) getBaseKey(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req kasregistry.GetBaseKeyRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.GetBaseKey(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h keyAccessServerRegistryServiceHandler) listKeyMappings(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req kasregistry.ListKeyMappingsRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.ListKeyMappings(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} diff --git a/protocol/go/policy/keymanagement/keymanagementconnectv2/key_management.connect.go b/protocol/go/policy/keymanagement/keymanagementconnectv2/key_management.connect.go new file mode 100644 index 0000000000..53ed934798 --- /dev/null +++ b/protocol/go/policy/keymanagement/keymanagementconnectv2/key_management.connect.go @@ -0,0 +1,252 @@ +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: policy/keymanagement/key_management.proto + +package keymanagementconnectv2 + +import ( + connect "connectrpc.com/connect/v2" + context "context" + keymanagement "github.com/opentdf/platform/protocol/go/policy/keymanagement" + sync "sync" +) + +const ( + // KeyManagementServiceName is the fully-qualified name of the KeyManagementService service. + KeyManagementServiceName = "policy.keymanagement.KeyManagementService" +) + +// These constants are the procedure names of the RPCs defined in this package. They're exposed at +// runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // KeyManagementServiceCreateProviderConfigProcedure is the procedure name of the + // KeyManagementService's CreateProviderConfig RPC. + KeyManagementServiceCreateProviderConfigProcedure = "/policy.keymanagement.KeyManagementService/CreateProviderConfig" + // KeyManagementServiceGetProviderConfigProcedure is the procedure name of the + // KeyManagementService's GetProviderConfig RPC. + KeyManagementServiceGetProviderConfigProcedure = "/policy.keymanagement.KeyManagementService/GetProviderConfig" + // KeyManagementServiceListProviderConfigsProcedure is the procedure name of the + // KeyManagementService's ListProviderConfigs RPC. + KeyManagementServiceListProviderConfigsProcedure = "/policy.keymanagement.KeyManagementService/ListProviderConfigs" + // KeyManagementServiceUpdateProviderConfigProcedure is the procedure name of the + // KeyManagementService's UpdateProviderConfig RPC. + KeyManagementServiceUpdateProviderConfigProcedure = "/policy.keymanagement.KeyManagementService/UpdateProviderConfig" + // KeyManagementServiceDeleteProviderConfigProcedure is the procedure name of the + // KeyManagementService's DeleteProviderConfig RPC. + KeyManagementServiceDeleteProviderConfigProcedure = "/policy.keymanagement.KeyManagementService/DeleteProviderConfig" +) + +var ( + keyManagementServiceCreateProviderConfigSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: keymanagement.File_policy_keymanagement_key_management_proto.Services().ByName("KeyManagementService").Methods().ByName("CreateProviderConfig"), + Procedure: KeyManagementServiceCreateProviderConfigProcedure, + } + }) + keyManagementServiceGetProviderConfigSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: keymanagement.File_policy_keymanagement_key_management_proto.Services().ByName("KeyManagementService").Methods().ByName("GetProviderConfig"), + Procedure: KeyManagementServiceGetProviderConfigProcedure, + } + }) + keyManagementServiceListProviderConfigsSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: keymanagement.File_policy_keymanagement_key_management_proto.Services().ByName("KeyManagementService").Methods().ByName("ListProviderConfigs"), + Procedure: KeyManagementServiceListProviderConfigsProcedure, + } + }) + keyManagementServiceUpdateProviderConfigSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: keymanagement.File_policy_keymanagement_key_management_proto.Services().ByName("KeyManagementService").Methods().ByName("UpdateProviderConfig"), + Procedure: KeyManagementServiceUpdateProviderConfigProcedure, + } + }) + keyManagementServiceDeleteProviderConfigSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: keymanagement.File_policy_keymanagement_key_management_proto.Services().ByName("KeyManagementService").Methods().ByName("DeleteProviderConfig"), + Procedure: KeyManagementServiceDeleteProviderConfigProcedure, + } + }) +) + +// KeyManagementServiceClient is a client for the policy.keymanagement.KeyManagementService service. +type KeyManagementServiceClient interface { + // Key Management + // Provider Management + CreateProviderConfig(context.Context, *keymanagement.CreateProviderConfigRequest) (*keymanagement.CreateProviderConfigResponse, error) + GetProviderConfig(context.Context, *keymanagement.GetProviderConfigRequest) (*keymanagement.GetProviderConfigResponse, error) + ListProviderConfigs(context.Context, *keymanagement.ListProviderConfigsRequest) (*keymanagement.ListProviderConfigsResponse, error) + UpdateProviderConfig(context.Context, *keymanagement.UpdateProviderConfigRequest) (*keymanagement.UpdateProviderConfigResponse, error) + DeleteProviderConfig(context.Context, *keymanagement.DeleteProviderConfigRequest) (*keymanagement.DeleteProviderConfigResponse, error) +} + +// NewKeyManagementServiceClient constructs a client for the +// policy.keymanagement.KeyManagementService service. Multiple service clients may share a single +// connect.Client. +func NewKeyManagementServiceClient(client *connect.Client) KeyManagementServiceClient { + return &keyManagementServiceClient{client: client} +} + +// KeyManagementServiceHandler is an implementation of the policy.keymanagement.KeyManagementService +// service. +type KeyManagementServiceHandler interface { + // Key Management + // Provider Management + CreateProviderConfig(context.Context, *keymanagement.CreateProviderConfigRequest) (*keymanagement.CreateProviderConfigResponse, error) + GetProviderConfig(context.Context, *keymanagement.GetProviderConfigRequest) (*keymanagement.GetProviderConfigResponse, error) + ListProviderConfigs(context.Context, *keymanagement.ListProviderConfigsRequest) (*keymanagement.ListProviderConfigsResponse, error) + UpdateProviderConfig(context.Context, *keymanagement.UpdateProviderConfigRequest) (*keymanagement.UpdateProviderConfigResponse, error) + DeleteProviderConfig(context.Context, *keymanagement.DeleteProviderConfigRequest) (*keymanagement.DeleteProviderConfigResponse, error) +} + +// RegisterKeyManagementServiceHandler registers svc as the +// policy.keymanagement.KeyManagementService implementation on server. +func RegisterKeyManagementServiceHandler(server *connect.Server, svc KeyManagementServiceHandler) { + adapter := keyManagementServiceHandler{svc: svc} + server.Register( + connect.Method{Spec: keyManagementServiceCreateProviderConfigSpec(), Handler: adapter.createProviderConfig}, + connect.Method{Spec: keyManagementServiceGetProviderConfigSpec(), Handler: adapter.getProviderConfig}, + connect.Method{Spec: keyManagementServiceListProviderConfigsSpec(), Handler: adapter.listProviderConfigs}, + connect.Method{Spec: keyManagementServiceUpdateProviderConfigSpec(), Handler: adapter.updateProviderConfig}, + connect.Method{Spec: keyManagementServiceDeleteProviderConfigSpec(), Handler: adapter.deleteProviderConfig}, + ) +} + +// UnimplementedKeyManagementServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedKeyManagementServiceHandler struct{} + +func (UnimplementedKeyManagementServiceHandler) CreateProviderConfig(context.Context, *keymanagement.CreateProviderConfigRequest) (*keymanagement.CreateProviderConfigResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.keymanagement.KeyManagementService.CreateProviderConfig is not implemented") +} + +func (UnimplementedKeyManagementServiceHandler) GetProviderConfig(context.Context, *keymanagement.GetProviderConfigRequest) (*keymanagement.GetProviderConfigResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.keymanagement.KeyManagementService.GetProviderConfig is not implemented") +} + +func (UnimplementedKeyManagementServiceHandler) ListProviderConfigs(context.Context, *keymanagement.ListProviderConfigsRequest) (*keymanagement.ListProviderConfigsResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.keymanagement.KeyManagementService.ListProviderConfigs is not implemented") +} + +func (UnimplementedKeyManagementServiceHandler) UpdateProviderConfig(context.Context, *keymanagement.UpdateProviderConfigRequest) (*keymanagement.UpdateProviderConfigResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.keymanagement.KeyManagementService.UpdateProviderConfig is not implemented") +} + +func (UnimplementedKeyManagementServiceHandler) DeleteProviderConfig(context.Context, *keymanagement.DeleteProviderConfigRequest) (*keymanagement.DeleteProviderConfigResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.keymanagement.KeyManagementService.DeleteProviderConfig is not implemented") +} + +type keyManagementServiceClient struct { + client *connect.Client +} + +func (c *keyManagementServiceClient) CreateProviderConfig(ctx context.Context, req *keymanagement.CreateProviderConfigRequest) (*keymanagement.CreateProviderConfigResponse, error) { + var res keymanagement.CreateProviderConfigResponse + if err := c.client.CallUnary(ctx, keyManagementServiceCreateProviderConfigSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *keyManagementServiceClient) GetProviderConfig(ctx context.Context, req *keymanagement.GetProviderConfigRequest) (*keymanagement.GetProviderConfigResponse, error) { + var res keymanagement.GetProviderConfigResponse + if err := c.client.CallUnary(ctx, keyManagementServiceGetProviderConfigSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *keyManagementServiceClient) ListProviderConfigs(ctx context.Context, req *keymanagement.ListProviderConfigsRequest) (*keymanagement.ListProviderConfigsResponse, error) { + var res keymanagement.ListProviderConfigsResponse + if err := c.client.CallUnary(ctx, keyManagementServiceListProviderConfigsSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *keyManagementServiceClient) UpdateProviderConfig(ctx context.Context, req *keymanagement.UpdateProviderConfigRequest) (*keymanagement.UpdateProviderConfigResponse, error) { + var res keymanagement.UpdateProviderConfigResponse + if err := c.client.CallUnary(ctx, keyManagementServiceUpdateProviderConfigSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *keyManagementServiceClient) DeleteProviderConfig(ctx context.Context, req *keymanagement.DeleteProviderConfigRequest) (*keymanagement.DeleteProviderConfigResponse, error) { + var res keymanagement.DeleteProviderConfigResponse + if err := c.client.CallUnary(ctx, keyManagementServiceDeleteProviderConfigSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +type keyManagementServiceHandler struct{ svc KeyManagementServiceHandler } + +func (h keyManagementServiceHandler) createProviderConfig(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req keymanagement.CreateProviderConfigRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.CreateProviderConfig(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h keyManagementServiceHandler) getProviderConfig(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req keymanagement.GetProviderConfigRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.GetProviderConfig(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h keyManagementServiceHandler) listProviderConfigs(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req keymanagement.ListProviderConfigsRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.ListProviderConfigs(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h keyManagementServiceHandler) updateProviderConfig(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req keymanagement.UpdateProviderConfigRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.UpdateProviderConfig(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h keyManagementServiceHandler) deleteProviderConfig(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req keymanagement.DeleteProviderConfigRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.DeleteProviderConfig(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} diff --git a/protocol/go/policy/namespaces/namespacesconnectv2/namespaces.connect.go b/protocol/go/policy/namespaces/namespacesconnectv2/namespaces.connect.go new file mode 100644 index 0000000000..c540a0c76b --- /dev/null +++ b/protocol/go/policy/namespaces/namespacesconnectv2/namespaces.connect.go @@ -0,0 +1,414 @@ +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: policy/namespaces/namespaces.proto + +package namespacesconnectv2 + +import ( + connect "connectrpc.com/connect/v2" + context "context" + namespaces "github.com/opentdf/platform/protocol/go/policy/namespaces" + sync "sync" +) + +const ( + // NamespaceServiceName is the fully-qualified name of the NamespaceService service. + NamespaceServiceName = "policy.namespaces.NamespaceService" +) + +// These constants are the procedure names of the RPCs defined in this package. They're exposed at +// runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // NamespaceServiceGetNamespaceProcedure is the procedure name of the NamespaceService's + // GetNamespace RPC. + NamespaceServiceGetNamespaceProcedure = "/policy.namespaces.NamespaceService/GetNamespace" + // NamespaceServiceListNamespacesProcedure is the procedure name of the NamespaceService's + // ListNamespaces RPC. + NamespaceServiceListNamespacesProcedure = "/policy.namespaces.NamespaceService/ListNamespaces" + // NamespaceServiceCreateNamespaceProcedure is the procedure name of the NamespaceService's + // CreateNamespace RPC. + NamespaceServiceCreateNamespaceProcedure = "/policy.namespaces.NamespaceService/CreateNamespace" + // NamespaceServiceUpdateNamespaceProcedure is the procedure name of the NamespaceService's + // UpdateNamespace RPC. + NamespaceServiceUpdateNamespaceProcedure = "/policy.namespaces.NamespaceService/UpdateNamespace" + // NamespaceServiceDeactivateNamespaceProcedure is the procedure name of the NamespaceService's + // DeactivateNamespace RPC. + NamespaceServiceDeactivateNamespaceProcedure = "/policy.namespaces.NamespaceService/DeactivateNamespace" + // NamespaceServiceAssignKeyAccessServerToNamespaceProcedure is the procedure name of the + // NamespaceService's AssignKeyAccessServerToNamespace RPC. + NamespaceServiceAssignKeyAccessServerToNamespaceProcedure = "/policy.namespaces.NamespaceService/AssignKeyAccessServerToNamespace" + // NamespaceServiceRemoveKeyAccessServerFromNamespaceProcedure is the procedure name of the + // NamespaceService's RemoveKeyAccessServerFromNamespace RPC. + NamespaceServiceRemoveKeyAccessServerFromNamespaceProcedure = "/policy.namespaces.NamespaceService/RemoveKeyAccessServerFromNamespace" + // NamespaceServiceAssignPublicKeyToNamespaceProcedure is the procedure name of the + // NamespaceService's AssignPublicKeyToNamespace RPC. + NamespaceServiceAssignPublicKeyToNamespaceProcedure = "/policy.namespaces.NamespaceService/AssignPublicKeyToNamespace" + // NamespaceServiceRemovePublicKeyFromNamespaceProcedure is the procedure name of the + // NamespaceService's RemovePublicKeyFromNamespace RPC. + NamespaceServiceRemovePublicKeyFromNamespaceProcedure = "/policy.namespaces.NamespaceService/RemovePublicKeyFromNamespace" +) + +var ( + namespaceServiceGetNamespaceSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: namespaces.File_policy_namespaces_namespaces_proto.Services().ByName("NamespaceService").Methods().ByName("GetNamespace"), + Procedure: NamespaceServiceGetNamespaceProcedure, + IdempotencyLevel: connect.IdempotencyNoSideEffects, + } + }) + namespaceServiceListNamespacesSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: namespaces.File_policy_namespaces_namespaces_proto.Services().ByName("NamespaceService").Methods().ByName("ListNamespaces"), + Procedure: NamespaceServiceListNamespacesProcedure, + IdempotencyLevel: connect.IdempotencyNoSideEffects, + } + }) + namespaceServiceCreateNamespaceSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: namespaces.File_policy_namespaces_namespaces_proto.Services().ByName("NamespaceService").Methods().ByName("CreateNamespace"), + Procedure: NamespaceServiceCreateNamespaceProcedure, + } + }) + namespaceServiceUpdateNamespaceSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: namespaces.File_policy_namespaces_namespaces_proto.Services().ByName("NamespaceService").Methods().ByName("UpdateNamespace"), + Procedure: NamespaceServiceUpdateNamespaceProcedure, + } + }) + namespaceServiceDeactivateNamespaceSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: namespaces.File_policy_namespaces_namespaces_proto.Services().ByName("NamespaceService").Methods().ByName("DeactivateNamespace"), + Procedure: NamespaceServiceDeactivateNamespaceProcedure, + } + }) + namespaceServiceAssignKeyAccessServerToNamespaceSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: namespaces.File_policy_namespaces_namespaces_proto.Services().ByName("NamespaceService").Methods().ByName("AssignKeyAccessServerToNamespace"), + Procedure: NamespaceServiceAssignKeyAccessServerToNamespaceProcedure, + } + }) + namespaceServiceRemoveKeyAccessServerFromNamespaceSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: namespaces.File_policy_namespaces_namespaces_proto.Services().ByName("NamespaceService").Methods().ByName("RemoveKeyAccessServerFromNamespace"), + Procedure: NamespaceServiceRemoveKeyAccessServerFromNamespaceProcedure, + } + }) + namespaceServiceAssignPublicKeyToNamespaceSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: namespaces.File_policy_namespaces_namespaces_proto.Services().ByName("NamespaceService").Methods().ByName("AssignPublicKeyToNamespace"), + Procedure: NamespaceServiceAssignPublicKeyToNamespaceProcedure, + } + }) + namespaceServiceRemovePublicKeyFromNamespaceSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: namespaces.File_policy_namespaces_namespaces_proto.Services().ByName("NamespaceService").Methods().ByName("RemovePublicKeyFromNamespace"), + Procedure: NamespaceServiceRemovePublicKeyFromNamespaceProcedure, + } + }) +) + +// NamespaceServiceClient is a client for the policy.namespaces.NamespaceService service. +type NamespaceServiceClient interface { + GetNamespace(context.Context, *namespaces.GetNamespaceRequest) (*namespaces.GetNamespaceResponse, error) + ListNamespaces(context.Context, *namespaces.ListNamespacesRequest) (*namespaces.ListNamespacesResponse, error) + CreateNamespace(context.Context, *namespaces.CreateNamespaceRequest) (*namespaces.CreateNamespaceResponse, error) + UpdateNamespace(context.Context, *namespaces.UpdateNamespaceRequest) (*namespaces.UpdateNamespaceResponse, error) + DeactivateNamespace(context.Context, *namespaces.DeactivateNamespaceRequest) (*namespaces.DeactivateNamespaceResponse, error) + // Deprecated: utilize AssignPublicKeyToNamespace + // + // Deprecated: do not use. + AssignKeyAccessServerToNamespace(context.Context, *namespaces.AssignKeyAccessServerToNamespaceRequest) (*namespaces.AssignKeyAccessServerToNamespaceResponse, error) + // Deprecated: utilize RemovePublicKeyFromNamespace + // + // Deprecated: do not use. + RemoveKeyAccessServerFromNamespace(context.Context, *namespaces.RemoveKeyAccessServerFromNamespaceRequest) (*namespaces.RemoveKeyAccessServerFromNamespaceResponse, error) + //--------------------------------------* + // Namespace <> Key RPCs + //--------------------------------------- + AssignPublicKeyToNamespace(context.Context, *namespaces.AssignPublicKeyToNamespaceRequest) (*namespaces.AssignPublicKeyToNamespaceResponse, error) + RemovePublicKeyFromNamespace(context.Context, *namespaces.RemovePublicKeyFromNamespaceRequest) (*namespaces.RemovePublicKeyFromNamespaceResponse, error) +} + +// NewNamespaceServiceClient constructs a client for the policy.namespaces.NamespaceService service. +// Multiple service clients may share a single connect.Client. +func NewNamespaceServiceClient(client *connect.Client) NamespaceServiceClient { + return &namespaceServiceClient{client: client} +} + +// NamespaceServiceHandler is an implementation of the policy.namespaces.NamespaceService service. +type NamespaceServiceHandler interface { + GetNamespace(context.Context, *namespaces.GetNamespaceRequest) (*namespaces.GetNamespaceResponse, error) + ListNamespaces(context.Context, *namespaces.ListNamespacesRequest) (*namespaces.ListNamespacesResponse, error) + CreateNamespace(context.Context, *namespaces.CreateNamespaceRequest) (*namespaces.CreateNamespaceResponse, error) + UpdateNamespace(context.Context, *namespaces.UpdateNamespaceRequest) (*namespaces.UpdateNamespaceResponse, error) + DeactivateNamespace(context.Context, *namespaces.DeactivateNamespaceRequest) (*namespaces.DeactivateNamespaceResponse, error) + // Deprecated: utilize AssignPublicKeyToNamespace + // + // Deprecated: do not use. + AssignKeyAccessServerToNamespace(context.Context, *namespaces.AssignKeyAccessServerToNamespaceRequest) (*namespaces.AssignKeyAccessServerToNamespaceResponse, error) + // Deprecated: utilize RemovePublicKeyFromNamespace + // + // Deprecated: do not use. + RemoveKeyAccessServerFromNamespace(context.Context, *namespaces.RemoveKeyAccessServerFromNamespaceRequest) (*namespaces.RemoveKeyAccessServerFromNamespaceResponse, error) + //--------------------------------------* + // Namespace <> Key RPCs + //--------------------------------------- + AssignPublicKeyToNamespace(context.Context, *namespaces.AssignPublicKeyToNamespaceRequest) (*namespaces.AssignPublicKeyToNamespaceResponse, error) + RemovePublicKeyFromNamespace(context.Context, *namespaces.RemovePublicKeyFromNamespaceRequest) (*namespaces.RemovePublicKeyFromNamespaceResponse, error) +} + +// RegisterNamespaceServiceHandler registers svc as the policy.namespaces.NamespaceService +// implementation on server. +func RegisterNamespaceServiceHandler(server *connect.Server, svc NamespaceServiceHandler) { + adapter := namespaceServiceHandler{svc: svc} + server.Register( + connect.Method{Spec: namespaceServiceGetNamespaceSpec(), Handler: adapter.getNamespace}, + connect.Method{Spec: namespaceServiceListNamespacesSpec(), Handler: adapter.listNamespaces}, + connect.Method{Spec: namespaceServiceCreateNamespaceSpec(), Handler: adapter.createNamespace}, + connect.Method{Spec: namespaceServiceUpdateNamespaceSpec(), Handler: adapter.updateNamespace}, + connect.Method{Spec: namespaceServiceDeactivateNamespaceSpec(), Handler: adapter.deactivateNamespace}, + connect.Method{Spec: namespaceServiceAssignKeyAccessServerToNamespaceSpec(), Handler: adapter.assignKeyAccessServerToNamespace}, + connect.Method{Spec: namespaceServiceRemoveKeyAccessServerFromNamespaceSpec(), Handler: adapter.removeKeyAccessServerFromNamespace}, + connect.Method{Spec: namespaceServiceAssignPublicKeyToNamespaceSpec(), Handler: adapter.assignPublicKeyToNamespace}, + connect.Method{Spec: namespaceServiceRemovePublicKeyFromNamespaceSpec(), Handler: adapter.removePublicKeyFromNamespace}, + ) +} + +// UnimplementedNamespaceServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedNamespaceServiceHandler struct{} + +func (UnimplementedNamespaceServiceHandler) GetNamespace(context.Context, *namespaces.GetNamespaceRequest) (*namespaces.GetNamespaceResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.namespaces.NamespaceService.GetNamespace is not implemented") +} + +func (UnimplementedNamespaceServiceHandler) ListNamespaces(context.Context, *namespaces.ListNamespacesRequest) (*namespaces.ListNamespacesResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.namespaces.NamespaceService.ListNamespaces is not implemented") +} + +func (UnimplementedNamespaceServiceHandler) CreateNamespace(context.Context, *namespaces.CreateNamespaceRequest) (*namespaces.CreateNamespaceResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.namespaces.NamespaceService.CreateNamespace is not implemented") +} + +func (UnimplementedNamespaceServiceHandler) UpdateNamespace(context.Context, *namespaces.UpdateNamespaceRequest) (*namespaces.UpdateNamespaceResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.namespaces.NamespaceService.UpdateNamespace is not implemented") +} + +func (UnimplementedNamespaceServiceHandler) DeactivateNamespace(context.Context, *namespaces.DeactivateNamespaceRequest) (*namespaces.DeactivateNamespaceResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.namespaces.NamespaceService.DeactivateNamespace is not implemented") +} + +func (UnimplementedNamespaceServiceHandler) AssignKeyAccessServerToNamespace(context.Context, *namespaces.AssignKeyAccessServerToNamespaceRequest) (*namespaces.AssignKeyAccessServerToNamespaceResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.namespaces.NamespaceService.AssignKeyAccessServerToNamespace is not implemented") +} + +func (UnimplementedNamespaceServiceHandler) RemoveKeyAccessServerFromNamespace(context.Context, *namespaces.RemoveKeyAccessServerFromNamespaceRequest) (*namespaces.RemoveKeyAccessServerFromNamespaceResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.namespaces.NamespaceService.RemoveKeyAccessServerFromNamespace is not implemented") +} + +func (UnimplementedNamespaceServiceHandler) AssignPublicKeyToNamespace(context.Context, *namespaces.AssignPublicKeyToNamespaceRequest) (*namespaces.AssignPublicKeyToNamespaceResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.namespaces.NamespaceService.AssignPublicKeyToNamespace is not implemented") +} + +func (UnimplementedNamespaceServiceHandler) RemovePublicKeyFromNamespace(context.Context, *namespaces.RemovePublicKeyFromNamespaceRequest) (*namespaces.RemovePublicKeyFromNamespaceResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.namespaces.NamespaceService.RemovePublicKeyFromNamespace is not implemented") +} + +type namespaceServiceClient struct { + client *connect.Client +} + +func (c *namespaceServiceClient) GetNamespace(ctx context.Context, req *namespaces.GetNamespaceRequest) (*namespaces.GetNamespaceResponse, error) { + var res namespaces.GetNamespaceResponse + if err := c.client.CallUnary(ctx, namespaceServiceGetNamespaceSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *namespaceServiceClient) ListNamespaces(ctx context.Context, req *namespaces.ListNamespacesRequest) (*namespaces.ListNamespacesResponse, error) { + var res namespaces.ListNamespacesResponse + if err := c.client.CallUnary(ctx, namespaceServiceListNamespacesSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *namespaceServiceClient) CreateNamespace(ctx context.Context, req *namespaces.CreateNamespaceRequest) (*namespaces.CreateNamespaceResponse, error) { + var res namespaces.CreateNamespaceResponse + if err := c.client.CallUnary(ctx, namespaceServiceCreateNamespaceSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *namespaceServiceClient) UpdateNamespace(ctx context.Context, req *namespaces.UpdateNamespaceRequest) (*namespaces.UpdateNamespaceResponse, error) { + var res namespaces.UpdateNamespaceResponse + if err := c.client.CallUnary(ctx, namespaceServiceUpdateNamespaceSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *namespaceServiceClient) DeactivateNamespace(ctx context.Context, req *namespaces.DeactivateNamespaceRequest) (*namespaces.DeactivateNamespaceResponse, error) { + var res namespaces.DeactivateNamespaceResponse + if err := c.client.CallUnary(ctx, namespaceServiceDeactivateNamespaceSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *namespaceServiceClient) AssignKeyAccessServerToNamespace(ctx context.Context, req *namespaces.AssignKeyAccessServerToNamespaceRequest) (*namespaces.AssignKeyAccessServerToNamespaceResponse, error) { + var res namespaces.AssignKeyAccessServerToNamespaceResponse + if err := c.client.CallUnary(ctx, namespaceServiceAssignKeyAccessServerToNamespaceSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *namespaceServiceClient) RemoveKeyAccessServerFromNamespace(ctx context.Context, req *namespaces.RemoveKeyAccessServerFromNamespaceRequest) (*namespaces.RemoveKeyAccessServerFromNamespaceResponse, error) { + var res namespaces.RemoveKeyAccessServerFromNamespaceResponse + if err := c.client.CallUnary(ctx, namespaceServiceRemoveKeyAccessServerFromNamespaceSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *namespaceServiceClient) AssignPublicKeyToNamespace(ctx context.Context, req *namespaces.AssignPublicKeyToNamespaceRequest) (*namespaces.AssignPublicKeyToNamespaceResponse, error) { + var res namespaces.AssignPublicKeyToNamespaceResponse + if err := c.client.CallUnary(ctx, namespaceServiceAssignPublicKeyToNamespaceSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *namespaceServiceClient) RemovePublicKeyFromNamespace(ctx context.Context, req *namespaces.RemovePublicKeyFromNamespaceRequest) (*namespaces.RemovePublicKeyFromNamespaceResponse, error) { + var res namespaces.RemovePublicKeyFromNamespaceResponse + if err := c.client.CallUnary(ctx, namespaceServiceRemovePublicKeyFromNamespaceSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +type namespaceServiceHandler struct{ svc NamespaceServiceHandler } + +func (h namespaceServiceHandler) getNamespace(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req namespaces.GetNamespaceRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.GetNamespace(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h namespaceServiceHandler) listNamespaces(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req namespaces.ListNamespacesRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.ListNamespaces(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h namespaceServiceHandler) createNamespace(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req namespaces.CreateNamespaceRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.CreateNamespace(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h namespaceServiceHandler) updateNamespace(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req namespaces.UpdateNamespaceRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.UpdateNamespace(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h namespaceServiceHandler) deactivateNamespace(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req namespaces.DeactivateNamespaceRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.DeactivateNamespace(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h namespaceServiceHandler) assignKeyAccessServerToNamespace(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req namespaces.AssignKeyAccessServerToNamespaceRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.AssignKeyAccessServerToNamespace(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h namespaceServiceHandler) removeKeyAccessServerFromNamespace(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req namespaces.RemoveKeyAccessServerFromNamespaceRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.RemoveKeyAccessServerFromNamespace(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h namespaceServiceHandler) assignPublicKeyToNamespace(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req namespaces.AssignPublicKeyToNamespaceRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.AssignPublicKeyToNamespace(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h namespaceServiceHandler) removePublicKeyFromNamespace(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req namespaces.RemovePublicKeyFromNamespaceRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.RemovePublicKeyFromNamespace(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} diff --git a/protocol/go/policy/obligations/obligationsconnectv2/obligations.connect.go b/protocol/go/policy/obligations/obligationsconnectv2/obligations.connect.go new file mode 100644 index 0000000000..cdfe79dd0b --- /dev/null +++ b/protocol/go/policy/obligations/obligationsconnectv2/obligations.connect.go @@ -0,0 +1,616 @@ +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: policy/obligations/obligations.proto + +package obligationsconnectv2 + +import ( + connect "connectrpc.com/connect/v2" + context "context" + obligations "github.com/opentdf/platform/protocol/go/policy/obligations" + sync "sync" +) + +const ( + // ServiceName is the fully-qualified name of the Service service. + ServiceName = "policy.obligations.Service" +) + +// These constants are the procedure names of the RPCs defined in this package. They're exposed at +// runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // ServiceListObligationsProcedure is the procedure name of the Service's ListObligations RPC. + ServiceListObligationsProcedure = "/policy.obligations.Service/ListObligations" + // ServiceGetObligationProcedure is the procedure name of the Service's GetObligation RPC. + ServiceGetObligationProcedure = "/policy.obligations.Service/GetObligation" + // ServiceGetObligationsByFQNsProcedure is the procedure name of the Service's GetObligationsByFQNs + // RPC. + ServiceGetObligationsByFQNsProcedure = "/policy.obligations.Service/GetObligationsByFQNs" + // ServiceCreateObligationProcedure is the procedure name of the Service's CreateObligation RPC. + ServiceCreateObligationProcedure = "/policy.obligations.Service/CreateObligation" + // ServiceUpdateObligationProcedure is the procedure name of the Service's UpdateObligation RPC. + ServiceUpdateObligationProcedure = "/policy.obligations.Service/UpdateObligation" + // ServiceDeleteObligationProcedure is the procedure name of the Service's DeleteObligation RPC. + ServiceDeleteObligationProcedure = "/policy.obligations.Service/DeleteObligation" + // ServiceGetObligationValueProcedure is the procedure name of the Service's GetObligationValue RPC. + ServiceGetObligationValueProcedure = "/policy.obligations.Service/GetObligationValue" + // ServiceGetObligationValuesByFQNsProcedure is the procedure name of the Service's + // GetObligationValuesByFQNs RPC. + ServiceGetObligationValuesByFQNsProcedure = "/policy.obligations.Service/GetObligationValuesByFQNs" + // ServiceCreateObligationValueProcedure is the procedure name of the Service's + // CreateObligationValue RPC. + ServiceCreateObligationValueProcedure = "/policy.obligations.Service/CreateObligationValue" + // ServiceUpdateObligationValueProcedure is the procedure name of the Service's + // UpdateObligationValue RPC. + ServiceUpdateObligationValueProcedure = "/policy.obligations.Service/UpdateObligationValue" + // ServiceDeleteObligationValueProcedure is the procedure name of the Service's + // DeleteObligationValue RPC. + ServiceDeleteObligationValueProcedure = "/policy.obligations.Service/DeleteObligationValue" + // ServiceGetObligationTriggerProcedure is the procedure name of the Service's GetObligationTrigger + // RPC. + ServiceGetObligationTriggerProcedure = "/policy.obligations.Service/GetObligationTrigger" + // ServiceAddObligationTriggerProcedure is the procedure name of the Service's AddObligationTrigger + // RPC. + ServiceAddObligationTriggerProcedure = "/policy.obligations.Service/AddObligationTrigger" + // ServiceRemoveObligationTriggerProcedure is the procedure name of the Service's + // RemoveObligationTrigger RPC. + ServiceRemoveObligationTriggerProcedure = "/policy.obligations.Service/RemoveObligationTrigger" + // ServiceListObligationTriggersProcedure is the procedure name of the Service's + // ListObligationTriggers RPC. + ServiceListObligationTriggersProcedure = "/policy.obligations.Service/ListObligationTriggers" +) + +var ( + serviceListObligationsSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: obligations.File_policy_obligations_obligations_proto.Services().ByName("Service").Methods().ByName("ListObligations"), + Procedure: ServiceListObligationsProcedure, + IdempotencyLevel: connect.IdempotencyNoSideEffects, + } + }) + serviceGetObligationSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: obligations.File_policy_obligations_obligations_proto.Services().ByName("Service").Methods().ByName("GetObligation"), + Procedure: ServiceGetObligationProcedure, + IdempotencyLevel: connect.IdempotencyNoSideEffects, + } + }) + serviceGetObligationsByFQNsSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: obligations.File_policy_obligations_obligations_proto.Services().ByName("Service").Methods().ByName("GetObligationsByFQNs"), + Procedure: ServiceGetObligationsByFQNsProcedure, + IdempotencyLevel: connect.IdempotencyNoSideEffects, + } + }) + serviceCreateObligationSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: obligations.File_policy_obligations_obligations_proto.Services().ByName("Service").Methods().ByName("CreateObligation"), + Procedure: ServiceCreateObligationProcedure, + } + }) + serviceUpdateObligationSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: obligations.File_policy_obligations_obligations_proto.Services().ByName("Service").Methods().ByName("UpdateObligation"), + Procedure: ServiceUpdateObligationProcedure, + } + }) + serviceDeleteObligationSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: obligations.File_policy_obligations_obligations_proto.Services().ByName("Service").Methods().ByName("DeleteObligation"), + Procedure: ServiceDeleteObligationProcedure, + } + }) + serviceGetObligationValueSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: obligations.File_policy_obligations_obligations_proto.Services().ByName("Service").Methods().ByName("GetObligationValue"), + Procedure: ServiceGetObligationValueProcedure, + IdempotencyLevel: connect.IdempotencyNoSideEffects, + } + }) + serviceGetObligationValuesByFQNsSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: obligations.File_policy_obligations_obligations_proto.Services().ByName("Service").Methods().ByName("GetObligationValuesByFQNs"), + Procedure: ServiceGetObligationValuesByFQNsProcedure, + IdempotencyLevel: connect.IdempotencyNoSideEffects, + } + }) + serviceCreateObligationValueSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: obligations.File_policy_obligations_obligations_proto.Services().ByName("Service").Methods().ByName("CreateObligationValue"), + Procedure: ServiceCreateObligationValueProcedure, + } + }) + serviceUpdateObligationValueSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: obligations.File_policy_obligations_obligations_proto.Services().ByName("Service").Methods().ByName("UpdateObligationValue"), + Procedure: ServiceUpdateObligationValueProcedure, + } + }) + serviceDeleteObligationValueSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: obligations.File_policy_obligations_obligations_proto.Services().ByName("Service").Methods().ByName("DeleteObligationValue"), + Procedure: ServiceDeleteObligationValueProcedure, + } + }) + serviceGetObligationTriggerSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: obligations.File_policy_obligations_obligations_proto.Services().ByName("Service").Methods().ByName("GetObligationTrigger"), + Procedure: ServiceGetObligationTriggerProcedure, + IdempotencyLevel: connect.IdempotencyNoSideEffects, + } + }) + serviceAddObligationTriggerSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: obligations.File_policy_obligations_obligations_proto.Services().ByName("Service").Methods().ByName("AddObligationTrigger"), + Procedure: ServiceAddObligationTriggerProcedure, + } + }) + serviceRemoveObligationTriggerSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: obligations.File_policy_obligations_obligations_proto.Services().ByName("Service").Methods().ByName("RemoveObligationTrigger"), + Procedure: ServiceRemoveObligationTriggerProcedure, + } + }) + serviceListObligationTriggersSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: obligations.File_policy_obligations_obligations_proto.Services().ByName("Service").Methods().ByName("ListObligationTriggers"), + Procedure: ServiceListObligationTriggersProcedure, + IdempotencyLevel: connect.IdempotencyNoSideEffects, + } + }) +) + +// ServiceClient is a client for the policy.obligations.Service service. +type ServiceClient interface { + ListObligations(context.Context, *obligations.ListObligationsRequest) (*obligations.ListObligationsResponse, error) + GetObligation(context.Context, *obligations.GetObligationRequest) (*obligations.GetObligationResponse, error) + GetObligationsByFQNs(context.Context, *obligations.GetObligationsByFQNsRequest) (*obligations.GetObligationsByFQNsResponse, error) + CreateObligation(context.Context, *obligations.CreateObligationRequest) (*obligations.CreateObligationResponse, error) + UpdateObligation(context.Context, *obligations.UpdateObligationRequest) (*obligations.UpdateObligationResponse, error) + DeleteObligation(context.Context, *obligations.DeleteObligationRequest) (*obligations.DeleteObligationResponse, error) + GetObligationValue(context.Context, *obligations.GetObligationValueRequest) (*obligations.GetObligationValueResponse, error) + GetObligationValuesByFQNs(context.Context, *obligations.GetObligationValuesByFQNsRequest) (*obligations.GetObligationValuesByFQNsResponse, error) + CreateObligationValue(context.Context, *obligations.CreateObligationValueRequest) (*obligations.CreateObligationValueResponse, error) + UpdateObligationValue(context.Context, *obligations.UpdateObligationValueRequest) (*obligations.UpdateObligationValueResponse, error) + DeleteObligationValue(context.Context, *obligations.DeleteObligationValueRequest) (*obligations.DeleteObligationValueResponse, error) + GetObligationTrigger(context.Context, *obligations.GetObligationTriggerRequest) (*obligations.GetObligationTriggerResponse, error) + AddObligationTrigger(context.Context, *obligations.AddObligationTriggerRequest) (*obligations.AddObligationTriggerResponse, error) + RemoveObligationTrigger(context.Context, *obligations.RemoveObligationTriggerRequest) (*obligations.RemoveObligationTriggerResponse, error) + ListObligationTriggers(context.Context, *obligations.ListObligationTriggersRequest) (*obligations.ListObligationTriggersResponse, error) +} + +// NewServiceClient constructs a client for the policy.obligations.Service service. Multiple service +// clients may share a single connect.Client. +func NewServiceClient(client *connect.Client) ServiceClient { + return &serviceClient{client: client} +} + +// ServiceHandler is an implementation of the policy.obligations.Service service. +type ServiceHandler interface { + ListObligations(context.Context, *obligations.ListObligationsRequest) (*obligations.ListObligationsResponse, error) + GetObligation(context.Context, *obligations.GetObligationRequest) (*obligations.GetObligationResponse, error) + GetObligationsByFQNs(context.Context, *obligations.GetObligationsByFQNsRequest) (*obligations.GetObligationsByFQNsResponse, error) + CreateObligation(context.Context, *obligations.CreateObligationRequest) (*obligations.CreateObligationResponse, error) + UpdateObligation(context.Context, *obligations.UpdateObligationRequest) (*obligations.UpdateObligationResponse, error) + DeleteObligation(context.Context, *obligations.DeleteObligationRequest) (*obligations.DeleteObligationResponse, error) + GetObligationValue(context.Context, *obligations.GetObligationValueRequest) (*obligations.GetObligationValueResponse, error) + GetObligationValuesByFQNs(context.Context, *obligations.GetObligationValuesByFQNsRequest) (*obligations.GetObligationValuesByFQNsResponse, error) + CreateObligationValue(context.Context, *obligations.CreateObligationValueRequest) (*obligations.CreateObligationValueResponse, error) + UpdateObligationValue(context.Context, *obligations.UpdateObligationValueRequest) (*obligations.UpdateObligationValueResponse, error) + DeleteObligationValue(context.Context, *obligations.DeleteObligationValueRequest) (*obligations.DeleteObligationValueResponse, error) + GetObligationTrigger(context.Context, *obligations.GetObligationTriggerRequest) (*obligations.GetObligationTriggerResponse, error) + AddObligationTrigger(context.Context, *obligations.AddObligationTriggerRequest) (*obligations.AddObligationTriggerResponse, error) + RemoveObligationTrigger(context.Context, *obligations.RemoveObligationTriggerRequest) (*obligations.RemoveObligationTriggerResponse, error) + ListObligationTriggers(context.Context, *obligations.ListObligationTriggersRequest) (*obligations.ListObligationTriggersResponse, error) +} + +// RegisterServiceHandler registers svc as the policy.obligations.Service implementation on server. +func RegisterServiceHandler(server *connect.Server, svc ServiceHandler) { + adapter := serviceHandler{svc: svc} + server.Register( + connect.Method{Spec: serviceListObligationsSpec(), Handler: adapter.listObligations}, + connect.Method{Spec: serviceGetObligationSpec(), Handler: adapter.getObligation}, + connect.Method{Spec: serviceGetObligationsByFQNsSpec(), Handler: adapter.getObligationsByFQNs}, + connect.Method{Spec: serviceCreateObligationSpec(), Handler: adapter.createObligation}, + connect.Method{Spec: serviceUpdateObligationSpec(), Handler: adapter.updateObligation}, + connect.Method{Spec: serviceDeleteObligationSpec(), Handler: adapter.deleteObligation}, + connect.Method{Spec: serviceGetObligationValueSpec(), Handler: adapter.getObligationValue}, + connect.Method{Spec: serviceGetObligationValuesByFQNsSpec(), Handler: adapter.getObligationValuesByFQNs}, + connect.Method{Spec: serviceCreateObligationValueSpec(), Handler: adapter.createObligationValue}, + connect.Method{Spec: serviceUpdateObligationValueSpec(), Handler: adapter.updateObligationValue}, + connect.Method{Spec: serviceDeleteObligationValueSpec(), Handler: adapter.deleteObligationValue}, + connect.Method{Spec: serviceGetObligationTriggerSpec(), Handler: adapter.getObligationTrigger}, + connect.Method{Spec: serviceAddObligationTriggerSpec(), Handler: adapter.addObligationTrigger}, + connect.Method{Spec: serviceRemoveObligationTriggerSpec(), Handler: adapter.removeObligationTrigger}, + connect.Method{Spec: serviceListObligationTriggersSpec(), Handler: adapter.listObligationTriggers}, + ) +} + +// UnimplementedServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedServiceHandler struct{} + +func (UnimplementedServiceHandler) ListObligations(context.Context, *obligations.ListObligationsRequest) (*obligations.ListObligationsResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.obligations.Service.ListObligations is not implemented") +} + +func (UnimplementedServiceHandler) GetObligation(context.Context, *obligations.GetObligationRequest) (*obligations.GetObligationResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.obligations.Service.GetObligation is not implemented") +} + +func (UnimplementedServiceHandler) GetObligationsByFQNs(context.Context, *obligations.GetObligationsByFQNsRequest) (*obligations.GetObligationsByFQNsResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.obligations.Service.GetObligationsByFQNs is not implemented") +} + +func (UnimplementedServiceHandler) CreateObligation(context.Context, *obligations.CreateObligationRequest) (*obligations.CreateObligationResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.obligations.Service.CreateObligation is not implemented") +} + +func (UnimplementedServiceHandler) UpdateObligation(context.Context, *obligations.UpdateObligationRequest) (*obligations.UpdateObligationResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.obligations.Service.UpdateObligation is not implemented") +} + +func (UnimplementedServiceHandler) DeleteObligation(context.Context, *obligations.DeleteObligationRequest) (*obligations.DeleteObligationResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.obligations.Service.DeleteObligation is not implemented") +} + +func (UnimplementedServiceHandler) GetObligationValue(context.Context, *obligations.GetObligationValueRequest) (*obligations.GetObligationValueResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.obligations.Service.GetObligationValue is not implemented") +} + +func (UnimplementedServiceHandler) GetObligationValuesByFQNs(context.Context, *obligations.GetObligationValuesByFQNsRequest) (*obligations.GetObligationValuesByFQNsResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.obligations.Service.GetObligationValuesByFQNs is not implemented") +} + +func (UnimplementedServiceHandler) CreateObligationValue(context.Context, *obligations.CreateObligationValueRequest) (*obligations.CreateObligationValueResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.obligations.Service.CreateObligationValue is not implemented") +} + +func (UnimplementedServiceHandler) UpdateObligationValue(context.Context, *obligations.UpdateObligationValueRequest) (*obligations.UpdateObligationValueResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.obligations.Service.UpdateObligationValue is not implemented") +} + +func (UnimplementedServiceHandler) DeleteObligationValue(context.Context, *obligations.DeleteObligationValueRequest) (*obligations.DeleteObligationValueResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.obligations.Service.DeleteObligationValue is not implemented") +} + +func (UnimplementedServiceHandler) GetObligationTrigger(context.Context, *obligations.GetObligationTriggerRequest) (*obligations.GetObligationTriggerResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.obligations.Service.GetObligationTrigger is not implemented") +} + +func (UnimplementedServiceHandler) AddObligationTrigger(context.Context, *obligations.AddObligationTriggerRequest) (*obligations.AddObligationTriggerResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.obligations.Service.AddObligationTrigger is not implemented") +} + +func (UnimplementedServiceHandler) RemoveObligationTrigger(context.Context, *obligations.RemoveObligationTriggerRequest) (*obligations.RemoveObligationTriggerResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.obligations.Service.RemoveObligationTrigger is not implemented") +} + +func (UnimplementedServiceHandler) ListObligationTriggers(context.Context, *obligations.ListObligationTriggersRequest) (*obligations.ListObligationTriggersResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.obligations.Service.ListObligationTriggers is not implemented") +} + +type serviceClient struct { + client *connect.Client +} + +func (c *serviceClient) ListObligations(ctx context.Context, req *obligations.ListObligationsRequest) (*obligations.ListObligationsResponse, error) { + var res obligations.ListObligationsResponse + if err := c.client.CallUnary(ctx, serviceListObligationsSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *serviceClient) GetObligation(ctx context.Context, req *obligations.GetObligationRequest) (*obligations.GetObligationResponse, error) { + var res obligations.GetObligationResponse + if err := c.client.CallUnary(ctx, serviceGetObligationSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *serviceClient) GetObligationsByFQNs(ctx context.Context, req *obligations.GetObligationsByFQNsRequest) (*obligations.GetObligationsByFQNsResponse, error) { + var res obligations.GetObligationsByFQNsResponse + if err := c.client.CallUnary(ctx, serviceGetObligationsByFQNsSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *serviceClient) CreateObligation(ctx context.Context, req *obligations.CreateObligationRequest) (*obligations.CreateObligationResponse, error) { + var res obligations.CreateObligationResponse + if err := c.client.CallUnary(ctx, serviceCreateObligationSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *serviceClient) UpdateObligation(ctx context.Context, req *obligations.UpdateObligationRequest) (*obligations.UpdateObligationResponse, error) { + var res obligations.UpdateObligationResponse + if err := c.client.CallUnary(ctx, serviceUpdateObligationSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *serviceClient) DeleteObligation(ctx context.Context, req *obligations.DeleteObligationRequest) (*obligations.DeleteObligationResponse, error) { + var res obligations.DeleteObligationResponse + if err := c.client.CallUnary(ctx, serviceDeleteObligationSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *serviceClient) GetObligationValue(ctx context.Context, req *obligations.GetObligationValueRequest) (*obligations.GetObligationValueResponse, error) { + var res obligations.GetObligationValueResponse + if err := c.client.CallUnary(ctx, serviceGetObligationValueSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *serviceClient) GetObligationValuesByFQNs(ctx context.Context, req *obligations.GetObligationValuesByFQNsRequest) (*obligations.GetObligationValuesByFQNsResponse, error) { + var res obligations.GetObligationValuesByFQNsResponse + if err := c.client.CallUnary(ctx, serviceGetObligationValuesByFQNsSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *serviceClient) CreateObligationValue(ctx context.Context, req *obligations.CreateObligationValueRequest) (*obligations.CreateObligationValueResponse, error) { + var res obligations.CreateObligationValueResponse + if err := c.client.CallUnary(ctx, serviceCreateObligationValueSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *serviceClient) UpdateObligationValue(ctx context.Context, req *obligations.UpdateObligationValueRequest) (*obligations.UpdateObligationValueResponse, error) { + var res obligations.UpdateObligationValueResponse + if err := c.client.CallUnary(ctx, serviceUpdateObligationValueSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *serviceClient) DeleteObligationValue(ctx context.Context, req *obligations.DeleteObligationValueRequest) (*obligations.DeleteObligationValueResponse, error) { + var res obligations.DeleteObligationValueResponse + if err := c.client.CallUnary(ctx, serviceDeleteObligationValueSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *serviceClient) GetObligationTrigger(ctx context.Context, req *obligations.GetObligationTriggerRequest) (*obligations.GetObligationTriggerResponse, error) { + var res obligations.GetObligationTriggerResponse + if err := c.client.CallUnary(ctx, serviceGetObligationTriggerSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *serviceClient) AddObligationTrigger(ctx context.Context, req *obligations.AddObligationTriggerRequest) (*obligations.AddObligationTriggerResponse, error) { + var res obligations.AddObligationTriggerResponse + if err := c.client.CallUnary(ctx, serviceAddObligationTriggerSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *serviceClient) RemoveObligationTrigger(ctx context.Context, req *obligations.RemoveObligationTriggerRequest) (*obligations.RemoveObligationTriggerResponse, error) { + var res obligations.RemoveObligationTriggerResponse + if err := c.client.CallUnary(ctx, serviceRemoveObligationTriggerSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *serviceClient) ListObligationTriggers(ctx context.Context, req *obligations.ListObligationTriggersRequest) (*obligations.ListObligationTriggersResponse, error) { + var res obligations.ListObligationTriggersResponse + if err := c.client.CallUnary(ctx, serviceListObligationTriggersSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +type serviceHandler struct{ svc ServiceHandler } + +func (h serviceHandler) listObligations(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req obligations.ListObligationsRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.ListObligations(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h serviceHandler) getObligation(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req obligations.GetObligationRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.GetObligation(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h serviceHandler) getObligationsByFQNs(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req obligations.GetObligationsByFQNsRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.GetObligationsByFQNs(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h serviceHandler) createObligation(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req obligations.CreateObligationRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.CreateObligation(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h serviceHandler) updateObligation(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req obligations.UpdateObligationRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.UpdateObligation(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h serviceHandler) deleteObligation(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req obligations.DeleteObligationRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.DeleteObligation(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h serviceHandler) getObligationValue(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req obligations.GetObligationValueRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.GetObligationValue(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h serviceHandler) getObligationValuesByFQNs(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req obligations.GetObligationValuesByFQNsRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.GetObligationValuesByFQNs(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h serviceHandler) createObligationValue(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req obligations.CreateObligationValueRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.CreateObligationValue(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h serviceHandler) updateObligationValue(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req obligations.UpdateObligationValueRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.UpdateObligationValue(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h serviceHandler) deleteObligationValue(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req obligations.DeleteObligationValueRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.DeleteObligationValue(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h serviceHandler) getObligationTrigger(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req obligations.GetObligationTriggerRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.GetObligationTrigger(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h serviceHandler) addObligationTrigger(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req obligations.AddObligationTriggerRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.AddObligationTrigger(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h serviceHandler) removeObligationTrigger(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req obligations.RemoveObligationTriggerRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.RemoveObligationTrigger(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h serviceHandler) listObligationTriggers(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req obligations.ListObligationTriggersRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.ListObligationTriggers(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} diff --git a/protocol/go/policy/registeredresources/registeredresourcesconnectv2/registered_resources.connect.go b/protocol/go/policy/registeredresources/registeredresourcesconnectv2/registered_resources.connect.go new file mode 100644 index 0000000000..0e88191943 --- /dev/null +++ b/protocol/go/policy/registeredresources/registeredresourcesconnectv2/registered_resources.connect.go @@ -0,0 +1,474 @@ +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: policy/registeredresources/registered_resources.proto + +package registeredresourcesconnectv2 + +import ( + connect "connectrpc.com/connect/v2" + context "context" + registeredresources "github.com/opentdf/platform/protocol/go/policy/registeredresources" + sync "sync" +) + +const ( + // RegisteredResourcesServiceName is the fully-qualified name of the RegisteredResourcesService + // service. + RegisteredResourcesServiceName = "policy.registeredresources.RegisteredResourcesService" +) + +// These constants are the procedure names of the RPCs defined in this package. They're exposed at +// runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // RegisteredResourcesServiceCreateRegisteredResourceProcedure is the procedure name of the + // RegisteredResourcesService's CreateRegisteredResource RPC. + RegisteredResourcesServiceCreateRegisteredResourceProcedure = "/policy.registeredresources.RegisteredResourcesService/CreateRegisteredResource" + // RegisteredResourcesServiceGetRegisteredResourceProcedure is the procedure name of the + // RegisteredResourcesService's GetRegisteredResource RPC. + RegisteredResourcesServiceGetRegisteredResourceProcedure = "/policy.registeredresources.RegisteredResourcesService/GetRegisteredResource" + // RegisteredResourcesServiceListRegisteredResourcesProcedure is the procedure name of the + // RegisteredResourcesService's ListRegisteredResources RPC. + RegisteredResourcesServiceListRegisteredResourcesProcedure = "/policy.registeredresources.RegisteredResourcesService/ListRegisteredResources" + // RegisteredResourcesServiceUpdateRegisteredResourceProcedure is the procedure name of the + // RegisteredResourcesService's UpdateRegisteredResource RPC. + RegisteredResourcesServiceUpdateRegisteredResourceProcedure = "/policy.registeredresources.RegisteredResourcesService/UpdateRegisteredResource" + // RegisteredResourcesServiceDeleteRegisteredResourceProcedure is the procedure name of the + // RegisteredResourcesService's DeleteRegisteredResource RPC. + RegisteredResourcesServiceDeleteRegisteredResourceProcedure = "/policy.registeredresources.RegisteredResourcesService/DeleteRegisteredResource" + // RegisteredResourcesServiceCreateRegisteredResourceValueProcedure is the procedure name of the + // RegisteredResourcesService's CreateRegisteredResourceValue RPC. + RegisteredResourcesServiceCreateRegisteredResourceValueProcedure = "/policy.registeredresources.RegisteredResourcesService/CreateRegisteredResourceValue" + // RegisteredResourcesServiceGetRegisteredResourceValueProcedure is the procedure name of the + // RegisteredResourcesService's GetRegisteredResourceValue RPC. + RegisteredResourcesServiceGetRegisteredResourceValueProcedure = "/policy.registeredresources.RegisteredResourcesService/GetRegisteredResourceValue" + // RegisteredResourcesServiceGetRegisteredResourceValuesByFQNsProcedure is the procedure name of the + // RegisteredResourcesService's GetRegisteredResourceValuesByFQNs RPC. + RegisteredResourcesServiceGetRegisteredResourceValuesByFQNsProcedure = "/policy.registeredresources.RegisteredResourcesService/GetRegisteredResourceValuesByFQNs" + // RegisteredResourcesServiceListRegisteredResourceValuesProcedure is the procedure name of the + // RegisteredResourcesService's ListRegisteredResourceValues RPC. + RegisteredResourcesServiceListRegisteredResourceValuesProcedure = "/policy.registeredresources.RegisteredResourcesService/ListRegisteredResourceValues" + // RegisteredResourcesServiceUpdateRegisteredResourceValueProcedure is the procedure name of the + // RegisteredResourcesService's UpdateRegisteredResourceValue RPC. + RegisteredResourcesServiceUpdateRegisteredResourceValueProcedure = "/policy.registeredresources.RegisteredResourcesService/UpdateRegisteredResourceValue" + // RegisteredResourcesServiceDeleteRegisteredResourceValueProcedure is the procedure name of the + // RegisteredResourcesService's DeleteRegisteredResourceValue RPC. + RegisteredResourcesServiceDeleteRegisteredResourceValueProcedure = "/policy.registeredresources.RegisteredResourcesService/DeleteRegisteredResourceValue" +) + +var ( + registeredResourcesServiceCreateRegisteredResourceSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: registeredresources.File_policy_registeredresources_registered_resources_proto.Services().ByName("RegisteredResourcesService").Methods().ByName("CreateRegisteredResource"), + Procedure: RegisteredResourcesServiceCreateRegisteredResourceProcedure, + } + }) + registeredResourcesServiceGetRegisteredResourceSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: registeredresources.File_policy_registeredresources_registered_resources_proto.Services().ByName("RegisteredResourcesService").Methods().ByName("GetRegisteredResource"), + Procedure: RegisteredResourcesServiceGetRegisteredResourceProcedure, + } + }) + registeredResourcesServiceListRegisteredResourcesSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: registeredresources.File_policy_registeredresources_registered_resources_proto.Services().ByName("RegisteredResourcesService").Methods().ByName("ListRegisteredResources"), + Procedure: RegisteredResourcesServiceListRegisteredResourcesProcedure, + } + }) + registeredResourcesServiceUpdateRegisteredResourceSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: registeredresources.File_policy_registeredresources_registered_resources_proto.Services().ByName("RegisteredResourcesService").Methods().ByName("UpdateRegisteredResource"), + Procedure: RegisteredResourcesServiceUpdateRegisteredResourceProcedure, + } + }) + registeredResourcesServiceDeleteRegisteredResourceSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: registeredresources.File_policy_registeredresources_registered_resources_proto.Services().ByName("RegisteredResourcesService").Methods().ByName("DeleteRegisteredResource"), + Procedure: RegisteredResourcesServiceDeleteRegisteredResourceProcedure, + } + }) + registeredResourcesServiceCreateRegisteredResourceValueSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: registeredresources.File_policy_registeredresources_registered_resources_proto.Services().ByName("RegisteredResourcesService").Methods().ByName("CreateRegisteredResourceValue"), + Procedure: RegisteredResourcesServiceCreateRegisteredResourceValueProcedure, + } + }) + registeredResourcesServiceGetRegisteredResourceValueSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: registeredresources.File_policy_registeredresources_registered_resources_proto.Services().ByName("RegisteredResourcesService").Methods().ByName("GetRegisteredResourceValue"), + Procedure: RegisteredResourcesServiceGetRegisteredResourceValueProcedure, + } + }) + registeredResourcesServiceGetRegisteredResourceValuesByFQNsSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: registeredresources.File_policy_registeredresources_registered_resources_proto.Services().ByName("RegisteredResourcesService").Methods().ByName("GetRegisteredResourceValuesByFQNs"), + Procedure: RegisteredResourcesServiceGetRegisteredResourceValuesByFQNsProcedure, + } + }) + registeredResourcesServiceListRegisteredResourceValuesSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: registeredresources.File_policy_registeredresources_registered_resources_proto.Services().ByName("RegisteredResourcesService").Methods().ByName("ListRegisteredResourceValues"), + Procedure: RegisteredResourcesServiceListRegisteredResourceValuesProcedure, + } + }) + registeredResourcesServiceUpdateRegisteredResourceValueSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: registeredresources.File_policy_registeredresources_registered_resources_proto.Services().ByName("RegisteredResourcesService").Methods().ByName("UpdateRegisteredResourceValue"), + Procedure: RegisteredResourcesServiceUpdateRegisteredResourceValueProcedure, + } + }) + registeredResourcesServiceDeleteRegisteredResourceValueSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: registeredresources.File_policy_registeredresources_registered_resources_proto.Services().ByName("RegisteredResourcesService").Methods().ByName("DeleteRegisteredResourceValue"), + Procedure: RegisteredResourcesServiceDeleteRegisteredResourceValueProcedure, + } + }) +) + +// RegisteredResourcesServiceClient is a client for the +// policy.registeredresources.RegisteredResourcesService service. +type RegisteredResourcesServiceClient interface { + CreateRegisteredResource(context.Context, *registeredresources.CreateRegisteredResourceRequest) (*registeredresources.CreateRegisteredResourceResponse, error) + GetRegisteredResource(context.Context, *registeredresources.GetRegisteredResourceRequest) (*registeredresources.GetRegisteredResourceResponse, error) + ListRegisteredResources(context.Context, *registeredresources.ListRegisteredResourcesRequest) (*registeredresources.ListRegisteredResourcesResponse, error) + UpdateRegisteredResource(context.Context, *registeredresources.UpdateRegisteredResourceRequest) (*registeredresources.UpdateRegisteredResourceResponse, error) + DeleteRegisteredResource(context.Context, *registeredresources.DeleteRegisteredResourceRequest) (*registeredresources.DeleteRegisteredResourceResponse, error) + CreateRegisteredResourceValue(context.Context, *registeredresources.CreateRegisteredResourceValueRequest) (*registeredresources.CreateRegisteredResourceValueResponse, error) + GetRegisteredResourceValue(context.Context, *registeredresources.GetRegisteredResourceValueRequest) (*registeredresources.GetRegisteredResourceValueResponse, error) + GetRegisteredResourceValuesByFQNs(context.Context, *registeredresources.GetRegisteredResourceValuesByFQNsRequest) (*registeredresources.GetRegisteredResourceValuesByFQNsResponse, error) + ListRegisteredResourceValues(context.Context, *registeredresources.ListRegisteredResourceValuesRequest) (*registeredresources.ListRegisteredResourceValuesResponse, error) + UpdateRegisteredResourceValue(context.Context, *registeredresources.UpdateRegisteredResourceValueRequest) (*registeredresources.UpdateRegisteredResourceValueResponse, error) + DeleteRegisteredResourceValue(context.Context, *registeredresources.DeleteRegisteredResourceValueRequest) (*registeredresources.DeleteRegisteredResourceValueResponse, error) +} + +// NewRegisteredResourcesServiceClient constructs a client for the +// policy.registeredresources.RegisteredResourcesService service. Multiple service clients may share +// a single connect.Client. +func NewRegisteredResourcesServiceClient(client *connect.Client) RegisteredResourcesServiceClient { + return ®isteredResourcesServiceClient{client: client} +} + +// RegisteredResourcesServiceHandler is an implementation of the +// policy.registeredresources.RegisteredResourcesService service. +type RegisteredResourcesServiceHandler interface { + CreateRegisteredResource(context.Context, *registeredresources.CreateRegisteredResourceRequest) (*registeredresources.CreateRegisteredResourceResponse, error) + GetRegisteredResource(context.Context, *registeredresources.GetRegisteredResourceRequest) (*registeredresources.GetRegisteredResourceResponse, error) + ListRegisteredResources(context.Context, *registeredresources.ListRegisteredResourcesRequest) (*registeredresources.ListRegisteredResourcesResponse, error) + UpdateRegisteredResource(context.Context, *registeredresources.UpdateRegisteredResourceRequest) (*registeredresources.UpdateRegisteredResourceResponse, error) + DeleteRegisteredResource(context.Context, *registeredresources.DeleteRegisteredResourceRequest) (*registeredresources.DeleteRegisteredResourceResponse, error) + CreateRegisteredResourceValue(context.Context, *registeredresources.CreateRegisteredResourceValueRequest) (*registeredresources.CreateRegisteredResourceValueResponse, error) + GetRegisteredResourceValue(context.Context, *registeredresources.GetRegisteredResourceValueRequest) (*registeredresources.GetRegisteredResourceValueResponse, error) + GetRegisteredResourceValuesByFQNs(context.Context, *registeredresources.GetRegisteredResourceValuesByFQNsRequest) (*registeredresources.GetRegisteredResourceValuesByFQNsResponse, error) + ListRegisteredResourceValues(context.Context, *registeredresources.ListRegisteredResourceValuesRequest) (*registeredresources.ListRegisteredResourceValuesResponse, error) + UpdateRegisteredResourceValue(context.Context, *registeredresources.UpdateRegisteredResourceValueRequest) (*registeredresources.UpdateRegisteredResourceValueResponse, error) + DeleteRegisteredResourceValue(context.Context, *registeredresources.DeleteRegisteredResourceValueRequest) (*registeredresources.DeleteRegisteredResourceValueResponse, error) +} + +// RegisterRegisteredResourcesServiceHandler registers svc as the +// policy.registeredresources.RegisteredResourcesService implementation on server. +func RegisterRegisteredResourcesServiceHandler(server *connect.Server, svc RegisteredResourcesServiceHandler) { + adapter := registeredResourcesServiceHandler{svc: svc} + server.Register( + connect.Method{Spec: registeredResourcesServiceCreateRegisteredResourceSpec(), Handler: adapter.createRegisteredResource}, + connect.Method{Spec: registeredResourcesServiceGetRegisteredResourceSpec(), Handler: adapter.getRegisteredResource}, + connect.Method{Spec: registeredResourcesServiceListRegisteredResourcesSpec(), Handler: adapter.listRegisteredResources}, + connect.Method{Spec: registeredResourcesServiceUpdateRegisteredResourceSpec(), Handler: adapter.updateRegisteredResource}, + connect.Method{Spec: registeredResourcesServiceDeleteRegisteredResourceSpec(), Handler: adapter.deleteRegisteredResource}, + connect.Method{Spec: registeredResourcesServiceCreateRegisteredResourceValueSpec(), Handler: adapter.createRegisteredResourceValue}, + connect.Method{Spec: registeredResourcesServiceGetRegisteredResourceValueSpec(), Handler: adapter.getRegisteredResourceValue}, + connect.Method{Spec: registeredResourcesServiceGetRegisteredResourceValuesByFQNsSpec(), Handler: adapter.getRegisteredResourceValuesByFQNs}, + connect.Method{Spec: registeredResourcesServiceListRegisteredResourceValuesSpec(), Handler: adapter.listRegisteredResourceValues}, + connect.Method{Spec: registeredResourcesServiceUpdateRegisteredResourceValueSpec(), Handler: adapter.updateRegisteredResourceValue}, + connect.Method{Spec: registeredResourcesServiceDeleteRegisteredResourceValueSpec(), Handler: adapter.deleteRegisteredResourceValue}, + ) +} + +// UnimplementedRegisteredResourcesServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedRegisteredResourcesServiceHandler struct{} + +func (UnimplementedRegisteredResourcesServiceHandler) CreateRegisteredResource(context.Context, *registeredresources.CreateRegisteredResourceRequest) (*registeredresources.CreateRegisteredResourceResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.registeredresources.RegisteredResourcesService.CreateRegisteredResource is not implemented") +} + +func (UnimplementedRegisteredResourcesServiceHandler) GetRegisteredResource(context.Context, *registeredresources.GetRegisteredResourceRequest) (*registeredresources.GetRegisteredResourceResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.registeredresources.RegisteredResourcesService.GetRegisteredResource is not implemented") +} + +func (UnimplementedRegisteredResourcesServiceHandler) ListRegisteredResources(context.Context, *registeredresources.ListRegisteredResourcesRequest) (*registeredresources.ListRegisteredResourcesResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.registeredresources.RegisteredResourcesService.ListRegisteredResources is not implemented") +} + +func (UnimplementedRegisteredResourcesServiceHandler) UpdateRegisteredResource(context.Context, *registeredresources.UpdateRegisteredResourceRequest) (*registeredresources.UpdateRegisteredResourceResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.registeredresources.RegisteredResourcesService.UpdateRegisteredResource is not implemented") +} + +func (UnimplementedRegisteredResourcesServiceHandler) DeleteRegisteredResource(context.Context, *registeredresources.DeleteRegisteredResourceRequest) (*registeredresources.DeleteRegisteredResourceResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.registeredresources.RegisteredResourcesService.DeleteRegisteredResource is not implemented") +} + +func (UnimplementedRegisteredResourcesServiceHandler) CreateRegisteredResourceValue(context.Context, *registeredresources.CreateRegisteredResourceValueRequest) (*registeredresources.CreateRegisteredResourceValueResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.registeredresources.RegisteredResourcesService.CreateRegisteredResourceValue is not implemented") +} + +func (UnimplementedRegisteredResourcesServiceHandler) GetRegisteredResourceValue(context.Context, *registeredresources.GetRegisteredResourceValueRequest) (*registeredresources.GetRegisteredResourceValueResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.registeredresources.RegisteredResourcesService.GetRegisteredResourceValue is not implemented") +} + +func (UnimplementedRegisteredResourcesServiceHandler) GetRegisteredResourceValuesByFQNs(context.Context, *registeredresources.GetRegisteredResourceValuesByFQNsRequest) (*registeredresources.GetRegisteredResourceValuesByFQNsResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.registeredresources.RegisteredResourcesService.GetRegisteredResourceValuesByFQNs is not implemented") +} + +func (UnimplementedRegisteredResourcesServiceHandler) ListRegisteredResourceValues(context.Context, *registeredresources.ListRegisteredResourceValuesRequest) (*registeredresources.ListRegisteredResourceValuesResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.registeredresources.RegisteredResourcesService.ListRegisteredResourceValues is not implemented") +} + +func (UnimplementedRegisteredResourcesServiceHandler) UpdateRegisteredResourceValue(context.Context, *registeredresources.UpdateRegisteredResourceValueRequest) (*registeredresources.UpdateRegisteredResourceValueResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.registeredresources.RegisteredResourcesService.UpdateRegisteredResourceValue is not implemented") +} + +func (UnimplementedRegisteredResourcesServiceHandler) DeleteRegisteredResourceValue(context.Context, *registeredresources.DeleteRegisteredResourceValueRequest) (*registeredresources.DeleteRegisteredResourceValueResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.registeredresources.RegisteredResourcesService.DeleteRegisteredResourceValue is not implemented") +} + +type registeredResourcesServiceClient struct { + client *connect.Client +} + +func (c *registeredResourcesServiceClient) CreateRegisteredResource(ctx context.Context, req *registeredresources.CreateRegisteredResourceRequest) (*registeredresources.CreateRegisteredResourceResponse, error) { + var res registeredresources.CreateRegisteredResourceResponse + if err := c.client.CallUnary(ctx, registeredResourcesServiceCreateRegisteredResourceSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *registeredResourcesServiceClient) GetRegisteredResource(ctx context.Context, req *registeredresources.GetRegisteredResourceRequest) (*registeredresources.GetRegisteredResourceResponse, error) { + var res registeredresources.GetRegisteredResourceResponse + if err := c.client.CallUnary(ctx, registeredResourcesServiceGetRegisteredResourceSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *registeredResourcesServiceClient) ListRegisteredResources(ctx context.Context, req *registeredresources.ListRegisteredResourcesRequest) (*registeredresources.ListRegisteredResourcesResponse, error) { + var res registeredresources.ListRegisteredResourcesResponse + if err := c.client.CallUnary(ctx, registeredResourcesServiceListRegisteredResourcesSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *registeredResourcesServiceClient) UpdateRegisteredResource(ctx context.Context, req *registeredresources.UpdateRegisteredResourceRequest) (*registeredresources.UpdateRegisteredResourceResponse, error) { + var res registeredresources.UpdateRegisteredResourceResponse + if err := c.client.CallUnary(ctx, registeredResourcesServiceUpdateRegisteredResourceSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *registeredResourcesServiceClient) DeleteRegisteredResource(ctx context.Context, req *registeredresources.DeleteRegisteredResourceRequest) (*registeredresources.DeleteRegisteredResourceResponse, error) { + var res registeredresources.DeleteRegisteredResourceResponse + if err := c.client.CallUnary(ctx, registeredResourcesServiceDeleteRegisteredResourceSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *registeredResourcesServiceClient) CreateRegisteredResourceValue(ctx context.Context, req *registeredresources.CreateRegisteredResourceValueRequest) (*registeredresources.CreateRegisteredResourceValueResponse, error) { + var res registeredresources.CreateRegisteredResourceValueResponse + if err := c.client.CallUnary(ctx, registeredResourcesServiceCreateRegisteredResourceValueSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *registeredResourcesServiceClient) GetRegisteredResourceValue(ctx context.Context, req *registeredresources.GetRegisteredResourceValueRequest) (*registeredresources.GetRegisteredResourceValueResponse, error) { + var res registeredresources.GetRegisteredResourceValueResponse + if err := c.client.CallUnary(ctx, registeredResourcesServiceGetRegisteredResourceValueSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *registeredResourcesServiceClient) GetRegisteredResourceValuesByFQNs(ctx context.Context, req *registeredresources.GetRegisteredResourceValuesByFQNsRequest) (*registeredresources.GetRegisteredResourceValuesByFQNsResponse, error) { + var res registeredresources.GetRegisteredResourceValuesByFQNsResponse + if err := c.client.CallUnary(ctx, registeredResourcesServiceGetRegisteredResourceValuesByFQNsSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *registeredResourcesServiceClient) ListRegisteredResourceValues(ctx context.Context, req *registeredresources.ListRegisteredResourceValuesRequest) (*registeredresources.ListRegisteredResourceValuesResponse, error) { + var res registeredresources.ListRegisteredResourceValuesResponse + if err := c.client.CallUnary(ctx, registeredResourcesServiceListRegisteredResourceValuesSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *registeredResourcesServiceClient) UpdateRegisteredResourceValue(ctx context.Context, req *registeredresources.UpdateRegisteredResourceValueRequest) (*registeredresources.UpdateRegisteredResourceValueResponse, error) { + var res registeredresources.UpdateRegisteredResourceValueResponse + if err := c.client.CallUnary(ctx, registeredResourcesServiceUpdateRegisteredResourceValueSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *registeredResourcesServiceClient) DeleteRegisteredResourceValue(ctx context.Context, req *registeredresources.DeleteRegisteredResourceValueRequest) (*registeredresources.DeleteRegisteredResourceValueResponse, error) { + var res registeredresources.DeleteRegisteredResourceValueResponse + if err := c.client.CallUnary(ctx, registeredResourcesServiceDeleteRegisteredResourceValueSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +type registeredResourcesServiceHandler struct { + svc RegisteredResourcesServiceHandler +} + +func (h registeredResourcesServiceHandler) createRegisteredResource(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req registeredresources.CreateRegisteredResourceRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.CreateRegisteredResource(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h registeredResourcesServiceHandler) getRegisteredResource(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req registeredresources.GetRegisteredResourceRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.GetRegisteredResource(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h registeredResourcesServiceHandler) listRegisteredResources(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req registeredresources.ListRegisteredResourcesRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.ListRegisteredResources(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h registeredResourcesServiceHandler) updateRegisteredResource(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req registeredresources.UpdateRegisteredResourceRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.UpdateRegisteredResource(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h registeredResourcesServiceHandler) deleteRegisteredResource(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req registeredresources.DeleteRegisteredResourceRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.DeleteRegisteredResource(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h registeredResourcesServiceHandler) createRegisteredResourceValue(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req registeredresources.CreateRegisteredResourceValueRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.CreateRegisteredResourceValue(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h registeredResourcesServiceHandler) getRegisteredResourceValue(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req registeredresources.GetRegisteredResourceValueRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.GetRegisteredResourceValue(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h registeredResourcesServiceHandler) getRegisteredResourceValuesByFQNs(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req registeredresources.GetRegisteredResourceValuesByFQNsRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.GetRegisteredResourceValuesByFQNs(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h registeredResourcesServiceHandler) listRegisteredResourceValues(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req registeredresources.ListRegisteredResourceValuesRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.ListRegisteredResourceValues(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h registeredResourcesServiceHandler) updateRegisteredResourceValue(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req registeredresources.UpdateRegisteredResourceValueRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.UpdateRegisteredResourceValue(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h registeredResourcesServiceHandler) deleteRegisteredResourceValue(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req registeredresources.DeleteRegisteredResourceValueRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.DeleteRegisteredResourceValue(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} diff --git a/protocol/go/policy/resourcemapping/resourcemappingconnectv2/resource_mapping.connect.go b/protocol/go/policy/resourcemapping/resourcemappingconnectv2/resource_mapping.connect.go new file mode 100644 index 0000000000..93171b6eed --- /dev/null +++ b/protocol/go/policy/resourcemapping/resourcemappingconnectv2/resource_mapping.connect.go @@ -0,0 +1,476 @@ +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: policy/resourcemapping/resource_mapping.proto + +package resourcemappingconnectv2 + +import ( + connect "connectrpc.com/connect/v2" + context "context" + resourcemapping "github.com/opentdf/platform/protocol/go/policy/resourcemapping" + sync "sync" +) + +const ( + // ResourceMappingServiceName is the fully-qualified name of the ResourceMappingService service. + ResourceMappingServiceName = "policy.resourcemapping.ResourceMappingService" +) + +// These constants are the procedure names of the RPCs defined in this package. They're exposed at +// runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // ResourceMappingServiceListResourceMappingGroupsProcedure is the procedure name of the + // ResourceMappingService's ListResourceMappingGroups RPC. + ResourceMappingServiceListResourceMappingGroupsProcedure = "/policy.resourcemapping.ResourceMappingService/ListResourceMappingGroups" + // ResourceMappingServiceGetResourceMappingGroupProcedure is the procedure name of the + // ResourceMappingService's GetResourceMappingGroup RPC. + ResourceMappingServiceGetResourceMappingGroupProcedure = "/policy.resourcemapping.ResourceMappingService/GetResourceMappingGroup" + // ResourceMappingServiceCreateResourceMappingGroupProcedure is the procedure name of the + // ResourceMappingService's CreateResourceMappingGroup RPC. + ResourceMappingServiceCreateResourceMappingGroupProcedure = "/policy.resourcemapping.ResourceMappingService/CreateResourceMappingGroup" + // ResourceMappingServiceUpdateResourceMappingGroupProcedure is the procedure name of the + // ResourceMappingService's UpdateResourceMappingGroup RPC. + ResourceMappingServiceUpdateResourceMappingGroupProcedure = "/policy.resourcemapping.ResourceMappingService/UpdateResourceMappingGroup" + // ResourceMappingServiceDeleteResourceMappingGroupProcedure is the procedure name of the + // ResourceMappingService's DeleteResourceMappingGroup RPC. + ResourceMappingServiceDeleteResourceMappingGroupProcedure = "/policy.resourcemapping.ResourceMappingService/DeleteResourceMappingGroup" + // ResourceMappingServiceListResourceMappingsProcedure is the procedure name of the + // ResourceMappingService's ListResourceMappings RPC. + ResourceMappingServiceListResourceMappingsProcedure = "/policy.resourcemapping.ResourceMappingService/ListResourceMappings" + // ResourceMappingServiceListResourceMappingsByGroupFqnsProcedure is the procedure name of the + // ResourceMappingService's ListResourceMappingsByGroupFqns RPC. + ResourceMappingServiceListResourceMappingsByGroupFqnsProcedure = "/policy.resourcemapping.ResourceMappingService/ListResourceMappingsByGroupFqns" + // ResourceMappingServiceGetResourceMappingProcedure is the procedure name of the + // ResourceMappingService's GetResourceMapping RPC. + ResourceMappingServiceGetResourceMappingProcedure = "/policy.resourcemapping.ResourceMappingService/GetResourceMapping" + // ResourceMappingServiceCreateResourceMappingProcedure is the procedure name of the + // ResourceMappingService's CreateResourceMapping RPC. + ResourceMappingServiceCreateResourceMappingProcedure = "/policy.resourcemapping.ResourceMappingService/CreateResourceMapping" + // ResourceMappingServiceUpdateResourceMappingProcedure is the procedure name of the + // ResourceMappingService's UpdateResourceMapping RPC. + ResourceMappingServiceUpdateResourceMappingProcedure = "/policy.resourcemapping.ResourceMappingService/UpdateResourceMapping" + // ResourceMappingServiceDeleteResourceMappingProcedure is the procedure name of the + // ResourceMappingService's DeleteResourceMapping RPC. + ResourceMappingServiceDeleteResourceMappingProcedure = "/policy.resourcemapping.ResourceMappingService/DeleteResourceMapping" +) + +var ( + resourceMappingServiceListResourceMappingGroupsSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: resourcemapping.File_policy_resourcemapping_resource_mapping_proto.Services().ByName("ResourceMappingService").Methods().ByName("ListResourceMappingGroups"), + Procedure: ResourceMappingServiceListResourceMappingGroupsProcedure, + IdempotencyLevel: connect.IdempotencyNoSideEffects, + } + }) + resourceMappingServiceGetResourceMappingGroupSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: resourcemapping.File_policy_resourcemapping_resource_mapping_proto.Services().ByName("ResourceMappingService").Methods().ByName("GetResourceMappingGroup"), + Procedure: ResourceMappingServiceGetResourceMappingGroupProcedure, + IdempotencyLevel: connect.IdempotencyNoSideEffects, + } + }) + resourceMappingServiceCreateResourceMappingGroupSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: resourcemapping.File_policy_resourcemapping_resource_mapping_proto.Services().ByName("ResourceMappingService").Methods().ByName("CreateResourceMappingGroup"), + Procedure: ResourceMappingServiceCreateResourceMappingGroupProcedure, + } + }) + resourceMappingServiceUpdateResourceMappingGroupSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: resourcemapping.File_policy_resourcemapping_resource_mapping_proto.Services().ByName("ResourceMappingService").Methods().ByName("UpdateResourceMappingGroup"), + Procedure: ResourceMappingServiceUpdateResourceMappingGroupProcedure, + } + }) + resourceMappingServiceDeleteResourceMappingGroupSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: resourcemapping.File_policy_resourcemapping_resource_mapping_proto.Services().ByName("ResourceMappingService").Methods().ByName("DeleteResourceMappingGroup"), + Procedure: ResourceMappingServiceDeleteResourceMappingGroupProcedure, + } + }) + resourceMappingServiceListResourceMappingsSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: resourcemapping.File_policy_resourcemapping_resource_mapping_proto.Services().ByName("ResourceMappingService").Methods().ByName("ListResourceMappings"), + Procedure: ResourceMappingServiceListResourceMappingsProcedure, + IdempotencyLevel: connect.IdempotencyNoSideEffects, + } + }) + resourceMappingServiceListResourceMappingsByGroupFqnsSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: resourcemapping.File_policy_resourcemapping_resource_mapping_proto.Services().ByName("ResourceMappingService").Methods().ByName("ListResourceMappingsByGroupFqns"), + Procedure: ResourceMappingServiceListResourceMappingsByGroupFqnsProcedure, + IdempotencyLevel: connect.IdempotencyNoSideEffects, + } + }) + resourceMappingServiceGetResourceMappingSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: resourcemapping.File_policy_resourcemapping_resource_mapping_proto.Services().ByName("ResourceMappingService").Methods().ByName("GetResourceMapping"), + Procedure: ResourceMappingServiceGetResourceMappingProcedure, + IdempotencyLevel: connect.IdempotencyNoSideEffects, + } + }) + resourceMappingServiceCreateResourceMappingSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: resourcemapping.File_policy_resourcemapping_resource_mapping_proto.Services().ByName("ResourceMappingService").Methods().ByName("CreateResourceMapping"), + Procedure: ResourceMappingServiceCreateResourceMappingProcedure, + } + }) + resourceMappingServiceUpdateResourceMappingSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: resourcemapping.File_policy_resourcemapping_resource_mapping_proto.Services().ByName("ResourceMappingService").Methods().ByName("UpdateResourceMapping"), + Procedure: ResourceMappingServiceUpdateResourceMappingProcedure, + } + }) + resourceMappingServiceDeleteResourceMappingSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: resourcemapping.File_policy_resourcemapping_resource_mapping_proto.Services().ByName("ResourceMappingService").Methods().ByName("DeleteResourceMapping"), + Procedure: ResourceMappingServiceDeleteResourceMappingProcedure, + } + }) +) + +// ResourceMappingServiceClient is a client for the policy.resourcemapping.ResourceMappingService +// service. +type ResourceMappingServiceClient interface { + ListResourceMappingGroups(context.Context, *resourcemapping.ListResourceMappingGroupsRequest) (*resourcemapping.ListResourceMappingGroupsResponse, error) + GetResourceMappingGroup(context.Context, *resourcemapping.GetResourceMappingGroupRequest) (*resourcemapping.GetResourceMappingGroupResponse, error) + CreateResourceMappingGroup(context.Context, *resourcemapping.CreateResourceMappingGroupRequest) (*resourcemapping.CreateResourceMappingGroupResponse, error) + UpdateResourceMappingGroup(context.Context, *resourcemapping.UpdateResourceMappingGroupRequest) (*resourcemapping.UpdateResourceMappingGroupResponse, error) + DeleteResourceMappingGroup(context.Context, *resourcemapping.DeleteResourceMappingGroupRequest) (*resourcemapping.DeleteResourceMappingGroupResponse, error) + ListResourceMappings(context.Context, *resourcemapping.ListResourceMappingsRequest) (*resourcemapping.ListResourceMappingsResponse, error) + ListResourceMappingsByGroupFqns(context.Context, *resourcemapping.ListResourceMappingsByGroupFqnsRequest) (*resourcemapping.ListResourceMappingsByGroupFqnsResponse, error) + GetResourceMapping(context.Context, *resourcemapping.GetResourceMappingRequest) (*resourcemapping.GetResourceMappingResponse, error) + CreateResourceMapping(context.Context, *resourcemapping.CreateResourceMappingRequest) (*resourcemapping.CreateResourceMappingResponse, error) + UpdateResourceMapping(context.Context, *resourcemapping.UpdateResourceMappingRequest) (*resourcemapping.UpdateResourceMappingResponse, error) + DeleteResourceMapping(context.Context, *resourcemapping.DeleteResourceMappingRequest) (*resourcemapping.DeleteResourceMappingResponse, error) +} + +// NewResourceMappingServiceClient constructs a client for the +// policy.resourcemapping.ResourceMappingService service. Multiple service clients may share a +// single connect.Client. +func NewResourceMappingServiceClient(client *connect.Client) ResourceMappingServiceClient { + return &resourceMappingServiceClient{client: client} +} + +// ResourceMappingServiceHandler is an implementation of the +// policy.resourcemapping.ResourceMappingService service. +type ResourceMappingServiceHandler interface { + ListResourceMappingGroups(context.Context, *resourcemapping.ListResourceMappingGroupsRequest) (*resourcemapping.ListResourceMappingGroupsResponse, error) + GetResourceMappingGroup(context.Context, *resourcemapping.GetResourceMappingGroupRequest) (*resourcemapping.GetResourceMappingGroupResponse, error) + CreateResourceMappingGroup(context.Context, *resourcemapping.CreateResourceMappingGroupRequest) (*resourcemapping.CreateResourceMappingGroupResponse, error) + UpdateResourceMappingGroup(context.Context, *resourcemapping.UpdateResourceMappingGroupRequest) (*resourcemapping.UpdateResourceMappingGroupResponse, error) + DeleteResourceMappingGroup(context.Context, *resourcemapping.DeleteResourceMappingGroupRequest) (*resourcemapping.DeleteResourceMappingGroupResponse, error) + ListResourceMappings(context.Context, *resourcemapping.ListResourceMappingsRequest) (*resourcemapping.ListResourceMappingsResponse, error) + ListResourceMappingsByGroupFqns(context.Context, *resourcemapping.ListResourceMappingsByGroupFqnsRequest) (*resourcemapping.ListResourceMappingsByGroupFqnsResponse, error) + GetResourceMapping(context.Context, *resourcemapping.GetResourceMappingRequest) (*resourcemapping.GetResourceMappingResponse, error) + CreateResourceMapping(context.Context, *resourcemapping.CreateResourceMappingRequest) (*resourcemapping.CreateResourceMappingResponse, error) + UpdateResourceMapping(context.Context, *resourcemapping.UpdateResourceMappingRequest) (*resourcemapping.UpdateResourceMappingResponse, error) + DeleteResourceMapping(context.Context, *resourcemapping.DeleteResourceMappingRequest) (*resourcemapping.DeleteResourceMappingResponse, error) +} + +// RegisterResourceMappingServiceHandler registers svc as the +// policy.resourcemapping.ResourceMappingService implementation on server. +func RegisterResourceMappingServiceHandler(server *connect.Server, svc ResourceMappingServiceHandler) { + adapter := resourceMappingServiceHandler{svc: svc} + server.Register( + connect.Method{Spec: resourceMappingServiceListResourceMappingGroupsSpec(), Handler: adapter.listResourceMappingGroups}, + connect.Method{Spec: resourceMappingServiceGetResourceMappingGroupSpec(), Handler: adapter.getResourceMappingGroup}, + connect.Method{Spec: resourceMappingServiceCreateResourceMappingGroupSpec(), Handler: adapter.createResourceMappingGroup}, + connect.Method{Spec: resourceMappingServiceUpdateResourceMappingGroupSpec(), Handler: adapter.updateResourceMappingGroup}, + connect.Method{Spec: resourceMappingServiceDeleteResourceMappingGroupSpec(), Handler: adapter.deleteResourceMappingGroup}, + connect.Method{Spec: resourceMappingServiceListResourceMappingsSpec(), Handler: adapter.listResourceMappings}, + connect.Method{Spec: resourceMappingServiceListResourceMappingsByGroupFqnsSpec(), Handler: adapter.listResourceMappingsByGroupFqns}, + connect.Method{Spec: resourceMappingServiceGetResourceMappingSpec(), Handler: adapter.getResourceMapping}, + connect.Method{Spec: resourceMappingServiceCreateResourceMappingSpec(), Handler: adapter.createResourceMapping}, + connect.Method{Spec: resourceMappingServiceUpdateResourceMappingSpec(), Handler: adapter.updateResourceMapping}, + connect.Method{Spec: resourceMappingServiceDeleteResourceMappingSpec(), Handler: adapter.deleteResourceMapping}, + ) +} + +// UnimplementedResourceMappingServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedResourceMappingServiceHandler struct{} + +func (UnimplementedResourceMappingServiceHandler) ListResourceMappingGroups(context.Context, *resourcemapping.ListResourceMappingGroupsRequest) (*resourcemapping.ListResourceMappingGroupsResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.resourcemapping.ResourceMappingService.ListResourceMappingGroups is not implemented") +} + +func (UnimplementedResourceMappingServiceHandler) GetResourceMappingGroup(context.Context, *resourcemapping.GetResourceMappingGroupRequest) (*resourcemapping.GetResourceMappingGroupResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.resourcemapping.ResourceMappingService.GetResourceMappingGroup is not implemented") +} + +func (UnimplementedResourceMappingServiceHandler) CreateResourceMappingGroup(context.Context, *resourcemapping.CreateResourceMappingGroupRequest) (*resourcemapping.CreateResourceMappingGroupResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.resourcemapping.ResourceMappingService.CreateResourceMappingGroup is not implemented") +} + +func (UnimplementedResourceMappingServiceHandler) UpdateResourceMappingGroup(context.Context, *resourcemapping.UpdateResourceMappingGroupRequest) (*resourcemapping.UpdateResourceMappingGroupResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.resourcemapping.ResourceMappingService.UpdateResourceMappingGroup is not implemented") +} + +func (UnimplementedResourceMappingServiceHandler) DeleteResourceMappingGroup(context.Context, *resourcemapping.DeleteResourceMappingGroupRequest) (*resourcemapping.DeleteResourceMappingGroupResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.resourcemapping.ResourceMappingService.DeleteResourceMappingGroup is not implemented") +} + +func (UnimplementedResourceMappingServiceHandler) ListResourceMappings(context.Context, *resourcemapping.ListResourceMappingsRequest) (*resourcemapping.ListResourceMappingsResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.resourcemapping.ResourceMappingService.ListResourceMappings is not implemented") +} + +func (UnimplementedResourceMappingServiceHandler) ListResourceMappingsByGroupFqns(context.Context, *resourcemapping.ListResourceMappingsByGroupFqnsRequest) (*resourcemapping.ListResourceMappingsByGroupFqnsResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.resourcemapping.ResourceMappingService.ListResourceMappingsByGroupFqns is not implemented") +} + +func (UnimplementedResourceMappingServiceHandler) GetResourceMapping(context.Context, *resourcemapping.GetResourceMappingRequest) (*resourcemapping.GetResourceMappingResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.resourcemapping.ResourceMappingService.GetResourceMapping is not implemented") +} + +func (UnimplementedResourceMappingServiceHandler) CreateResourceMapping(context.Context, *resourcemapping.CreateResourceMappingRequest) (*resourcemapping.CreateResourceMappingResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.resourcemapping.ResourceMappingService.CreateResourceMapping is not implemented") +} + +func (UnimplementedResourceMappingServiceHandler) UpdateResourceMapping(context.Context, *resourcemapping.UpdateResourceMappingRequest) (*resourcemapping.UpdateResourceMappingResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.resourcemapping.ResourceMappingService.UpdateResourceMapping is not implemented") +} + +func (UnimplementedResourceMappingServiceHandler) DeleteResourceMapping(context.Context, *resourcemapping.DeleteResourceMappingRequest) (*resourcemapping.DeleteResourceMappingResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.resourcemapping.ResourceMappingService.DeleteResourceMapping is not implemented") +} + +type resourceMappingServiceClient struct { + client *connect.Client +} + +func (c *resourceMappingServiceClient) ListResourceMappingGroups(ctx context.Context, req *resourcemapping.ListResourceMappingGroupsRequest) (*resourcemapping.ListResourceMappingGroupsResponse, error) { + var res resourcemapping.ListResourceMappingGroupsResponse + if err := c.client.CallUnary(ctx, resourceMappingServiceListResourceMappingGroupsSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *resourceMappingServiceClient) GetResourceMappingGroup(ctx context.Context, req *resourcemapping.GetResourceMappingGroupRequest) (*resourcemapping.GetResourceMappingGroupResponse, error) { + var res resourcemapping.GetResourceMappingGroupResponse + if err := c.client.CallUnary(ctx, resourceMappingServiceGetResourceMappingGroupSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *resourceMappingServiceClient) CreateResourceMappingGroup(ctx context.Context, req *resourcemapping.CreateResourceMappingGroupRequest) (*resourcemapping.CreateResourceMappingGroupResponse, error) { + var res resourcemapping.CreateResourceMappingGroupResponse + if err := c.client.CallUnary(ctx, resourceMappingServiceCreateResourceMappingGroupSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *resourceMappingServiceClient) UpdateResourceMappingGroup(ctx context.Context, req *resourcemapping.UpdateResourceMappingGroupRequest) (*resourcemapping.UpdateResourceMappingGroupResponse, error) { + var res resourcemapping.UpdateResourceMappingGroupResponse + if err := c.client.CallUnary(ctx, resourceMappingServiceUpdateResourceMappingGroupSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *resourceMappingServiceClient) DeleteResourceMappingGroup(ctx context.Context, req *resourcemapping.DeleteResourceMappingGroupRequest) (*resourcemapping.DeleteResourceMappingGroupResponse, error) { + var res resourcemapping.DeleteResourceMappingGroupResponse + if err := c.client.CallUnary(ctx, resourceMappingServiceDeleteResourceMappingGroupSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *resourceMappingServiceClient) ListResourceMappings(ctx context.Context, req *resourcemapping.ListResourceMappingsRequest) (*resourcemapping.ListResourceMappingsResponse, error) { + var res resourcemapping.ListResourceMappingsResponse + if err := c.client.CallUnary(ctx, resourceMappingServiceListResourceMappingsSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *resourceMappingServiceClient) ListResourceMappingsByGroupFqns(ctx context.Context, req *resourcemapping.ListResourceMappingsByGroupFqnsRequest) (*resourcemapping.ListResourceMappingsByGroupFqnsResponse, error) { + var res resourcemapping.ListResourceMappingsByGroupFqnsResponse + if err := c.client.CallUnary(ctx, resourceMappingServiceListResourceMappingsByGroupFqnsSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *resourceMappingServiceClient) GetResourceMapping(ctx context.Context, req *resourcemapping.GetResourceMappingRequest) (*resourcemapping.GetResourceMappingResponse, error) { + var res resourcemapping.GetResourceMappingResponse + if err := c.client.CallUnary(ctx, resourceMappingServiceGetResourceMappingSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *resourceMappingServiceClient) CreateResourceMapping(ctx context.Context, req *resourcemapping.CreateResourceMappingRequest) (*resourcemapping.CreateResourceMappingResponse, error) { + var res resourcemapping.CreateResourceMappingResponse + if err := c.client.CallUnary(ctx, resourceMappingServiceCreateResourceMappingSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *resourceMappingServiceClient) UpdateResourceMapping(ctx context.Context, req *resourcemapping.UpdateResourceMappingRequest) (*resourcemapping.UpdateResourceMappingResponse, error) { + var res resourcemapping.UpdateResourceMappingResponse + if err := c.client.CallUnary(ctx, resourceMappingServiceUpdateResourceMappingSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *resourceMappingServiceClient) DeleteResourceMapping(ctx context.Context, req *resourcemapping.DeleteResourceMappingRequest) (*resourcemapping.DeleteResourceMappingResponse, error) { + var res resourcemapping.DeleteResourceMappingResponse + if err := c.client.CallUnary(ctx, resourceMappingServiceDeleteResourceMappingSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +type resourceMappingServiceHandler struct{ svc ResourceMappingServiceHandler } + +func (h resourceMappingServiceHandler) listResourceMappingGroups(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req resourcemapping.ListResourceMappingGroupsRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.ListResourceMappingGroups(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h resourceMappingServiceHandler) getResourceMappingGroup(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req resourcemapping.GetResourceMappingGroupRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.GetResourceMappingGroup(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h resourceMappingServiceHandler) createResourceMappingGroup(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req resourcemapping.CreateResourceMappingGroupRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.CreateResourceMappingGroup(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h resourceMappingServiceHandler) updateResourceMappingGroup(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req resourcemapping.UpdateResourceMappingGroupRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.UpdateResourceMappingGroup(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h resourceMappingServiceHandler) deleteResourceMappingGroup(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req resourcemapping.DeleteResourceMappingGroupRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.DeleteResourceMappingGroup(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h resourceMappingServiceHandler) listResourceMappings(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req resourcemapping.ListResourceMappingsRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.ListResourceMappings(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h resourceMappingServiceHandler) listResourceMappingsByGroupFqns(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req resourcemapping.ListResourceMappingsByGroupFqnsRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.ListResourceMappingsByGroupFqns(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h resourceMappingServiceHandler) getResourceMapping(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req resourcemapping.GetResourceMappingRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.GetResourceMapping(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h resourceMappingServiceHandler) createResourceMapping(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req resourcemapping.CreateResourceMappingRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.CreateResourceMapping(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h resourceMappingServiceHandler) updateResourceMapping(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req resourcemapping.UpdateResourceMappingRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.UpdateResourceMapping(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h resourceMappingServiceHandler) deleteResourceMapping(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req resourcemapping.DeleteResourceMappingRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.DeleteResourceMapping(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} diff --git a/protocol/go/policy/subjectmapping/subjectmappingconnectv2/subject_mapping.connect.go b/protocol/go/policy/subjectmapping/subjectmappingconnectv2/subject_mapping.connect.go new file mode 100644 index 0000000000..1960b3da6a --- /dev/null +++ b/protocol/go/policy/subjectmapping/subjectmappingconnectv2/subject_mapping.connect.go @@ -0,0 +1,514 @@ +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: policy/subjectmapping/subject_mapping.proto + +package subjectmappingconnectv2 + +import ( + connect "connectrpc.com/connect/v2" + context "context" + subjectmapping "github.com/opentdf/platform/protocol/go/policy/subjectmapping" + sync "sync" +) + +const ( + // SubjectMappingServiceName is the fully-qualified name of the SubjectMappingService service. + SubjectMappingServiceName = "policy.subjectmapping.SubjectMappingService" +) + +// These constants are the procedure names of the RPCs defined in this package. They're exposed at +// runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // SubjectMappingServiceMatchSubjectMappingsProcedure is the procedure name of the + // SubjectMappingService's MatchSubjectMappings RPC. + SubjectMappingServiceMatchSubjectMappingsProcedure = "/policy.subjectmapping.SubjectMappingService/MatchSubjectMappings" + // SubjectMappingServiceListSubjectMappingsProcedure is the procedure name of the + // SubjectMappingService's ListSubjectMappings RPC. + SubjectMappingServiceListSubjectMappingsProcedure = "/policy.subjectmapping.SubjectMappingService/ListSubjectMappings" + // SubjectMappingServiceGetSubjectMappingProcedure is the procedure name of the + // SubjectMappingService's GetSubjectMapping RPC. + SubjectMappingServiceGetSubjectMappingProcedure = "/policy.subjectmapping.SubjectMappingService/GetSubjectMapping" + // SubjectMappingServiceCreateSubjectMappingProcedure is the procedure name of the + // SubjectMappingService's CreateSubjectMapping RPC. + SubjectMappingServiceCreateSubjectMappingProcedure = "/policy.subjectmapping.SubjectMappingService/CreateSubjectMapping" + // SubjectMappingServiceUpdateSubjectMappingProcedure is the procedure name of the + // SubjectMappingService's UpdateSubjectMapping RPC. + SubjectMappingServiceUpdateSubjectMappingProcedure = "/policy.subjectmapping.SubjectMappingService/UpdateSubjectMapping" + // SubjectMappingServiceDeleteSubjectMappingProcedure is the procedure name of the + // SubjectMappingService's DeleteSubjectMapping RPC. + SubjectMappingServiceDeleteSubjectMappingProcedure = "/policy.subjectmapping.SubjectMappingService/DeleteSubjectMapping" + // SubjectMappingServiceListSubjectConditionSetsProcedure is the procedure name of the + // SubjectMappingService's ListSubjectConditionSets RPC. + SubjectMappingServiceListSubjectConditionSetsProcedure = "/policy.subjectmapping.SubjectMappingService/ListSubjectConditionSets" + // SubjectMappingServiceGetSubjectConditionSetProcedure is the procedure name of the + // SubjectMappingService's GetSubjectConditionSet RPC. + SubjectMappingServiceGetSubjectConditionSetProcedure = "/policy.subjectmapping.SubjectMappingService/GetSubjectConditionSet" + // SubjectMappingServiceCreateSubjectConditionSetProcedure is the procedure name of the + // SubjectMappingService's CreateSubjectConditionSet RPC. + SubjectMappingServiceCreateSubjectConditionSetProcedure = "/policy.subjectmapping.SubjectMappingService/CreateSubjectConditionSet" + // SubjectMappingServiceUpdateSubjectConditionSetProcedure is the procedure name of the + // SubjectMappingService's UpdateSubjectConditionSet RPC. + SubjectMappingServiceUpdateSubjectConditionSetProcedure = "/policy.subjectmapping.SubjectMappingService/UpdateSubjectConditionSet" + // SubjectMappingServiceDeleteSubjectConditionSetProcedure is the procedure name of the + // SubjectMappingService's DeleteSubjectConditionSet RPC. + SubjectMappingServiceDeleteSubjectConditionSetProcedure = "/policy.subjectmapping.SubjectMappingService/DeleteSubjectConditionSet" + // SubjectMappingServiceDeleteAllUnmappedSubjectConditionSetsProcedure is the procedure name of the + // SubjectMappingService's DeleteAllUnmappedSubjectConditionSets RPC. + SubjectMappingServiceDeleteAllUnmappedSubjectConditionSetsProcedure = "/policy.subjectmapping.SubjectMappingService/DeleteAllUnmappedSubjectConditionSets" +) + +var ( + subjectMappingServiceMatchSubjectMappingsSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: subjectmapping.File_policy_subjectmapping_subject_mapping_proto.Services().ByName("SubjectMappingService").Methods().ByName("MatchSubjectMappings"), + Procedure: SubjectMappingServiceMatchSubjectMappingsProcedure, + } + }) + subjectMappingServiceListSubjectMappingsSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: subjectmapping.File_policy_subjectmapping_subject_mapping_proto.Services().ByName("SubjectMappingService").Methods().ByName("ListSubjectMappings"), + Procedure: SubjectMappingServiceListSubjectMappingsProcedure, + IdempotencyLevel: connect.IdempotencyNoSideEffects, + } + }) + subjectMappingServiceGetSubjectMappingSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: subjectmapping.File_policy_subjectmapping_subject_mapping_proto.Services().ByName("SubjectMappingService").Methods().ByName("GetSubjectMapping"), + Procedure: SubjectMappingServiceGetSubjectMappingProcedure, + IdempotencyLevel: connect.IdempotencyNoSideEffects, + } + }) + subjectMappingServiceCreateSubjectMappingSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: subjectmapping.File_policy_subjectmapping_subject_mapping_proto.Services().ByName("SubjectMappingService").Methods().ByName("CreateSubjectMapping"), + Procedure: SubjectMappingServiceCreateSubjectMappingProcedure, + } + }) + subjectMappingServiceUpdateSubjectMappingSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: subjectmapping.File_policy_subjectmapping_subject_mapping_proto.Services().ByName("SubjectMappingService").Methods().ByName("UpdateSubjectMapping"), + Procedure: SubjectMappingServiceUpdateSubjectMappingProcedure, + } + }) + subjectMappingServiceDeleteSubjectMappingSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: subjectmapping.File_policy_subjectmapping_subject_mapping_proto.Services().ByName("SubjectMappingService").Methods().ByName("DeleteSubjectMapping"), + Procedure: SubjectMappingServiceDeleteSubjectMappingProcedure, + } + }) + subjectMappingServiceListSubjectConditionSetsSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: subjectmapping.File_policy_subjectmapping_subject_mapping_proto.Services().ByName("SubjectMappingService").Methods().ByName("ListSubjectConditionSets"), + Procedure: SubjectMappingServiceListSubjectConditionSetsProcedure, + IdempotencyLevel: connect.IdempotencyNoSideEffects, + } + }) + subjectMappingServiceGetSubjectConditionSetSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: subjectmapping.File_policy_subjectmapping_subject_mapping_proto.Services().ByName("SubjectMappingService").Methods().ByName("GetSubjectConditionSet"), + Procedure: SubjectMappingServiceGetSubjectConditionSetProcedure, + IdempotencyLevel: connect.IdempotencyNoSideEffects, + } + }) + subjectMappingServiceCreateSubjectConditionSetSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: subjectmapping.File_policy_subjectmapping_subject_mapping_proto.Services().ByName("SubjectMappingService").Methods().ByName("CreateSubjectConditionSet"), + Procedure: SubjectMappingServiceCreateSubjectConditionSetProcedure, + } + }) + subjectMappingServiceUpdateSubjectConditionSetSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: subjectmapping.File_policy_subjectmapping_subject_mapping_proto.Services().ByName("SubjectMappingService").Methods().ByName("UpdateSubjectConditionSet"), + Procedure: SubjectMappingServiceUpdateSubjectConditionSetProcedure, + } + }) + subjectMappingServiceDeleteSubjectConditionSetSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: subjectmapping.File_policy_subjectmapping_subject_mapping_proto.Services().ByName("SubjectMappingService").Methods().ByName("DeleteSubjectConditionSet"), + Procedure: SubjectMappingServiceDeleteSubjectConditionSetProcedure, + } + }) + subjectMappingServiceDeleteAllUnmappedSubjectConditionSetsSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: subjectmapping.File_policy_subjectmapping_subject_mapping_proto.Services().ByName("SubjectMappingService").Methods().ByName("DeleteAllUnmappedSubjectConditionSets"), + Procedure: SubjectMappingServiceDeleteAllUnmappedSubjectConditionSetsProcedure, + } + }) +) + +// SubjectMappingServiceClient is a client for the policy.subjectmapping.SubjectMappingService +// service. +type SubjectMappingServiceClient interface { + // Find matching Subject Mappings for a given Subject + MatchSubjectMappings(context.Context, *subjectmapping.MatchSubjectMappingsRequest) (*subjectmapping.MatchSubjectMappingsResponse, error) + ListSubjectMappings(context.Context, *subjectmapping.ListSubjectMappingsRequest) (*subjectmapping.ListSubjectMappingsResponse, error) + GetSubjectMapping(context.Context, *subjectmapping.GetSubjectMappingRequest) (*subjectmapping.GetSubjectMappingResponse, error) + CreateSubjectMapping(context.Context, *subjectmapping.CreateSubjectMappingRequest) (*subjectmapping.CreateSubjectMappingResponse, error) + UpdateSubjectMapping(context.Context, *subjectmapping.UpdateSubjectMappingRequest) (*subjectmapping.UpdateSubjectMappingResponse, error) + DeleteSubjectMapping(context.Context, *subjectmapping.DeleteSubjectMappingRequest) (*subjectmapping.DeleteSubjectMappingResponse, error) + ListSubjectConditionSets(context.Context, *subjectmapping.ListSubjectConditionSetsRequest) (*subjectmapping.ListSubjectConditionSetsResponse, error) + GetSubjectConditionSet(context.Context, *subjectmapping.GetSubjectConditionSetRequest) (*subjectmapping.GetSubjectConditionSetResponse, error) + CreateSubjectConditionSet(context.Context, *subjectmapping.CreateSubjectConditionSetRequest) (*subjectmapping.CreateSubjectConditionSetResponse, error) + UpdateSubjectConditionSet(context.Context, *subjectmapping.UpdateSubjectConditionSetRequest) (*subjectmapping.UpdateSubjectConditionSetResponse, error) + DeleteSubjectConditionSet(context.Context, *subjectmapping.DeleteSubjectConditionSetRequest) (*subjectmapping.DeleteSubjectConditionSetResponse, error) + DeleteAllUnmappedSubjectConditionSets(context.Context, *subjectmapping.DeleteAllUnmappedSubjectConditionSetsRequest) (*subjectmapping.DeleteAllUnmappedSubjectConditionSetsResponse, error) +} + +// NewSubjectMappingServiceClient constructs a client for the +// policy.subjectmapping.SubjectMappingService service. Multiple service clients may share a single +// connect.Client. +func NewSubjectMappingServiceClient(client *connect.Client) SubjectMappingServiceClient { + return &subjectMappingServiceClient{client: client} +} + +// SubjectMappingServiceHandler is an implementation of the +// policy.subjectmapping.SubjectMappingService service. +type SubjectMappingServiceHandler interface { + // Find matching Subject Mappings for a given Subject + MatchSubjectMappings(context.Context, *subjectmapping.MatchSubjectMappingsRequest) (*subjectmapping.MatchSubjectMappingsResponse, error) + ListSubjectMappings(context.Context, *subjectmapping.ListSubjectMappingsRequest) (*subjectmapping.ListSubjectMappingsResponse, error) + GetSubjectMapping(context.Context, *subjectmapping.GetSubjectMappingRequest) (*subjectmapping.GetSubjectMappingResponse, error) + CreateSubjectMapping(context.Context, *subjectmapping.CreateSubjectMappingRequest) (*subjectmapping.CreateSubjectMappingResponse, error) + UpdateSubjectMapping(context.Context, *subjectmapping.UpdateSubjectMappingRequest) (*subjectmapping.UpdateSubjectMappingResponse, error) + DeleteSubjectMapping(context.Context, *subjectmapping.DeleteSubjectMappingRequest) (*subjectmapping.DeleteSubjectMappingResponse, error) + ListSubjectConditionSets(context.Context, *subjectmapping.ListSubjectConditionSetsRequest) (*subjectmapping.ListSubjectConditionSetsResponse, error) + GetSubjectConditionSet(context.Context, *subjectmapping.GetSubjectConditionSetRequest) (*subjectmapping.GetSubjectConditionSetResponse, error) + CreateSubjectConditionSet(context.Context, *subjectmapping.CreateSubjectConditionSetRequest) (*subjectmapping.CreateSubjectConditionSetResponse, error) + UpdateSubjectConditionSet(context.Context, *subjectmapping.UpdateSubjectConditionSetRequest) (*subjectmapping.UpdateSubjectConditionSetResponse, error) + DeleteSubjectConditionSet(context.Context, *subjectmapping.DeleteSubjectConditionSetRequest) (*subjectmapping.DeleteSubjectConditionSetResponse, error) + DeleteAllUnmappedSubjectConditionSets(context.Context, *subjectmapping.DeleteAllUnmappedSubjectConditionSetsRequest) (*subjectmapping.DeleteAllUnmappedSubjectConditionSetsResponse, error) +} + +// RegisterSubjectMappingServiceHandler registers svc as the +// policy.subjectmapping.SubjectMappingService implementation on server. +func RegisterSubjectMappingServiceHandler(server *connect.Server, svc SubjectMappingServiceHandler) { + adapter := subjectMappingServiceHandler{svc: svc} + server.Register( + connect.Method{Spec: subjectMappingServiceMatchSubjectMappingsSpec(), Handler: adapter.matchSubjectMappings}, + connect.Method{Spec: subjectMappingServiceListSubjectMappingsSpec(), Handler: adapter.listSubjectMappings}, + connect.Method{Spec: subjectMappingServiceGetSubjectMappingSpec(), Handler: adapter.getSubjectMapping}, + connect.Method{Spec: subjectMappingServiceCreateSubjectMappingSpec(), Handler: adapter.createSubjectMapping}, + connect.Method{Spec: subjectMappingServiceUpdateSubjectMappingSpec(), Handler: adapter.updateSubjectMapping}, + connect.Method{Spec: subjectMappingServiceDeleteSubjectMappingSpec(), Handler: adapter.deleteSubjectMapping}, + connect.Method{Spec: subjectMappingServiceListSubjectConditionSetsSpec(), Handler: adapter.listSubjectConditionSets}, + connect.Method{Spec: subjectMappingServiceGetSubjectConditionSetSpec(), Handler: adapter.getSubjectConditionSet}, + connect.Method{Spec: subjectMappingServiceCreateSubjectConditionSetSpec(), Handler: adapter.createSubjectConditionSet}, + connect.Method{Spec: subjectMappingServiceUpdateSubjectConditionSetSpec(), Handler: adapter.updateSubjectConditionSet}, + connect.Method{Spec: subjectMappingServiceDeleteSubjectConditionSetSpec(), Handler: adapter.deleteSubjectConditionSet}, + connect.Method{Spec: subjectMappingServiceDeleteAllUnmappedSubjectConditionSetsSpec(), Handler: adapter.deleteAllUnmappedSubjectConditionSets}, + ) +} + +// UnimplementedSubjectMappingServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedSubjectMappingServiceHandler struct{} + +func (UnimplementedSubjectMappingServiceHandler) MatchSubjectMappings(context.Context, *subjectmapping.MatchSubjectMappingsRequest) (*subjectmapping.MatchSubjectMappingsResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.subjectmapping.SubjectMappingService.MatchSubjectMappings is not implemented") +} + +func (UnimplementedSubjectMappingServiceHandler) ListSubjectMappings(context.Context, *subjectmapping.ListSubjectMappingsRequest) (*subjectmapping.ListSubjectMappingsResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.subjectmapping.SubjectMappingService.ListSubjectMappings is not implemented") +} + +func (UnimplementedSubjectMappingServiceHandler) GetSubjectMapping(context.Context, *subjectmapping.GetSubjectMappingRequest) (*subjectmapping.GetSubjectMappingResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.subjectmapping.SubjectMappingService.GetSubjectMapping is not implemented") +} + +func (UnimplementedSubjectMappingServiceHandler) CreateSubjectMapping(context.Context, *subjectmapping.CreateSubjectMappingRequest) (*subjectmapping.CreateSubjectMappingResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.subjectmapping.SubjectMappingService.CreateSubjectMapping is not implemented") +} + +func (UnimplementedSubjectMappingServiceHandler) UpdateSubjectMapping(context.Context, *subjectmapping.UpdateSubjectMappingRequest) (*subjectmapping.UpdateSubjectMappingResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.subjectmapping.SubjectMappingService.UpdateSubjectMapping is not implemented") +} + +func (UnimplementedSubjectMappingServiceHandler) DeleteSubjectMapping(context.Context, *subjectmapping.DeleteSubjectMappingRequest) (*subjectmapping.DeleteSubjectMappingResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.subjectmapping.SubjectMappingService.DeleteSubjectMapping is not implemented") +} + +func (UnimplementedSubjectMappingServiceHandler) ListSubjectConditionSets(context.Context, *subjectmapping.ListSubjectConditionSetsRequest) (*subjectmapping.ListSubjectConditionSetsResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.subjectmapping.SubjectMappingService.ListSubjectConditionSets is not implemented") +} + +func (UnimplementedSubjectMappingServiceHandler) GetSubjectConditionSet(context.Context, *subjectmapping.GetSubjectConditionSetRequest) (*subjectmapping.GetSubjectConditionSetResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.subjectmapping.SubjectMappingService.GetSubjectConditionSet is not implemented") +} + +func (UnimplementedSubjectMappingServiceHandler) CreateSubjectConditionSet(context.Context, *subjectmapping.CreateSubjectConditionSetRequest) (*subjectmapping.CreateSubjectConditionSetResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.subjectmapping.SubjectMappingService.CreateSubjectConditionSet is not implemented") +} + +func (UnimplementedSubjectMappingServiceHandler) UpdateSubjectConditionSet(context.Context, *subjectmapping.UpdateSubjectConditionSetRequest) (*subjectmapping.UpdateSubjectConditionSetResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.subjectmapping.SubjectMappingService.UpdateSubjectConditionSet is not implemented") +} + +func (UnimplementedSubjectMappingServiceHandler) DeleteSubjectConditionSet(context.Context, *subjectmapping.DeleteSubjectConditionSetRequest) (*subjectmapping.DeleteSubjectConditionSetResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.subjectmapping.SubjectMappingService.DeleteSubjectConditionSet is not implemented") +} + +func (UnimplementedSubjectMappingServiceHandler) DeleteAllUnmappedSubjectConditionSets(context.Context, *subjectmapping.DeleteAllUnmappedSubjectConditionSetsRequest) (*subjectmapping.DeleteAllUnmappedSubjectConditionSetsResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.subjectmapping.SubjectMappingService.DeleteAllUnmappedSubjectConditionSets is not implemented") +} + +type subjectMappingServiceClient struct { + client *connect.Client +} + +func (c *subjectMappingServiceClient) MatchSubjectMappings(ctx context.Context, req *subjectmapping.MatchSubjectMappingsRequest) (*subjectmapping.MatchSubjectMappingsResponse, error) { + var res subjectmapping.MatchSubjectMappingsResponse + if err := c.client.CallUnary(ctx, subjectMappingServiceMatchSubjectMappingsSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *subjectMappingServiceClient) ListSubjectMappings(ctx context.Context, req *subjectmapping.ListSubjectMappingsRequest) (*subjectmapping.ListSubjectMappingsResponse, error) { + var res subjectmapping.ListSubjectMappingsResponse + if err := c.client.CallUnary(ctx, subjectMappingServiceListSubjectMappingsSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *subjectMappingServiceClient) GetSubjectMapping(ctx context.Context, req *subjectmapping.GetSubjectMappingRequest) (*subjectmapping.GetSubjectMappingResponse, error) { + var res subjectmapping.GetSubjectMappingResponse + if err := c.client.CallUnary(ctx, subjectMappingServiceGetSubjectMappingSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *subjectMappingServiceClient) CreateSubjectMapping(ctx context.Context, req *subjectmapping.CreateSubjectMappingRequest) (*subjectmapping.CreateSubjectMappingResponse, error) { + var res subjectmapping.CreateSubjectMappingResponse + if err := c.client.CallUnary(ctx, subjectMappingServiceCreateSubjectMappingSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *subjectMappingServiceClient) UpdateSubjectMapping(ctx context.Context, req *subjectmapping.UpdateSubjectMappingRequest) (*subjectmapping.UpdateSubjectMappingResponse, error) { + var res subjectmapping.UpdateSubjectMappingResponse + if err := c.client.CallUnary(ctx, subjectMappingServiceUpdateSubjectMappingSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *subjectMappingServiceClient) DeleteSubjectMapping(ctx context.Context, req *subjectmapping.DeleteSubjectMappingRequest) (*subjectmapping.DeleteSubjectMappingResponse, error) { + var res subjectmapping.DeleteSubjectMappingResponse + if err := c.client.CallUnary(ctx, subjectMappingServiceDeleteSubjectMappingSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *subjectMappingServiceClient) ListSubjectConditionSets(ctx context.Context, req *subjectmapping.ListSubjectConditionSetsRequest) (*subjectmapping.ListSubjectConditionSetsResponse, error) { + var res subjectmapping.ListSubjectConditionSetsResponse + if err := c.client.CallUnary(ctx, subjectMappingServiceListSubjectConditionSetsSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *subjectMappingServiceClient) GetSubjectConditionSet(ctx context.Context, req *subjectmapping.GetSubjectConditionSetRequest) (*subjectmapping.GetSubjectConditionSetResponse, error) { + var res subjectmapping.GetSubjectConditionSetResponse + if err := c.client.CallUnary(ctx, subjectMappingServiceGetSubjectConditionSetSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *subjectMappingServiceClient) CreateSubjectConditionSet(ctx context.Context, req *subjectmapping.CreateSubjectConditionSetRequest) (*subjectmapping.CreateSubjectConditionSetResponse, error) { + var res subjectmapping.CreateSubjectConditionSetResponse + if err := c.client.CallUnary(ctx, subjectMappingServiceCreateSubjectConditionSetSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *subjectMappingServiceClient) UpdateSubjectConditionSet(ctx context.Context, req *subjectmapping.UpdateSubjectConditionSetRequest) (*subjectmapping.UpdateSubjectConditionSetResponse, error) { + var res subjectmapping.UpdateSubjectConditionSetResponse + if err := c.client.CallUnary(ctx, subjectMappingServiceUpdateSubjectConditionSetSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *subjectMappingServiceClient) DeleteSubjectConditionSet(ctx context.Context, req *subjectmapping.DeleteSubjectConditionSetRequest) (*subjectmapping.DeleteSubjectConditionSetResponse, error) { + var res subjectmapping.DeleteSubjectConditionSetResponse + if err := c.client.CallUnary(ctx, subjectMappingServiceDeleteSubjectConditionSetSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *subjectMappingServiceClient) DeleteAllUnmappedSubjectConditionSets(ctx context.Context, req *subjectmapping.DeleteAllUnmappedSubjectConditionSetsRequest) (*subjectmapping.DeleteAllUnmappedSubjectConditionSetsResponse, error) { + var res subjectmapping.DeleteAllUnmappedSubjectConditionSetsResponse + if err := c.client.CallUnary(ctx, subjectMappingServiceDeleteAllUnmappedSubjectConditionSetsSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +type subjectMappingServiceHandler struct{ svc SubjectMappingServiceHandler } + +func (h subjectMappingServiceHandler) matchSubjectMappings(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req subjectmapping.MatchSubjectMappingsRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.MatchSubjectMappings(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h subjectMappingServiceHandler) listSubjectMappings(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req subjectmapping.ListSubjectMappingsRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.ListSubjectMappings(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h subjectMappingServiceHandler) getSubjectMapping(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req subjectmapping.GetSubjectMappingRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.GetSubjectMapping(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h subjectMappingServiceHandler) createSubjectMapping(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req subjectmapping.CreateSubjectMappingRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.CreateSubjectMapping(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h subjectMappingServiceHandler) updateSubjectMapping(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req subjectmapping.UpdateSubjectMappingRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.UpdateSubjectMapping(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h subjectMappingServiceHandler) deleteSubjectMapping(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req subjectmapping.DeleteSubjectMappingRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.DeleteSubjectMapping(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h subjectMappingServiceHandler) listSubjectConditionSets(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req subjectmapping.ListSubjectConditionSetsRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.ListSubjectConditionSets(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h subjectMappingServiceHandler) getSubjectConditionSet(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req subjectmapping.GetSubjectConditionSetRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.GetSubjectConditionSet(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h subjectMappingServiceHandler) createSubjectConditionSet(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req subjectmapping.CreateSubjectConditionSetRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.CreateSubjectConditionSet(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h subjectMappingServiceHandler) updateSubjectConditionSet(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req subjectmapping.UpdateSubjectConditionSetRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.UpdateSubjectConditionSet(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h subjectMappingServiceHandler) deleteSubjectConditionSet(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req subjectmapping.DeleteSubjectConditionSetRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.DeleteSubjectConditionSet(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h subjectMappingServiceHandler) deleteAllUnmappedSubjectConditionSets(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req subjectmapping.DeleteAllUnmappedSubjectConditionSetsRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.DeleteAllUnmappedSubjectConditionSets(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} diff --git a/protocol/go/policy/unsafe/unsafeconnectv2/unsafe.connect.go b/protocol/go/policy/unsafe/unsafeconnectv2/unsafe.connect.go new file mode 100644 index 0000000000..195e9bef7b --- /dev/null +++ b/protocol/go/policy/unsafe/unsafeconnectv2/unsafe.connect.go @@ -0,0 +1,492 @@ +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: policy/unsafe/unsafe.proto + +package unsafeconnectv2 + +import ( + connect "connectrpc.com/connect/v2" + context "context" + unsafe "github.com/opentdf/platform/protocol/go/policy/unsafe" + sync "sync" +) + +const ( + // UnsafeServiceName is the fully-qualified name of the UnsafeService service. + UnsafeServiceName = "policy.unsafe.UnsafeService" +) + +// These constants are the procedure names of the RPCs defined in this package. They're exposed at +// runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // UnsafeServiceUnsafeUpdateNamespaceProcedure is the procedure name of the UnsafeService's + // UnsafeUpdateNamespace RPC. + UnsafeServiceUnsafeUpdateNamespaceProcedure = "/policy.unsafe.UnsafeService/UnsafeUpdateNamespace" + // UnsafeServiceUnsafeReactivateNamespaceProcedure is the procedure name of the UnsafeService's + // UnsafeReactivateNamespace RPC. + UnsafeServiceUnsafeReactivateNamespaceProcedure = "/policy.unsafe.UnsafeService/UnsafeReactivateNamespace" + // UnsafeServiceUnsafeDeleteNamespaceProcedure is the procedure name of the UnsafeService's + // UnsafeDeleteNamespace RPC. + UnsafeServiceUnsafeDeleteNamespaceProcedure = "/policy.unsafe.UnsafeService/UnsafeDeleteNamespace" + // UnsafeServiceUnsafeUpdateAttributeProcedure is the procedure name of the UnsafeService's + // UnsafeUpdateAttribute RPC. + UnsafeServiceUnsafeUpdateAttributeProcedure = "/policy.unsafe.UnsafeService/UnsafeUpdateAttribute" + // UnsafeServiceUnsafeReactivateAttributeProcedure is the procedure name of the UnsafeService's + // UnsafeReactivateAttribute RPC. + UnsafeServiceUnsafeReactivateAttributeProcedure = "/policy.unsafe.UnsafeService/UnsafeReactivateAttribute" + // UnsafeServiceUnsafeDeleteAttributeProcedure is the procedure name of the UnsafeService's + // UnsafeDeleteAttribute RPC. + UnsafeServiceUnsafeDeleteAttributeProcedure = "/policy.unsafe.UnsafeService/UnsafeDeleteAttribute" + // UnsafeServiceUnsafeUpdateAttributeValueProcedure is the procedure name of the UnsafeService's + // UnsafeUpdateAttributeValue RPC. + UnsafeServiceUnsafeUpdateAttributeValueProcedure = "/policy.unsafe.UnsafeService/UnsafeUpdateAttributeValue" + // UnsafeServiceUnsafeReactivateAttributeValueProcedure is the procedure name of the UnsafeService's + // UnsafeReactivateAttributeValue RPC. + UnsafeServiceUnsafeReactivateAttributeValueProcedure = "/policy.unsafe.UnsafeService/UnsafeReactivateAttributeValue" + // UnsafeServiceUnsafeDeleteAttributeValueProcedure is the procedure name of the UnsafeService's + // UnsafeDeleteAttributeValue RPC. + UnsafeServiceUnsafeDeleteAttributeValueProcedure = "/policy.unsafe.UnsafeService/UnsafeDeleteAttributeValue" + // UnsafeServiceUnsafeUpdateKeyProcedure is the procedure name of the UnsafeService's + // UnsafeUpdateKey RPC. + UnsafeServiceUnsafeUpdateKeyProcedure = "/policy.unsafe.UnsafeService/UnsafeUpdateKey" + // UnsafeServiceUnsafeDeleteKasKeyProcedure is the procedure name of the UnsafeService's + // UnsafeDeleteKasKey RPC. + UnsafeServiceUnsafeDeleteKasKeyProcedure = "/policy.unsafe.UnsafeService/UnsafeDeleteKasKey" +) + +var ( + unsafeServiceUnsafeUpdateNamespaceSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: unsafe.File_policy_unsafe_unsafe_proto.Services().ByName("UnsafeService").Methods().ByName("UnsafeUpdateNamespace"), + Procedure: UnsafeServiceUnsafeUpdateNamespaceProcedure, + } + }) + unsafeServiceUnsafeReactivateNamespaceSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: unsafe.File_policy_unsafe_unsafe_proto.Services().ByName("UnsafeService").Methods().ByName("UnsafeReactivateNamespace"), + Procedure: UnsafeServiceUnsafeReactivateNamespaceProcedure, + } + }) + unsafeServiceUnsafeDeleteNamespaceSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: unsafe.File_policy_unsafe_unsafe_proto.Services().ByName("UnsafeService").Methods().ByName("UnsafeDeleteNamespace"), + Procedure: UnsafeServiceUnsafeDeleteNamespaceProcedure, + } + }) + unsafeServiceUnsafeUpdateAttributeSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: unsafe.File_policy_unsafe_unsafe_proto.Services().ByName("UnsafeService").Methods().ByName("UnsafeUpdateAttribute"), + Procedure: UnsafeServiceUnsafeUpdateAttributeProcedure, + } + }) + unsafeServiceUnsafeReactivateAttributeSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: unsafe.File_policy_unsafe_unsafe_proto.Services().ByName("UnsafeService").Methods().ByName("UnsafeReactivateAttribute"), + Procedure: UnsafeServiceUnsafeReactivateAttributeProcedure, + } + }) + unsafeServiceUnsafeDeleteAttributeSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: unsafe.File_policy_unsafe_unsafe_proto.Services().ByName("UnsafeService").Methods().ByName("UnsafeDeleteAttribute"), + Procedure: UnsafeServiceUnsafeDeleteAttributeProcedure, + } + }) + unsafeServiceUnsafeUpdateAttributeValueSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: unsafe.File_policy_unsafe_unsafe_proto.Services().ByName("UnsafeService").Methods().ByName("UnsafeUpdateAttributeValue"), + Procedure: UnsafeServiceUnsafeUpdateAttributeValueProcedure, + } + }) + unsafeServiceUnsafeReactivateAttributeValueSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: unsafe.File_policy_unsafe_unsafe_proto.Services().ByName("UnsafeService").Methods().ByName("UnsafeReactivateAttributeValue"), + Procedure: UnsafeServiceUnsafeReactivateAttributeValueProcedure, + } + }) + unsafeServiceUnsafeDeleteAttributeValueSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: unsafe.File_policy_unsafe_unsafe_proto.Services().ByName("UnsafeService").Methods().ByName("UnsafeDeleteAttributeValue"), + Procedure: UnsafeServiceUnsafeDeleteAttributeValueProcedure, + } + }) + unsafeServiceUnsafeUpdateKeySpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: unsafe.File_policy_unsafe_unsafe_proto.Services().ByName("UnsafeService").Methods().ByName("UnsafeUpdateKey"), + Procedure: UnsafeServiceUnsafeUpdateKeyProcedure, + } + }) + unsafeServiceUnsafeDeleteKasKeySpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: unsafe.File_policy_unsafe_unsafe_proto.Services().ByName("UnsafeService").Methods().ByName("UnsafeDeleteKasKey"), + Procedure: UnsafeServiceUnsafeDeleteKasKeyProcedure, + } + }) +) + +// UnsafeServiceClient is a client for the policy.unsafe.UnsafeService service. +type UnsafeServiceClient interface { + //--------------------------------------* + // Namespace RPCs + //--------------------------------------- + UnsafeUpdateNamespace(context.Context, *unsafe.UnsafeUpdateNamespaceRequest) (*unsafe.UnsafeUpdateNamespaceResponse, error) + UnsafeReactivateNamespace(context.Context, *unsafe.UnsafeReactivateNamespaceRequest) (*unsafe.UnsafeReactivateNamespaceResponse, error) + UnsafeDeleteNamespace(context.Context, *unsafe.UnsafeDeleteNamespaceRequest) (*unsafe.UnsafeDeleteNamespaceResponse, error) + //--------------------------------------* + // Attribute RPCs + //--------------------------------------- + UnsafeUpdateAttribute(context.Context, *unsafe.UnsafeUpdateAttributeRequest) (*unsafe.UnsafeUpdateAttributeResponse, error) + UnsafeReactivateAttribute(context.Context, *unsafe.UnsafeReactivateAttributeRequest) (*unsafe.UnsafeReactivateAttributeResponse, error) + UnsafeDeleteAttribute(context.Context, *unsafe.UnsafeDeleteAttributeRequest) (*unsafe.UnsafeDeleteAttributeResponse, error) + //--------------------------------------* + // Value RPCs + //--------------------------------------- + UnsafeUpdateAttributeValue(context.Context, *unsafe.UnsafeUpdateAttributeValueRequest) (*unsafe.UnsafeUpdateAttributeValueResponse, error) + UnsafeReactivateAttributeValue(context.Context, *unsafe.UnsafeReactivateAttributeValueRequest) (*unsafe.UnsafeReactivateAttributeValueResponse, error) + UnsafeDeleteAttributeValue(context.Context, *unsafe.UnsafeDeleteAttributeValueRequest) (*unsafe.UnsafeDeleteAttributeValueResponse, error) + //--------------------------------------* + // Kas Key RPCs + //--------------------------------------- + UnsafeUpdateKey(context.Context, *unsafe.UnsafeUpdateKeyRequest) (*unsafe.UnsafeUpdateKeyResponse, error) + UnsafeDeleteKasKey(context.Context, *unsafe.UnsafeDeleteKasKeyRequest) (*unsafe.UnsafeDeleteKasKeyResponse, error) +} + +// NewUnsafeServiceClient constructs a client for the policy.unsafe.UnsafeService service. Multiple +// service clients may share a single connect.Client. +func NewUnsafeServiceClient(client *connect.Client) UnsafeServiceClient { + return &unsafeServiceClient{client: client} +} + +// UnsafeServiceHandler is an implementation of the policy.unsafe.UnsafeService service. +type UnsafeServiceHandler interface { + //--------------------------------------* + // Namespace RPCs + //--------------------------------------- + UnsafeUpdateNamespace(context.Context, *unsafe.UnsafeUpdateNamespaceRequest) (*unsafe.UnsafeUpdateNamespaceResponse, error) + UnsafeReactivateNamespace(context.Context, *unsafe.UnsafeReactivateNamespaceRequest) (*unsafe.UnsafeReactivateNamespaceResponse, error) + UnsafeDeleteNamespace(context.Context, *unsafe.UnsafeDeleteNamespaceRequest) (*unsafe.UnsafeDeleteNamespaceResponse, error) + //--------------------------------------* + // Attribute RPCs + //--------------------------------------- + UnsafeUpdateAttribute(context.Context, *unsafe.UnsafeUpdateAttributeRequest) (*unsafe.UnsafeUpdateAttributeResponse, error) + UnsafeReactivateAttribute(context.Context, *unsafe.UnsafeReactivateAttributeRequest) (*unsafe.UnsafeReactivateAttributeResponse, error) + UnsafeDeleteAttribute(context.Context, *unsafe.UnsafeDeleteAttributeRequest) (*unsafe.UnsafeDeleteAttributeResponse, error) + //--------------------------------------* + // Value RPCs + //--------------------------------------- + UnsafeUpdateAttributeValue(context.Context, *unsafe.UnsafeUpdateAttributeValueRequest) (*unsafe.UnsafeUpdateAttributeValueResponse, error) + UnsafeReactivateAttributeValue(context.Context, *unsafe.UnsafeReactivateAttributeValueRequest) (*unsafe.UnsafeReactivateAttributeValueResponse, error) + UnsafeDeleteAttributeValue(context.Context, *unsafe.UnsafeDeleteAttributeValueRequest) (*unsafe.UnsafeDeleteAttributeValueResponse, error) + //--------------------------------------* + // Kas Key RPCs + //--------------------------------------- + UnsafeUpdateKey(context.Context, *unsafe.UnsafeUpdateKeyRequest) (*unsafe.UnsafeUpdateKeyResponse, error) + UnsafeDeleteKasKey(context.Context, *unsafe.UnsafeDeleteKasKeyRequest) (*unsafe.UnsafeDeleteKasKeyResponse, error) +} + +// RegisterUnsafeServiceHandler registers svc as the policy.unsafe.UnsafeService implementation on +// server. +func RegisterUnsafeServiceHandler(server *connect.Server, svc UnsafeServiceHandler) { + adapter := unsafeServiceHandler{svc: svc} + server.Register( + connect.Method{Spec: unsafeServiceUnsafeUpdateNamespaceSpec(), Handler: adapter.unsafeUpdateNamespace}, + connect.Method{Spec: unsafeServiceUnsafeReactivateNamespaceSpec(), Handler: adapter.unsafeReactivateNamespace}, + connect.Method{Spec: unsafeServiceUnsafeDeleteNamespaceSpec(), Handler: adapter.unsafeDeleteNamespace}, + connect.Method{Spec: unsafeServiceUnsafeUpdateAttributeSpec(), Handler: adapter.unsafeUpdateAttribute}, + connect.Method{Spec: unsafeServiceUnsafeReactivateAttributeSpec(), Handler: adapter.unsafeReactivateAttribute}, + connect.Method{Spec: unsafeServiceUnsafeDeleteAttributeSpec(), Handler: adapter.unsafeDeleteAttribute}, + connect.Method{Spec: unsafeServiceUnsafeUpdateAttributeValueSpec(), Handler: adapter.unsafeUpdateAttributeValue}, + connect.Method{Spec: unsafeServiceUnsafeReactivateAttributeValueSpec(), Handler: adapter.unsafeReactivateAttributeValue}, + connect.Method{Spec: unsafeServiceUnsafeDeleteAttributeValueSpec(), Handler: adapter.unsafeDeleteAttributeValue}, + connect.Method{Spec: unsafeServiceUnsafeUpdateKeySpec(), Handler: adapter.unsafeUpdateKey}, + connect.Method{Spec: unsafeServiceUnsafeDeleteKasKeySpec(), Handler: adapter.unsafeDeleteKasKey}, + ) +} + +// UnimplementedUnsafeServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedUnsafeServiceHandler struct{} + +func (UnimplementedUnsafeServiceHandler) UnsafeUpdateNamespace(context.Context, *unsafe.UnsafeUpdateNamespaceRequest) (*unsafe.UnsafeUpdateNamespaceResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.unsafe.UnsafeService.UnsafeUpdateNamespace is not implemented") +} + +func (UnimplementedUnsafeServiceHandler) UnsafeReactivateNamespace(context.Context, *unsafe.UnsafeReactivateNamespaceRequest) (*unsafe.UnsafeReactivateNamespaceResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.unsafe.UnsafeService.UnsafeReactivateNamespace is not implemented") +} + +func (UnimplementedUnsafeServiceHandler) UnsafeDeleteNamespace(context.Context, *unsafe.UnsafeDeleteNamespaceRequest) (*unsafe.UnsafeDeleteNamespaceResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.unsafe.UnsafeService.UnsafeDeleteNamespace is not implemented") +} + +func (UnimplementedUnsafeServiceHandler) UnsafeUpdateAttribute(context.Context, *unsafe.UnsafeUpdateAttributeRequest) (*unsafe.UnsafeUpdateAttributeResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.unsafe.UnsafeService.UnsafeUpdateAttribute is not implemented") +} + +func (UnimplementedUnsafeServiceHandler) UnsafeReactivateAttribute(context.Context, *unsafe.UnsafeReactivateAttributeRequest) (*unsafe.UnsafeReactivateAttributeResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.unsafe.UnsafeService.UnsafeReactivateAttribute is not implemented") +} + +func (UnimplementedUnsafeServiceHandler) UnsafeDeleteAttribute(context.Context, *unsafe.UnsafeDeleteAttributeRequest) (*unsafe.UnsafeDeleteAttributeResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.unsafe.UnsafeService.UnsafeDeleteAttribute is not implemented") +} + +func (UnimplementedUnsafeServiceHandler) UnsafeUpdateAttributeValue(context.Context, *unsafe.UnsafeUpdateAttributeValueRequest) (*unsafe.UnsafeUpdateAttributeValueResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.unsafe.UnsafeService.UnsafeUpdateAttributeValue is not implemented") +} + +func (UnimplementedUnsafeServiceHandler) UnsafeReactivateAttributeValue(context.Context, *unsafe.UnsafeReactivateAttributeValueRequest) (*unsafe.UnsafeReactivateAttributeValueResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.unsafe.UnsafeService.UnsafeReactivateAttributeValue is not implemented") +} + +func (UnimplementedUnsafeServiceHandler) UnsafeDeleteAttributeValue(context.Context, *unsafe.UnsafeDeleteAttributeValueRequest) (*unsafe.UnsafeDeleteAttributeValueResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.unsafe.UnsafeService.UnsafeDeleteAttributeValue is not implemented") +} + +func (UnimplementedUnsafeServiceHandler) UnsafeUpdateKey(context.Context, *unsafe.UnsafeUpdateKeyRequest) (*unsafe.UnsafeUpdateKeyResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.unsafe.UnsafeService.UnsafeUpdateKey is not implemented") +} + +func (UnimplementedUnsafeServiceHandler) UnsafeDeleteKasKey(context.Context, *unsafe.UnsafeDeleteKasKeyRequest) (*unsafe.UnsafeDeleteKasKeyResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "policy.unsafe.UnsafeService.UnsafeDeleteKasKey is not implemented") +} + +type unsafeServiceClient struct { + client *connect.Client +} + +func (c *unsafeServiceClient) UnsafeUpdateNamespace(ctx context.Context, req *unsafe.UnsafeUpdateNamespaceRequest) (*unsafe.UnsafeUpdateNamespaceResponse, error) { + var res unsafe.UnsafeUpdateNamespaceResponse + if err := c.client.CallUnary(ctx, unsafeServiceUnsafeUpdateNamespaceSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *unsafeServiceClient) UnsafeReactivateNamespace(ctx context.Context, req *unsafe.UnsafeReactivateNamespaceRequest) (*unsafe.UnsafeReactivateNamespaceResponse, error) { + var res unsafe.UnsafeReactivateNamespaceResponse + if err := c.client.CallUnary(ctx, unsafeServiceUnsafeReactivateNamespaceSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *unsafeServiceClient) UnsafeDeleteNamespace(ctx context.Context, req *unsafe.UnsafeDeleteNamespaceRequest) (*unsafe.UnsafeDeleteNamespaceResponse, error) { + var res unsafe.UnsafeDeleteNamespaceResponse + if err := c.client.CallUnary(ctx, unsafeServiceUnsafeDeleteNamespaceSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *unsafeServiceClient) UnsafeUpdateAttribute(ctx context.Context, req *unsafe.UnsafeUpdateAttributeRequest) (*unsafe.UnsafeUpdateAttributeResponse, error) { + var res unsafe.UnsafeUpdateAttributeResponse + if err := c.client.CallUnary(ctx, unsafeServiceUnsafeUpdateAttributeSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *unsafeServiceClient) UnsafeReactivateAttribute(ctx context.Context, req *unsafe.UnsafeReactivateAttributeRequest) (*unsafe.UnsafeReactivateAttributeResponse, error) { + var res unsafe.UnsafeReactivateAttributeResponse + if err := c.client.CallUnary(ctx, unsafeServiceUnsafeReactivateAttributeSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *unsafeServiceClient) UnsafeDeleteAttribute(ctx context.Context, req *unsafe.UnsafeDeleteAttributeRequest) (*unsafe.UnsafeDeleteAttributeResponse, error) { + var res unsafe.UnsafeDeleteAttributeResponse + if err := c.client.CallUnary(ctx, unsafeServiceUnsafeDeleteAttributeSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *unsafeServiceClient) UnsafeUpdateAttributeValue(ctx context.Context, req *unsafe.UnsafeUpdateAttributeValueRequest) (*unsafe.UnsafeUpdateAttributeValueResponse, error) { + var res unsafe.UnsafeUpdateAttributeValueResponse + if err := c.client.CallUnary(ctx, unsafeServiceUnsafeUpdateAttributeValueSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *unsafeServiceClient) UnsafeReactivateAttributeValue(ctx context.Context, req *unsafe.UnsafeReactivateAttributeValueRequest) (*unsafe.UnsafeReactivateAttributeValueResponse, error) { + var res unsafe.UnsafeReactivateAttributeValueResponse + if err := c.client.CallUnary(ctx, unsafeServiceUnsafeReactivateAttributeValueSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *unsafeServiceClient) UnsafeDeleteAttributeValue(ctx context.Context, req *unsafe.UnsafeDeleteAttributeValueRequest) (*unsafe.UnsafeDeleteAttributeValueResponse, error) { + var res unsafe.UnsafeDeleteAttributeValueResponse + if err := c.client.CallUnary(ctx, unsafeServiceUnsafeDeleteAttributeValueSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *unsafeServiceClient) UnsafeUpdateKey(ctx context.Context, req *unsafe.UnsafeUpdateKeyRequest) (*unsafe.UnsafeUpdateKeyResponse, error) { + var res unsafe.UnsafeUpdateKeyResponse + if err := c.client.CallUnary(ctx, unsafeServiceUnsafeUpdateKeySpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +func (c *unsafeServiceClient) UnsafeDeleteKasKey(ctx context.Context, req *unsafe.UnsafeDeleteKasKeyRequest) (*unsafe.UnsafeDeleteKasKeyResponse, error) { + var res unsafe.UnsafeDeleteKasKeyResponse + if err := c.client.CallUnary(ctx, unsafeServiceUnsafeDeleteKasKeySpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +type unsafeServiceHandler struct{ svc UnsafeServiceHandler } + +func (h unsafeServiceHandler) unsafeUpdateNamespace(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req unsafe.UnsafeUpdateNamespaceRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.UnsafeUpdateNamespace(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h unsafeServiceHandler) unsafeReactivateNamespace(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req unsafe.UnsafeReactivateNamespaceRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.UnsafeReactivateNamespace(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h unsafeServiceHandler) unsafeDeleteNamespace(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req unsafe.UnsafeDeleteNamespaceRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.UnsafeDeleteNamespace(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h unsafeServiceHandler) unsafeUpdateAttribute(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req unsafe.UnsafeUpdateAttributeRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.UnsafeUpdateAttribute(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h unsafeServiceHandler) unsafeReactivateAttribute(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req unsafe.UnsafeReactivateAttributeRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.UnsafeReactivateAttribute(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h unsafeServiceHandler) unsafeDeleteAttribute(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req unsafe.UnsafeDeleteAttributeRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.UnsafeDeleteAttribute(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h unsafeServiceHandler) unsafeUpdateAttributeValue(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req unsafe.UnsafeUpdateAttributeValueRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.UnsafeUpdateAttributeValue(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h unsafeServiceHandler) unsafeReactivateAttributeValue(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req unsafe.UnsafeReactivateAttributeValueRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.UnsafeReactivateAttributeValue(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h unsafeServiceHandler) unsafeDeleteAttributeValue(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req unsafe.UnsafeDeleteAttributeValueRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.UnsafeDeleteAttributeValue(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h unsafeServiceHandler) unsafeUpdateKey(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req unsafe.UnsafeUpdateKeyRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.UnsafeUpdateKey(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} + +func (h unsafeServiceHandler) unsafeDeleteKasKey(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req unsafe.UnsafeDeleteKasKeyRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.UnsafeDeleteKasKey(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} diff --git a/protocol/go/wellknownconfiguration/wellknownconfigurationconnectv2/wellknown_configuration.connect.go b/protocol/go/wellknownconfiguration/wellknownconfigurationconnectv2/wellknown_configuration.connect.go new file mode 100644 index 0000000000..a1c416fef2 --- /dev/null +++ b/protocol/go/wellknownconfiguration/wellknownconfigurationconnectv2/wellknown_configuration.connect.go @@ -0,0 +1,100 @@ +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: wellknownconfiguration/wellknown_configuration.proto + +package wellknownconfigurationconnectv2 + +import ( + connect "connectrpc.com/connect/v2" + context "context" + wellknownconfiguration "github.com/opentdf/platform/protocol/go/wellknownconfiguration" + sync "sync" +) + +const ( + // WellKnownServiceName is the fully-qualified name of the WellKnownService service. + WellKnownServiceName = "wellknownconfiguration.WellKnownService" +) + +// These constants are the procedure names of the RPCs defined in this package. They're exposed at +// runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // WellKnownServiceGetWellKnownConfigurationProcedure is the procedure name of the + // WellKnownService's GetWellKnownConfiguration RPC. + WellKnownServiceGetWellKnownConfigurationProcedure = "/wellknownconfiguration.WellKnownService/GetWellKnownConfiguration" +) + +var ( + wellKnownServiceGetWellKnownConfigurationSpec = sync.OnceValue(func() connect.Spec { + return connect.Spec{ + StreamType: connect.StreamTypeUnary, + Schema: wellknownconfiguration.File_wellknownconfiguration_wellknown_configuration_proto.Services().ByName("WellKnownService").Methods().ByName("GetWellKnownConfiguration"), + Procedure: WellKnownServiceGetWellKnownConfigurationProcedure, + IdempotencyLevel: connect.IdempotencyNoSideEffects, + } + }) +) + +// WellKnownServiceClient is a client for the wellknownconfiguration.WellKnownService service. +type WellKnownServiceClient interface { + GetWellKnownConfiguration(context.Context, *wellknownconfiguration.GetWellKnownConfigurationRequest) (*wellknownconfiguration.GetWellKnownConfigurationResponse, error) +} + +// NewWellKnownServiceClient constructs a client for the wellknownconfiguration.WellKnownService +// service. Multiple service clients may share a single connect.Client. +func NewWellKnownServiceClient(client *connect.Client) WellKnownServiceClient { + return &wellKnownServiceClient{client: client} +} + +// WellKnownServiceHandler is an implementation of the wellknownconfiguration.WellKnownService +// service. +type WellKnownServiceHandler interface { + GetWellKnownConfiguration(context.Context, *wellknownconfiguration.GetWellKnownConfigurationRequest) (*wellknownconfiguration.GetWellKnownConfigurationResponse, error) +} + +// RegisterWellKnownServiceHandler registers svc as the wellknownconfiguration.WellKnownService +// implementation on server. +func RegisterWellKnownServiceHandler(server *connect.Server, svc WellKnownServiceHandler) { + adapter := wellKnownServiceHandler{svc: svc} + server.Register( + connect.Method{Spec: wellKnownServiceGetWellKnownConfigurationSpec(), Handler: adapter.getWellKnownConfiguration}, + ) +} + +// UnimplementedWellKnownServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedWellKnownServiceHandler struct{} + +func (UnimplementedWellKnownServiceHandler) GetWellKnownConfiguration(context.Context, *wellknownconfiguration.GetWellKnownConfigurationRequest) (*wellknownconfiguration.GetWellKnownConfigurationResponse, error) { + return nil, connect.NewError(connect.CodeUnimplemented, "wellknownconfiguration.WellKnownService.GetWellKnownConfiguration is not implemented") +} + +type wellKnownServiceClient struct { + client *connect.Client +} + +func (c *wellKnownServiceClient) GetWellKnownConfiguration(ctx context.Context, req *wellknownconfiguration.GetWellKnownConfigurationRequest) (*wellknownconfiguration.GetWellKnownConfigurationResponse, error) { + var res wellknownconfiguration.GetWellKnownConfigurationResponse + if err := c.client.CallUnary(ctx, wellKnownServiceGetWellKnownConfigurationSpec(), req, &res); err != nil { + return nil, err + } + return &res, nil +} + +type wellKnownServiceHandler struct{ svc WellKnownServiceHandler } + +func (h wellKnownServiceHandler) getWellKnownConfiguration(ctx context.Context, _ connect.Spec, stream connect.ServerStream) error { + var req wellknownconfiguration.GetWellKnownConfigurationRequest + if err := stream.Receive(&req); err != nil { + return err + } + res, err := h.svc.GetWellKnownConfiguration(ctx, &req) + if err != nil { + return err + } + return stream.Send(res) +} diff --git a/sdk/go.mod b/sdk/go.mod index de60c3965d..b451b017df 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -1,6 +1,6 @@ module github.com/opentdf/platform/sdk -go 1.25.0 +go 1.26.0 require ( connectrpc.com/connect v1.20.0 diff --git a/service/go.mod b/service/go.mod index ff97035b02..d2fa4d06d1 100644 --- a/service/go.mod +++ b/service/go.mod @@ -1,6 +1,6 @@ module github.com/opentdf/platform/service -go 1.25.0 +go 1.26.0 require ( buf.build/go/protovalidate v1.0.0 diff --git a/test/integration/go.mod b/test/integration/go.mod index 54ba63fb1d..3dcad60e1b 100644 --- a/test/integration/go.mod +++ b/test/integration/go.mod @@ -1,6 +1,6 @@ module github.com/opentdf/platform/test/integration -go 1.25.0 +go 1.26.0 replace ( github.com/opentdf/platform/lib/fixtures => ../../lib/fixtures diff --git a/tests-bdd/README.md b/tests-bdd/README.md index 963102c620..ba7fdc559c 100644 --- a/tests-bdd/README.md +++ b/tests-bdd/README.md @@ -336,7 +336,7 @@ The multi-strategy ERS config uses two providers: **Prerequisites:** - Docker (via Colima or Docker Desktop) -- Go 1.25+ +- Go 1.26+ - JDK (`keytool` required for Keycloak truststore generation) ```bash diff --git a/tests-bdd/go.mod b/tests-bdd/go.mod index 0cc00a878c..deddf49bdf 100644 --- a/tests-bdd/go.mod +++ b/tests-bdd/go.mod @@ -1,6 +1,6 @@ module github.com/opentdf/platform/tests-bdd -go 1.25.5 +go 1.26.0 require ( connectrpc.com/connect v1.20.0