internal/proto: improvements to OpenAPIv2 spec (#4555)

* 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>
This commit is contained in:
authored and GitHub committed 2024-04-08 13:55:17 -07:00
1 parent b908e7b9da
commit 6b53766aa6
69 files changed
+4339 -1803

No files matched your search

@@ -34,17 +34,17 @@ const (
// 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.
// 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.
// 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
// 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
@@ -54,7 +54,7 @@ type PolicyServiceClient interface {
// 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.
// policy ID is malformed or not provided.
DeletePolicy(ctx context.Context, in *DeletePolicyRequest, opts ...grpc.CallOption) (*DeletePolicyResponse, error)
}
@@ -116,17 +116,17 @@ func (c *policyServiceClient) DeletePolicy(ctx context.Context, in *DeletePolicy
// 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.
// 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.
// 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
// 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
@@ -136,7 +136,7 @@ type PolicyServiceServer interface {
// 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.
// policy ID is malformed or not provided.
DeletePolicy(context.Context, *DeletePolicyRequest) (*DeletePolicyResponse, error)
mustEmbedUnimplementedPolicyServiceServer()
}