* 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>
80 lines
5.1 KiB
Protocol Buffer
80 lines
5.1 KiB
Protocol Buffer
// Copyright (c) HashiCorp, Inc.
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
syntax = "proto3";
|
|
|
|
package controller.api.services.v1;
|
|
|
|
import "protoc-gen-openapiv2/options/annotations.proto";
|
|
|
|
option go_package = "github.com/hashicorp/boundary/internal/gen/controller/api/services;services";
|
|
// Global definitions for our HTTP/JSON API.
|
|
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
|
|
info: {
|
|
version: "placeholder-version" // Replaced at generation time by version/VERSION contents
|
|
title: "Boundary controller HTTP API"
|
|
description:
|
|
"Welcome to the Boundary controller HTTP API documentation. "
|
|
"This page provides a reference guide for using the Boundary controller API, a JSON-based HTTP API. "
|
|
"The API implements commonly seen HTTP API patterns for status codes, paths, and errors. "
|
|
"See the [API overview](https://developer.hashicorp.com/boundary/docs/api-clients/api) for more information.\n\n"
|
|
"Before you read this page, it is useful to understand Boundary's [domain model](https://developer.hashicorp.com/boundary/docs/concepts/domain-model) "
|
|
"and to be aware of the terminology used here. "
|
|
"To get started, search for the service you want to interact with in the sidebar to the left. "
|
|
"Each resource in Boundary, such as accounts and credential stores, has its own service. "
|
|
"Each service contains all the API endpoints for the resource.\n"
|
|
"## Status codes\n"
|
|
"- `2XX`: Boundary returns a code between `200` and `299` on success. Generally this is `200`, but implementations should be prepared to accept any `2XX` status code as indicating success. If a call returns a `2XX` code that is not `200`, it follows well-understood semantics for those status codes.\n"
|
|
"- `400`: Boundary returns `400` when a command cannot be completed due to invalid user input, except for a properly-formatted identifier that does not map to an existing resource, which returns a `404` as discussed below.\n"
|
|
"- `401`: Boundary returns `401` if no authentication token is provided or if the provided token is invalid. A valid token that simply does not have permission for a resource returns a `403` instead. A token that is invalid or missing, but where the anonymous user (`u_anon`) is able to successfully perform the action, will not return a `401` but instead will return the result of the action.\n-"
|
|
" `403`: Boundary returns `403` if a provided token was valid but does not have the grants required to perform the requested action.\n-"
|
|
" `404`: Boundary returns `404` if a resource cannot be found. Note that this happens _prior_ to authentication/authorization checking in nearly all cases as the resource information (such as its scope, available actions, etc.) is a required part of that check. As a result, an action against a resource that does not exist returns a `404` instead of a `401` or `403`. While this could be considered an information leak, since IDs are randomly generated and this only discloses whether an ID is valid, it's tolerable as it allows for far simpler and more robust client implementation.\n-"
|
|
" `405`: Boundary returns a `405` to indicate that the method (HTTP verb or custom action) is not implemented for the given resource.\n-"
|
|
" `429`: Boundary returns a `429` if any of the API rate limit quotas have been exhausted for the resource and action. It includes the `Retry-After` header so that the client knows how long to wait before making a new request.\n-"
|
|
" `500`: Boundary returns `500` if an error occurred that is not (directly) tied to invalid user input. If a `500` is generated, information about the error is logged to Boundary's server log but is not generally provided to the client.\n-"
|
|
" `503`: Boundary returns a `503` if it is unable to store a quota due to the API rate limit being exceeded. It includes the `Retry-After` header so that the client knows how long to wait before making a new request.\n## List pagination\nBoundary uses [API pagination](https://developer.hashicorp.com/boundary/docs/api-clients/api/pagination) to support searching and filtering large lists of results efficiently."
|
|
contact: {
|
|
name: "HashiCorp Boundary"
|
|
url: "https://www.boundaryproject.io/"
|
|
};
|
|
license: {
|
|
name: "Business Source License 1.1"
|
|
url: "https://github.com/hashicorp/boundary/blob/main/LICENSE"
|
|
};
|
|
}
|
|
host: "your-boundary-hostname.com"
|
|
external_docs: {
|
|
url: "https://developer.hashicorp.com/boundary/docs"
|
|
description: "Boundary documentation"
|
|
}
|
|
schemes: HTTPS
|
|
schemes: HTTP
|
|
consumes: "application/json"
|
|
produces: "application/json"
|
|
responses: {
|
|
key: "default";
|
|
value: {
|
|
description: "Returned when there is an error processing the request."
|
|
schema: {
|
|
json_schema: {ref: ".controller.api.v1.Error"}
|
|
}
|
|
}
|
|
}
|
|
security_definitions: {
|
|
security: {
|
|
key: "ApiKeyAuth"
|
|
value: {
|
|
type: TYPE_API_KEY
|
|
in: IN_HEADER
|
|
name: "Authorization"
|
|
}
|
|
}
|
|
}
|
|
security: {
|
|
security_requirement: {
|
|
key: "ApiKeyAuth"
|
|
value: {}
|
|
}
|
|
}
|
|
};
|