* internal/gen: better API docs Add various pieces of metadata that can be used by the API docs renderer. Improve the service labels by specifying explicit tags. Specify error responses. Specify version at generation time. * internal/gen: add better errors The default error entry is now used to cover all errors, as adding a new error for every possible status code was a bit much. This also properly includes the real error type now! * Add various pieces of metadata that can be used by the API docs renderer. Improve the service labels by specifying explicit tags. * make auth method API docs * make API docs better * make auth methods API docs nicer * internal/gen: better attribute examples Replace Output Only comments with a field behavior annotation in accounts. Mark some fields as required. Add elaborate description for attributes. * Make API docs better * Make API docs better * Make API docs better * internal/proto: regenerate files * internal/proto: finish off account service * Make API docs better * internal/proto: add better API docs for aliases * Tidy up service descriptions * Added description for Boundary controller API doc * internal/gen: add better API intro Copy parts of the API docs into the description * sdk: add openapi dependency * internal/gen: move global API doc to separate file * internal/gen: remove required annotations Unfortunately, while these help with the creating of resources, they still appear required in contexts where they are not, such as when updating a resource. * Review comments --------- Co-authored-by: jigar-hashicorp <jigar.shah@hashicorp.com> Co-authored-by: Isaac Christian (he/him) <112639904+isaacchristian@users.noreply.github.com>
297 lines
13 KiB
Go
297 lines
13 KiB
Go
// Copyright (c) HashiCorp, Inc.
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
|
// versions:
|
|
// - protoc-gen-go-grpc v1.3.0
|
|
// - protoc (unknown)
|
|
// source: controller/api/services/v1/policy_service.proto
|
|
|
|
package services
|
|
|
|
import (
|
|
context "context"
|
|
grpc "google.golang.org/grpc"
|
|
codes "google.golang.org/grpc/codes"
|
|
status "google.golang.org/grpc/status"
|
|
)
|
|
|
|
// This is a compile-time assertion to ensure that this generated file
|
|
// is compatible with the grpc package it is being compiled against.
|
|
// Requires gRPC-Go v1.32.0 or later.
|
|
const _ = grpc.SupportPackageIsVersion7
|
|
|
|
const (
|
|
PolicyService_GetPolicy_FullMethodName = "/controller.api.services.v1.PolicyService/GetPolicy"
|
|
PolicyService_ListPolicies_FullMethodName = "/controller.api.services.v1.PolicyService/ListPolicies"
|
|
PolicyService_CreatePolicy_FullMethodName = "/controller.api.services.v1.PolicyService/CreatePolicy"
|
|
PolicyService_UpdatePolicy_FullMethodName = "/controller.api.services.v1.PolicyService/UpdatePolicy"
|
|
PolicyService_DeletePolicy_FullMethodName = "/controller.api.services.v1.PolicyService/DeletePolicy"
|
|
)
|
|
|
|
// PolicyServiceClient is the client API for PolicyService service.
|
|
//
|
|
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
|
type PolicyServiceClient interface {
|
|
// GetPolicy returns a policy with the given id, if it exists. The request
|
|
// must include a policy id. An error is returned if the ID is missing,
|
|
// malformed, or if a policy with the provided ID doesn't exist.
|
|
GetPolicy(ctx context.Context, in *GetPolicyRequest, opts ...grpc.CallOption) (*GetPolicyResponse, error)
|
|
// ListPolicies returns a list of stored policies in Boundary which exist
|
|
// inside the scope referenced in the request. The request must include the
|
|
// scope ID for the policies being retrieved. An error is returned if the
|
|
// scope ID is missing, malformed, or references a non existing scope.
|
|
ListPolicies(ctx context.Context, in *ListPoliciesRequest, opts ...grpc.CallOption) (*ListPoliciesResponse, error)
|
|
// CreatePolicy creates and stores a new policy in Boundary. The provided
|
|
// request must include the scope ID in which the policy will be created. An
|
|
// error is returned if the scope ID is missing, malformed or references a non
|
|
// existing scope.
|
|
CreatePolicy(ctx context.Context, in *CreatePolicyRequest, opts ...grpc.CallOption) (*CreatePolicyResponse, error)
|
|
// UpdatePolicy updates an existing policy in Boundary. The provided policy
|
|
// must not have any read-only fields set. The update mask must be included in
|
|
// the request and contain at least one mutable field. To unset a field's
|
|
// value (if unsettable), include it in the update mask and don't set it in
|
|
// the policy object.
|
|
UpdatePolicy(ctx context.Context, in *UpdatePolicyRequest, opts ...grpc.CallOption) (*UpdatePolicyResponse, error)
|
|
// DeletePolicy deletes a policy from Boundary. An error is returned if the
|
|
// policy ID is malformed or not provided.
|
|
DeletePolicy(ctx context.Context, in *DeletePolicyRequest, opts ...grpc.CallOption) (*DeletePolicyResponse, error)
|
|
}
|
|
|
|
type policyServiceClient struct {
|
|
cc grpc.ClientConnInterface
|
|
}
|
|
|
|
func NewPolicyServiceClient(cc grpc.ClientConnInterface) PolicyServiceClient {
|
|
return &policyServiceClient{cc}
|
|
}
|
|
|
|
func (c *policyServiceClient) GetPolicy(ctx context.Context, in *GetPolicyRequest, opts ...grpc.CallOption) (*GetPolicyResponse, error) {
|
|
out := new(GetPolicyResponse)
|
|
err := c.cc.Invoke(ctx, PolicyService_GetPolicy_FullMethodName, in, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *policyServiceClient) ListPolicies(ctx context.Context, in *ListPoliciesRequest, opts ...grpc.CallOption) (*ListPoliciesResponse, error) {
|
|
out := new(ListPoliciesResponse)
|
|
err := c.cc.Invoke(ctx, PolicyService_ListPolicies_FullMethodName, in, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *policyServiceClient) CreatePolicy(ctx context.Context, in *CreatePolicyRequest, opts ...grpc.CallOption) (*CreatePolicyResponse, error) {
|
|
out := new(CreatePolicyResponse)
|
|
err := c.cc.Invoke(ctx, PolicyService_CreatePolicy_FullMethodName, in, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *policyServiceClient) UpdatePolicy(ctx context.Context, in *UpdatePolicyRequest, opts ...grpc.CallOption) (*UpdatePolicyResponse, error) {
|
|
out := new(UpdatePolicyResponse)
|
|
err := c.cc.Invoke(ctx, PolicyService_UpdatePolicy_FullMethodName, in, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *policyServiceClient) DeletePolicy(ctx context.Context, in *DeletePolicyRequest, opts ...grpc.CallOption) (*DeletePolicyResponse, error) {
|
|
out := new(DeletePolicyResponse)
|
|
err := c.cc.Invoke(ctx, PolicyService_DeletePolicy_FullMethodName, in, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
// PolicyServiceServer is the server API for PolicyService service.
|
|
// All implementations must embed UnimplementedPolicyServiceServer
|
|
// for forward compatibility
|
|
type PolicyServiceServer interface {
|
|
// GetPolicy returns a policy with the given id, if it exists. The request
|
|
// must include a policy id. An error is returned if the ID is missing,
|
|
// malformed, or if a policy with the provided ID doesn't exist.
|
|
GetPolicy(context.Context, *GetPolicyRequest) (*GetPolicyResponse, error)
|
|
// ListPolicies returns a list of stored policies in Boundary which exist
|
|
// inside the scope referenced in the request. The request must include the
|
|
// scope ID for the policies being retrieved. An error is returned if the
|
|
// scope ID is missing, malformed, or references a non existing scope.
|
|
ListPolicies(context.Context, *ListPoliciesRequest) (*ListPoliciesResponse, error)
|
|
// CreatePolicy creates and stores a new policy in Boundary. The provided
|
|
// request must include the scope ID in which the policy will be created. An
|
|
// error is returned if the scope ID is missing, malformed or references a non
|
|
// existing scope.
|
|
CreatePolicy(context.Context, *CreatePolicyRequest) (*CreatePolicyResponse, error)
|
|
// UpdatePolicy updates an existing policy in Boundary. The provided policy
|
|
// must not have any read-only fields set. The update mask must be included in
|
|
// the request and contain at least one mutable field. To unset a field's
|
|
// value (if unsettable), include it in the update mask and don't set it in
|
|
// the policy object.
|
|
UpdatePolicy(context.Context, *UpdatePolicyRequest) (*UpdatePolicyResponse, error)
|
|
// DeletePolicy deletes a policy from Boundary. An error is returned if the
|
|
// policy ID is malformed or not provided.
|
|
DeletePolicy(context.Context, *DeletePolicyRequest) (*DeletePolicyResponse, error)
|
|
mustEmbedUnimplementedPolicyServiceServer()
|
|
}
|
|
|
|
// UnimplementedPolicyServiceServer must be embedded to have forward compatible implementations.
|
|
type UnimplementedPolicyServiceServer struct {
|
|
}
|
|
|
|
func (UnimplementedPolicyServiceServer) GetPolicy(context.Context, *GetPolicyRequest) (*GetPolicyResponse, error) {
|
|
return nil, status.Errorf(codes.Unimplemented, "method GetPolicy not implemented")
|
|
}
|
|
func (UnimplementedPolicyServiceServer) ListPolicies(context.Context, *ListPoliciesRequest) (*ListPoliciesResponse, error) {
|
|
return nil, status.Errorf(codes.Unimplemented, "method ListPolicies not implemented")
|
|
}
|
|
func (UnimplementedPolicyServiceServer) CreatePolicy(context.Context, *CreatePolicyRequest) (*CreatePolicyResponse, error) {
|
|
return nil, status.Errorf(codes.Unimplemented, "method CreatePolicy not implemented")
|
|
}
|
|
func (UnimplementedPolicyServiceServer) UpdatePolicy(context.Context, *UpdatePolicyRequest) (*UpdatePolicyResponse, error) {
|
|
return nil, status.Errorf(codes.Unimplemented, "method UpdatePolicy not implemented")
|
|
}
|
|
func (UnimplementedPolicyServiceServer) DeletePolicy(context.Context, *DeletePolicyRequest) (*DeletePolicyResponse, error) {
|
|
return nil, status.Errorf(codes.Unimplemented, "method DeletePolicy not implemented")
|
|
}
|
|
func (UnimplementedPolicyServiceServer) mustEmbedUnimplementedPolicyServiceServer() {}
|
|
|
|
// UnsafePolicyServiceServer may be embedded to opt out of forward compatibility for this service.
|
|
// Use of this interface is not recommended, as added methods to PolicyServiceServer will
|
|
// result in compilation errors.
|
|
type UnsafePolicyServiceServer interface {
|
|
mustEmbedUnimplementedPolicyServiceServer()
|
|
}
|
|
|
|
func RegisterPolicyServiceServer(s grpc.ServiceRegistrar, srv PolicyServiceServer) {
|
|
s.RegisterService(&PolicyService_ServiceDesc, srv)
|
|
}
|
|
|
|
func _PolicyService_GetPolicy_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(GetPolicyRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(PolicyServiceServer).GetPolicy(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: PolicyService_GetPolicy_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(PolicyServiceServer).GetPolicy(ctx, req.(*GetPolicyRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _PolicyService_ListPolicies_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(ListPoliciesRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(PolicyServiceServer).ListPolicies(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: PolicyService_ListPolicies_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(PolicyServiceServer).ListPolicies(ctx, req.(*ListPoliciesRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _PolicyService_CreatePolicy_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(CreatePolicyRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(PolicyServiceServer).CreatePolicy(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: PolicyService_CreatePolicy_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(PolicyServiceServer).CreatePolicy(ctx, req.(*CreatePolicyRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _PolicyService_UpdatePolicy_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(UpdatePolicyRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(PolicyServiceServer).UpdatePolicy(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: PolicyService_UpdatePolicy_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(PolicyServiceServer).UpdatePolicy(ctx, req.(*UpdatePolicyRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _PolicyService_DeletePolicy_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(DeletePolicyRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(PolicyServiceServer).DeletePolicy(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: PolicyService_DeletePolicy_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(PolicyServiceServer).DeletePolicy(ctx, req.(*DeletePolicyRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
// PolicyService_ServiceDesc is the grpc.ServiceDesc for PolicyService service.
|
|
// It's only intended for direct use with grpc.RegisterService,
|
|
// and not to be introspected or modified (even as a copy)
|
|
var PolicyService_ServiceDesc = grpc.ServiceDesc{
|
|
ServiceName: "controller.api.services.v1.PolicyService",
|
|
HandlerType: (*PolicyServiceServer)(nil),
|
|
Methods: []grpc.MethodDesc{
|
|
{
|
|
MethodName: "GetPolicy",
|
|
Handler: _PolicyService_GetPolicy_Handler,
|
|
},
|
|
{
|
|
MethodName: "ListPolicies",
|
|
Handler: _PolicyService_ListPolicies_Handler,
|
|
},
|
|
{
|
|
MethodName: "CreatePolicy",
|
|
Handler: _PolicyService_CreatePolicy_Handler,
|
|
},
|
|
{
|
|
MethodName: "UpdatePolicy",
|
|
Handler: _PolicyService_UpdatePolicy_Handler,
|
|
},
|
|
{
|
|
MethodName: "DeletePolicy",
|
|
Handler: _PolicyService_DeletePolicy_Handler,
|
|
},
|
|
},
|
|
Streams: []grpc.StreamDesc{},
|
|
Metadata: "controller/api/services/v1/policy_service.proto",
|
|
}
|