* chore: 🤖 add @openapitools/openapi-generator-cli * chore: 🤖 Add @nestjs/core and @openapitools/openapi-generator-cli to ignoredBuiltDependencies These packages use postinstall for a opencollective notice * chore: 🤖 add package.json scripts for open-api client gen * chore: 🤖 add openapi generated files * chore: 🤖 add boundary api client fixture * chore: 🤖 incorporate api client fixture with base fixture * chore: 🤖 migrate existing test to use boundary api fixture * refactor: 💡 remove org cleanup from test * refactor: 💡 update sorting e2e test to use api client * refactor: 💡 clean up api client resource clean up logging * docs: ✏️ update jsdoc links for domain clients * chore: 🤖 avoid adding copywright headers to generated api * Add missing copyright headers * chore: 🤖 remove fetch argument from api client class The hope was to use request.fetch but playwright's fetch is a non-standard fetch which causes the generated api client to fail when using .clone() on the response * chore: 🤖 add optional OPENAPI_SWAGGER_URL_OR_FILE for openapi-client generation The OPENAPI_SWAGGER_URL_OR_FILE env var can be used to specify the -i flag the generate:api-client script with either: * a relative path * an absolute path * a url like: https://raw.githubusercontent.com/hashicorp/boundary/refs/heads/main/internal/gen/controller.swagger.json * refactor: 💡 clean up and refactor boundary-api-client fixture * chore: 🤖 add extra doc links and delete methods * test: 💍 add test to ensure that api-client fixture works * test: 💍 update existing e2e test examples with api-client * docs: ✏️ add comment for api-client e2e test * docs: ✏️ add additional links to service docs for api clients * refactor: 💡 cleanup api-client and corresponding test * docs: ✏️ add api client fixture docs to e2e README * fix: 🐛 fix regex * remove unnecessary capture group * add "-" to regex to allow for url segments like "storage-buckets" in "/v1/storage-buckets" * docs: ✏️ comment potential edge case in e2e api client cleanup * docs: ✏️ fix comment typo Co-authored-by: Zhihe Li <zhihe.li@hashicorp.com> * docs: ✏️ remove auth flag for generating e2e client * docs: ✏️ add mention that java is required for generate:api * chore: 🤖 implement pr feedback * chore: 🤖 Clean up api client and add more extensive test * chore: 🤖 fix casing in api-client test Co-authored-by: Zhihe Li <zhihe.li@hashicorp.com> --------- Co-authored-by: Zhihe Li <zhihe.li@hashicorp.com>
222 lines
12 KiB
TypeScript
222 lines
12 KiB
TypeScript
/* tslint:disable */
|
|
/* eslint-disable */
|
|
/**
|
|
* Boundary controller HTTP API
|
|
* 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. 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. ## Status codes - `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. - `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. - `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. - `403`: Boundary returns `403` if a provided token was valid but does not have the grants required to perform the requested action. - `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. - `405`: Boundary returns a `405` to indicate that the method (HTTP verb or custom action) is not implemented for the given resource. - `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. - `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. - `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. ## List pagination Boundary uses [API pagination](https://developer.hashicorp.com/boundary/docs/api-clients/api/pagination) to support searching and filtering large lists of results efficiently.
|
|
*
|
|
* The version of the OpenAPI document: 0.19.0
|
|
*
|
|
*
|
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
* https://openapi-generator.tech
|
|
* Do not edit the class manually.
|
|
*/
|
|
|
|
import { mapValues } from '../runtime';
|
|
import type { ControllerApiResourcesSessionsV1Connection } from './ControllerApiResourcesSessionsV1Connection';
|
|
import {
|
|
ControllerApiResourcesSessionsV1ConnectionFromJSON,
|
|
ControllerApiResourcesSessionsV1ConnectionFromJSONTyped,
|
|
ControllerApiResourcesSessionsV1ConnectionToJSON,
|
|
ControllerApiResourcesSessionsV1ConnectionToJSONTyped,
|
|
} from './ControllerApiResourcesSessionsV1Connection';
|
|
import type { ControllerApiResourcesScopesV1ScopeInfo } from './ControllerApiResourcesScopesV1ScopeInfo';
|
|
import {
|
|
ControllerApiResourcesScopesV1ScopeInfoFromJSON,
|
|
ControllerApiResourcesScopesV1ScopeInfoFromJSONTyped,
|
|
ControllerApiResourcesScopesV1ScopeInfoToJSON,
|
|
ControllerApiResourcesScopesV1ScopeInfoToJSONTyped,
|
|
} from './ControllerApiResourcesScopesV1ScopeInfo';
|
|
import type { ControllerApiResourcesSessionsV1SessionState } from './ControllerApiResourcesSessionsV1SessionState';
|
|
import {
|
|
ControllerApiResourcesSessionsV1SessionStateFromJSON,
|
|
ControllerApiResourcesSessionsV1SessionStateFromJSONTyped,
|
|
ControllerApiResourcesSessionsV1SessionStateToJSON,
|
|
ControllerApiResourcesSessionsV1SessionStateToJSONTyped,
|
|
} from './ControllerApiResourcesSessionsV1SessionState';
|
|
|
|
/**
|
|
*
|
|
* @export
|
|
* @interface ControllerApiResourcesSessionsV1Session
|
|
*/
|
|
export interface ControllerApiResourcesSessionsV1Session {
|
|
/**
|
|
* Output only. The ID of the Session.
|
|
* @type {string}
|
|
* @memberof ControllerApiResourcesSessionsV1Session
|
|
*/
|
|
readonly id?: string;
|
|
/**
|
|
* Output only. The ID of the Target that created this Session.
|
|
* @type {string}
|
|
* @memberof ControllerApiResourcesSessionsV1Session
|
|
*/
|
|
readonly targetId?: string;
|
|
/**
|
|
*
|
|
* @type {ControllerApiResourcesScopesV1ScopeInfo}
|
|
* @memberof ControllerApiResourcesSessionsV1Session
|
|
*/
|
|
scope?: ControllerApiResourcesScopesV1ScopeInfo;
|
|
/**
|
|
* Output only. The time this resource was created.
|
|
* @type {Date}
|
|
* @memberof ControllerApiResourcesSessionsV1Session
|
|
*/
|
|
readonly createdTime?: Date;
|
|
/**
|
|
* Output only. The time this resource was last updated.
|
|
* @type {Date}
|
|
* @memberof ControllerApiResourcesSessionsV1Session
|
|
*/
|
|
readonly updatedTime?: Date;
|
|
/**
|
|
* Version is used when canceling this Session to ensure that the operation is acting on a known session state.
|
|
* @type {number}
|
|
* @memberof ControllerApiResourcesSessionsV1Session
|
|
*/
|
|
version?: number;
|
|
/**
|
|
* Output only. Type of the Session (e.g. tcp).
|
|
* @type {string}
|
|
* @memberof ControllerApiResourcesSessionsV1Session
|
|
*/
|
|
readonly type?: string;
|
|
/**
|
|
* Output only. After this time the connection will be expired, e.g. forcefully terminated.
|
|
* @type {Date}
|
|
* @memberof ControllerApiResourcesSessionsV1Session
|
|
*/
|
|
readonly expirationTime?: Date;
|
|
/**
|
|
* Output only. The ID of the Auth Token used to authenticate.
|
|
* @type {string}
|
|
* @memberof ControllerApiResourcesSessionsV1Session
|
|
*/
|
|
readonly authTokenId?: string;
|
|
/**
|
|
* Output only. The ID of the User that requested the Session.
|
|
* @type {string}
|
|
* @memberof ControllerApiResourcesSessionsV1Session
|
|
*/
|
|
readonly userId?: string;
|
|
/**
|
|
* Output only. The Host Set sourcing the Host for this Session.
|
|
* @type {string}
|
|
* @memberof ControllerApiResourcesSessionsV1Session
|
|
*/
|
|
readonly hostSetId?: string;
|
|
/**
|
|
* Output only. The Host used by the Session.
|
|
* @type {string}
|
|
* @memberof ControllerApiResourcesSessionsV1Session
|
|
*/
|
|
readonly hostId?: string;
|
|
/**
|
|
* Output only. The Scope of the Session.
|
|
* @type {string}
|
|
* @memberof ControllerApiResourcesSessionsV1Session
|
|
*/
|
|
readonly scopeId?: string;
|
|
/**
|
|
* Output only. The endpoint of the Session; that is, the address to which the worker is proxying data.
|
|
* @type {string}
|
|
* @memberof ControllerApiResourcesSessionsV1Session
|
|
*/
|
|
readonly endpoint?: string;
|
|
/**
|
|
* Output only. The states of this Session in descending order from the current state to the first.
|
|
* @type {Array<ControllerApiResourcesSessionsV1SessionState>}
|
|
* @memberof ControllerApiResourcesSessionsV1Session
|
|
*/
|
|
readonly states?: Array<ControllerApiResourcesSessionsV1SessionState>;
|
|
/**
|
|
* Output only. The current status of this Session.
|
|
* @type {string}
|
|
* @memberof ControllerApiResourcesSessionsV1Session
|
|
*/
|
|
readonly status?: string;
|
|
/**
|
|
* Output only. The certificate generated for the session. Raw DER bytes.
|
|
* @type {string}
|
|
* @memberof ControllerApiResourcesSessionsV1Session
|
|
*/
|
|
readonly certificate?: string;
|
|
/**
|
|
* Output only. If the session is terminated, this provides a short description as to why.
|
|
* @type {string}
|
|
* @memberof ControllerApiResourcesSessionsV1Session
|
|
*/
|
|
readonly terminationReason?: string;
|
|
/**
|
|
* Output only. The available actions on this resource for this user.
|
|
* @type {Array<string>}
|
|
* @memberof ControllerApiResourcesSessionsV1Session
|
|
*/
|
|
readonly authorizedActions?: Array<string>;
|
|
/**
|
|
* Output only. The associated connections with this session.
|
|
* @type {Array<ControllerApiResourcesSessionsV1Connection>}
|
|
* @memberof ControllerApiResourcesSessionsV1Session
|
|
*/
|
|
readonly connections?: Array<ControllerApiResourcesSessionsV1Connection>;
|
|
}
|
|
|
|
/**
|
|
* Check if a given object implements the ControllerApiResourcesSessionsV1Session interface.
|
|
*/
|
|
export function instanceOfControllerApiResourcesSessionsV1Session(value: object): value is ControllerApiResourcesSessionsV1Session {
|
|
return true;
|
|
}
|
|
|
|
export function ControllerApiResourcesSessionsV1SessionFromJSON(json: any): ControllerApiResourcesSessionsV1Session {
|
|
return ControllerApiResourcesSessionsV1SessionFromJSONTyped(json, false);
|
|
}
|
|
|
|
export function ControllerApiResourcesSessionsV1SessionFromJSONTyped(json: any, ignoreDiscriminator: boolean): ControllerApiResourcesSessionsV1Session {
|
|
if (json == null) {
|
|
return json;
|
|
}
|
|
return {
|
|
|
|
'id': json['id'] == null ? undefined : json['id'],
|
|
'targetId': json['target_id'] == null ? undefined : json['target_id'],
|
|
'scope': json['scope'] == null ? undefined : ControllerApiResourcesScopesV1ScopeInfoFromJSON(json['scope']),
|
|
'createdTime': json['created_time'] == null ? undefined : (new Date(json['created_time'])),
|
|
'updatedTime': json['updated_time'] == null ? undefined : (new Date(json['updated_time'])),
|
|
'version': json['version'] == null ? undefined : json['version'],
|
|
'type': json['type'] == null ? undefined : json['type'],
|
|
'expirationTime': json['expiration_time'] == null ? undefined : (new Date(json['expiration_time'])),
|
|
'authTokenId': json['auth_token_id'] == null ? undefined : json['auth_token_id'],
|
|
'userId': json['user_id'] == null ? undefined : json['user_id'],
|
|
'hostSetId': json['host_set_id'] == null ? undefined : json['host_set_id'],
|
|
'hostId': json['host_id'] == null ? undefined : json['host_id'],
|
|
'scopeId': json['scope_id'] == null ? undefined : json['scope_id'],
|
|
'endpoint': json['endpoint'] == null ? undefined : json['endpoint'],
|
|
'states': json['states'] == null ? undefined : ((json['states'] as Array<any>).map(ControllerApiResourcesSessionsV1SessionStateFromJSON)),
|
|
'status': json['status'] == null ? undefined : json['status'],
|
|
'certificate': json['certificate'] == null ? undefined : json['certificate'],
|
|
'terminationReason': json['termination_reason'] == null ? undefined : json['termination_reason'],
|
|
'authorizedActions': json['authorized_actions'] == null ? undefined : json['authorized_actions'],
|
|
'connections': json['connections'] == null ? undefined : ((json['connections'] as Array<any>).map(ControllerApiResourcesSessionsV1ConnectionFromJSON)),
|
|
};
|
|
}
|
|
|
|
export function ControllerApiResourcesSessionsV1SessionToJSON(json: any): ControllerApiResourcesSessionsV1Session {
|
|
return ControllerApiResourcesSessionsV1SessionToJSONTyped(json, false);
|
|
}
|
|
|
|
export function ControllerApiResourcesSessionsV1SessionToJSONTyped(value?: Omit<ControllerApiResourcesSessionsV1Session, 'id'|'target_id'|'created_time'|'updated_time'|'type'|'expiration_time'|'auth_token_id'|'user_id'|'host_set_id'|'host_id'|'scope_id'|'endpoint'|'states'|'status'|'certificate'|'termination_reason'|'authorized_actions'|'connections'> | null, ignoreDiscriminator: boolean = false): any {
|
|
if (value == null) {
|
|
return value;
|
|
}
|
|
|
|
return {
|
|
|
|
'scope': ControllerApiResourcesScopesV1ScopeInfoToJSON(value['scope']),
|
|
'version': value['version'],
|
|
};
|
|
}
|
|
|