767 lines
35 KiB
TypeScript
767 lines
35 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 * as runtime from '../runtime';
|
||
|
|
import type {
|
||
|
|
ControllerApiResourcesRolesV1Role,
|
||
|
|
ControllerApiServicesV1ListRolesResponse,
|
||
|
|
ControllerApiServicesV1RoleServiceAddRoleGrantScopesBody,
|
||
|
|
ControllerApiServicesV1RoleServiceAddRoleGrantsBody,
|
||
|
|
ControllerApiServicesV1RoleServiceAddRolePrincipalsBody,
|
||
|
|
ControllerApiServicesV1RoleServiceRemoveRoleGrantScopesBody,
|
||
|
|
ControllerApiServicesV1RoleServiceRemoveRoleGrantsBody,
|
||
|
|
ControllerApiServicesV1RoleServiceRemoveRolePrincipalsBody,
|
||
|
|
ControllerApiServicesV1RoleServiceSetRoleGrantScopesBody,
|
||
|
|
ControllerApiServicesV1RoleServiceSetRoleGrantsBody,
|
||
|
|
ControllerApiServicesV1RoleServiceSetRolePrincipalsBody,
|
||
|
|
ControllerApiV1Error,
|
||
|
|
} from '../models/index';
|
||
|
|
import {
|
||
|
|
ControllerApiResourcesRolesV1RoleFromJSON,
|
||
|
|
ControllerApiResourcesRolesV1RoleToJSON,
|
||
|
|
ControllerApiServicesV1ListRolesResponseFromJSON,
|
||
|
|
ControllerApiServicesV1ListRolesResponseToJSON,
|
||
|
|
ControllerApiServicesV1RoleServiceAddRoleGrantScopesBodyFromJSON,
|
||
|
|
ControllerApiServicesV1RoleServiceAddRoleGrantScopesBodyToJSON,
|
||
|
|
ControllerApiServicesV1RoleServiceAddRoleGrantsBodyFromJSON,
|
||
|
|
ControllerApiServicesV1RoleServiceAddRoleGrantsBodyToJSON,
|
||
|
|
ControllerApiServicesV1RoleServiceAddRolePrincipalsBodyFromJSON,
|
||
|
|
ControllerApiServicesV1RoleServiceAddRolePrincipalsBodyToJSON,
|
||
|
|
ControllerApiServicesV1RoleServiceRemoveRoleGrantScopesBodyFromJSON,
|
||
|
|
ControllerApiServicesV1RoleServiceRemoveRoleGrantScopesBodyToJSON,
|
||
|
|
ControllerApiServicesV1RoleServiceRemoveRoleGrantsBodyFromJSON,
|
||
|
|
ControllerApiServicesV1RoleServiceRemoveRoleGrantsBodyToJSON,
|
||
|
|
ControllerApiServicesV1RoleServiceRemoveRolePrincipalsBodyFromJSON,
|
||
|
|
ControllerApiServicesV1RoleServiceRemoveRolePrincipalsBodyToJSON,
|
||
|
|
ControllerApiServicesV1RoleServiceSetRoleGrantScopesBodyFromJSON,
|
||
|
|
ControllerApiServicesV1RoleServiceSetRoleGrantScopesBodyToJSON,
|
||
|
|
ControllerApiServicesV1RoleServiceSetRoleGrantsBodyFromJSON,
|
||
|
|
ControllerApiServicesV1RoleServiceSetRoleGrantsBodyToJSON,
|
||
|
|
ControllerApiServicesV1RoleServiceSetRolePrincipalsBodyFromJSON,
|
||
|
|
ControllerApiServicesV1RoleServiceSetRolePrincipalsBodyToJSON,
|
||
|
|
ControllerApiV1ErrorFromJSON,
|
||
|
|
ControllerApiV1ErrorToJSON,
|
||
|
|
} from '../models/index';
|
||
|
|
|
||
|
|
export interface RoleServiceAddRoleGrantScopesRequest {
|
||
|
|
id: string;
|
||
|
|
body: ControllerApiServicesV1RoleServiceAddRoleGrantScopesBody;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface RoleServiceAddRoleGrantsRequest {
|
||
|
|
id: string;
|
||
|
|
body: ControllerApiServicesV1RoleServiceAddRoleGrantsBody;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface RoleServiceAddRolePrincipalsRequest {
|
||
|
|
id: string;
|
||
|
|
body: ControllerApiServicesV1RoleServiceAddRolePrincipalsBody;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface RoleServiceCreateRoleRequest {
|
||
|
|
item: Omit<ControllerApiResourcesRolesV1Role, 'id'|'created_time'|'updated_time'|'grant_scope_ids'|'principal_ids'|'principals'|'grant_strings'|'grants'|'authorized_actions'>;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface RoleServiceDeleteRoleRequest {
|
||
|
|
id: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface RoleServiceGetRoleRequest {
|
||
|
|
id: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface RoleServiceListRolesRequest {
|
||
|
|
scopeId?: string;
|
||
|
|
recursive?: boolean;
|
||
|
|
filter?: string;
|
||
|
|
listToken?: string;
|
||
|
|
pageSize?: number;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface RoleServiceRemoveRoleGrantScopesRequest {
|
||
|
|
id: string;
|
||
|
|
body: ControllerApiServicesV1RoleServiceRemoveRoleGrantScopesBody;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface RoleServiceRemoveRoleGrantsRequest {
|
||
|
|
id: string;
|
||
|
|
body: ControllerApiServicesV1RoleServiceRemoveRoleGrantsBody;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface RoleServiceRemoveRolePrincipalsRequest {
|
||
|
|
id: string;
|
||
|
|
body: ControllerApiServicesV1RoleServiceRemoveRolePrincipalsBody;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface RoleServiceSetRoleGrantScopesRequest {
|
||
|
|
id: string;
|
||
|
|
body: ControllerApiServicesV1RoleServiceSetRoleGrantScopesBody;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface RoleServiceSetRoleGrantsRequest {
|
||
|
|
id: string;
|
||
|
|
body: ControllerApiServicesV1RoleServiceSetRoleGrantsBody;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface RoleServiceSetRolePrincipalsRequest {
|
||
|
|
id: string;
|
||
|
|
body: ControllerApiServicesV1RoleServiceSetRolePrincipalsBody;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface RoleServiceUpdateRoleRequest {
|
||
|
|
id: string;
|
||
|
|
item: Omit<ControllerApiResourcesRolesV1Role, 'id'|'created_time'|'updated_time'|'grant_scope_ids'|'principal_ids'|'principals'|'grant_strings'|'grants'|'authorized_actions'>;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
*
|
||
|
|
*/
|
||
|
|
export class RoleServiceApi extends runtime.BaseAPI {
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Adds grant scopes to a Role
|
||
|
|
*/
|
||
|
|
async roleServiceAddRoleGrantScopesRaw(requestParameters: RoleServiceAddRoleGrantScopesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ControllerApiResourcesRolesV1Role>> {
|
||
|
|
if (requestParameters['id'] == null) {
|
||
|
|
throw new runtime.RequiredError(
|
||
|
|
'id',
|
||
|
|
'Required parameter "id" was null or undefined when calling roleServiceAddRoleGrantScopes().'
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
if (requestParameters['body'] == null) {
|
||
|
|
throw new runtime.RequiredError(
|
||
|
|
'body',
|
||
|
|
'Required parameter "body" was null or undefined when calling roleServiceAddRoleGrantScopes().'
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
const queryParameters: any = {};
|
||
|
|
|
||
|
|
const headerParameters: runtime.HTTPHeaders = {};
|
||
|
|
|
||
|
|
headerParameters['Content-Type'] = 'application/json';
|
||
|
|
|
||
|
|
if (this.configuration && this.configuration.apiKey) {
|
||
|
|
headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiKeyAuth authentication
|
||
|
|
}
|
||
|
|
|
||
|
|
const response = await this.request({
|
||
|
|
path: `/v1/roles/{id}:add-grant-scopes`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))),
|
||
|
|
method: 'POST',
|
||
|
|
headers: headerParameters,
|
||
|
|
query: queryParameters,
|
||
|
|
body: ControllerApiServicesV1RoleServiceAddRoleGrantScopesBodyToJSON(requestParameters['body']),
|
||
|
|
}, initOverrides);
|
||
|
|
|
||
|
|
return new runtime.JSONApiResponse(response, (jsonValue) => ControllerApiResourcesRolesV1RoleFromJSON(jsonValue));
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Adds grant scopes to a Role
|
||
|
|
*/
|
||
|
|
async roleServiceAddRoleGrantScopes(requestParameters: RoleServiceAddRoleGrantScopesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ControllerApiResourcesRolesV1Role> {
|
||
|
|
const response = await this.roleServiceAddRoleGrantScopesRaw(requestParameters, initOverrides);
|
||
|
|
return await response.value();
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Adds grants to a Role
|
||
|
|
*/
|
||
|
|
async roleServiceAddRoleGrantsRaw(requestParameters: RoleServiceAddRoleGrantsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ControllerApiResourcesRolesV1Role>> {
|
||
|
|
if (requestParameters['id'] == null) {
|
||
|
|
throw new runtime.RequiredError(
|
||
|
|
'id',
|
||
|
|
'Required parameter "id" was null or undefined when calling roleServiceAddRoleGrants().'
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
if (requestParameters['body'] == null) {
|
||
|
|
throw new runtime.RequiredError(
|
||
|
|
'body',
|
||
|
|
'Required parameter "body" was null or undefined when calling roleServiceAddRoleGrants().'
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
const queryParameters: any = {};
|
||
|
|
|
||
|
|
const headerParameters: runtime.HTTPHeaders = {};
|
||
|
|
|
||
|
|
headerParameters['Content-Type'] = 'application/json';
|
||
|
|
|
||
|
|
if (this.configuration && this.configuration.apiKey) {
|
||
|
|
headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiKeyAuth authentication
|
||
|
|
}
|
||
|
|
|
||
|
|
const response = await this.request({
|
||
|
|
path: `/v1/roles/{id}:add-grants`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))),
|
||
|
|
method: 'POST',
|
||
|
|
headers: headerParameters,
|
||
|
|
query: queryParameters,
|
||
|
|
body: ControllerApiServicesV1RoleServiceAddRoleGrantsBodyToJSON(requestParameters['body']),
|
||
|
|
}, initOverrides);
|
||
|
|
|
||
|
|
return new runtime.JSONApiResponse(response, (jsonValue) => ControllerApiResourcesRolesV1RoleFromJSON(jsonValue));
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Adds grants to a Role
|
||
|
|
*/
|
||
|
|
async roleServiceAddRoleGrants(requestParameters: RoleServiceAddRoleGrantsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ControllerApiResourcesRolesV1Role> {
|
||
|
|
const response = await this.roleServiceAddRoleGrantsRaw(requestParameters, initOverrides);
|
||
|
|
return await response.value();
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Adds Users and/or Groups to a Role.
|
||
|
|
*/
|
||
|
|
async roleServiceAddRolePrincipalsRaw(requestParameters: RoleServiceAddRolePrincipalsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ControllerApiResourcesRolesV1Role>> {
|
||
|
|
if (requestParameters['id'] == null) {
|
||
|
|
throw new runtime.RequiredError(
|
||
|
|
'id',
|
||
|
|
'Required parameter "id" was null or undefined when calling roleServiceAddRolePrincipals().'
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
if (requestParameters['body'] == null) {
|
||
|
|
throw new runtime.RequiredError(
|
||
|
|
'body',
|
||
|
|
'Required parameter "body" was null or undefined when calling roleServiceAddRolePrincipals().'
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
const queryParameters: any = {};
|
||
|
|
|
||
|
|
const headerParameters: runtime.HTTPHeaders = {};
|
||
|
|
|
||
|
|
headerParameters['Content-Type'] = 'application/json';
|
||
|
|
|
||
|
|
if (this.configuration && this.configuration.apiKey) {
|
||
|
|
headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiKeyAuth authentication
|
||
|
|
}
|
||
|
|
|
||
|
|
const response = await this.request({
|
||
|
|
path: `/v1/roles/{id}:add-principals`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))),
|
||
|
|
method: 'POST',
|
||
|
|
headers: headerParameters,
|
||
|
|
query: queryParameters,
|
||
|
|
body: ControllerApiServicesV1RoleServiceAddRolePrincipalsBodyToJSON(requestParameters['body']),
|
||
|
|
}, initOverrides);
|
||
|
|
|
||
|
|
return new runtime.JSONApiResponse(response, (jsonValue) => ControllerApiResourcesRolesV1RoleFromJSON(jsonValue));
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Adds Users and/or Groups to a Role.
|
||
|
|
*/
|
||
|
|
async roleServiceAddRolePrincipals(requestParameters: RoleServiceAddRolePrincipalsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ControllerApiResourcesRolesV1Role> {
|
||
|
|
const response = await this.roleServiceAddRolePrincipalsRaw(requestParameters, initOverrides);
|
||
|
|
return await response.value();
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Creates a single Role.
|
||
|
|
*/
|
||
|
|
async roleServiceCreateRoleRaw(requestParameters: RoleServiceCreateRoleRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ControllerApiResourcesRolesV1Role>> {
|
||
|
|
if (requestParameters['item'] == null) {
|
||
|
|
throw new runtime.RequiredError(
|
||
|
|
'item',
|
||
|
|
'Required parameter "item" was null or undefined when calling roleServiceCreateRole().'
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
const queryParameters: any = {};
|
||
|
|
|
||
|
|
const headerParameters: runtime.HTTPHeaders = {};
|
||
|
|
|
||
|
|
headerParameters['Content-Type'] = 'application/json';
|
||
|
|
|
||
|
|
if (this.configuration && this.configuration.apiKey) {
|
||
|
|
headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiKeyAuth authentication
|
||
|
|
}
|
||
|
|
|
||
|
|
const response = await this.request({
|
||
|
|
path: `/v1/roles`,
|
||
|
|
method: 'POST',
|
||
|
|
headers: headerParameters,
|
||
|
|
query: queryParameters,
|
||
|
|
body: ControllerApiResourcesRolesV1RoleToJSON(requestParameters['item']),
|
||
|
|
}, initOverrides);
|
||
|
|
|
||
|
|
return new runtime.JSONApiResponse(response, (jsonValue) => ControllerApiResourcesRolesV1RoleFromJSON(jsonValue));
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Creates a single Role.
|
||
|
|
*/
|
||
|
|
async roleServiceCreateRole(requestParameters: RoleServiceCreateRoleRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ControllerApiResourcesRolesV1Role> {
|
||
|
|
const response = await this.roleServiceCreateRoleRaw(requestParameters, initOverrides);
|
||
|
|
return await response.value();
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Deletes a Role.
|
||
|
|
*/
|
||
|
|
async roleServiceDeleteRoleRaw(requestParameters: RoleServiceDeleteRoleRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<object>> {
|
||
|
|
if (requestParameters['id'] == null) {
|
||
|
|
throw new runtime.RequiredError(
|
||
|
|
'id',
|
||
|
|
'Required parameter "id" was null or undefined when calling roleServiceDeleteRole().'
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
const queryParameters: any = {};
|
||
|
|
|
||
|
|
const headerParameters: runtime.HTTPHeaders = {};
|
||
|
|
|
||
|
|
if (this.configuration && this.configuration.apiKey) {
|
||
|
|
headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiKeyAuth authentication
|
||
|
|
}
|
||
|
|
|
||
|
|
const response = await this.request({
|
||
|
|
path: `/v1/roles/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))),
|
||
|
|
method: 'DELETE',
|
||
|
|
headers: headerParameters,
|
||
|
|
query: queryParameters,
|
||
|
|
}, initOverrides);
|
||
|
|
|
||
|
|
return new runtime.JSONApiResponse<any>(response);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Deletes a Role.
|
||
|
|
*/
|
||
|
|
async roleServiceDeleteRole(requestParameters: RoleServiceDeleteRoleRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<object> {
|
||
|
|
const response = await this.roleServiceDeleteRoleRaw(requestParameters, initOverrides);
|
||
|
|
return await response.value();
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Gets a single Role.
|
||
|
|
*/
|
||
|
|
async roleServiceGetRoleRaw(requestParameters: RoleServiceGetRoleRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ControllerApiResourcesRolesV1Role>> {
|
||
|
|
if (requestParameters['id'] == null) {
|
||
|
|
throw new runtime.RequiredError(
|
||
|
|
'id',
|
||
|
|
'Required parameter "id" was null or undefined when calling roleServiceGetRole().'
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
const queryParameters: any = {};
|
||
|
|
|
||
|
|
const headerParameters: runtime.HTTPHeaders = {};
|
||
|
|
|
||
|
|
if (this.configuration && this.configuration.apiKey) {
|
||
|
|
headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiKeyAuth authentication
|
||
|
|
}
|
||
|
|
|
||
|
|
const response = await this.request({
|
||
|
|
path: `/v1/roles/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))),
|
||
|
|
method: 'GET',
|
||
|
|
headers: headerParameters,
|
||
|
|
query: queryParameters,
|
||
|
|
}, initOverrides);
|
||
|
|
|
||
|
|
return new runtime.JSONApiResponse(response, (jsonValue) => ControllerApiResourcesRolesV1RoleFromJSON(jsonValue));
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Gets a single Role.
|
||
|
|
*/
|
||
|
|
async roleServiceGetRole(requestParameters: RoleServiceGetRoleRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ControllerApiResourcesRolesV1Role> {
|
||
|
|
const response = await this.roleServiceGetRoleRaw(requestParameters, initOverrides);
|
||
|
|
return await response.value();
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Lists all Roles.
|
||
|
|
*/
|
||
|
|
async roleServiceListRolesRaw(requestParameters: RoleServiceListRolesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ControllerApiServicesV1ListRolesResponse>> {
|
||
|
|
const queryParameters: any = {};
|
||
|
|
|
||
|
|
if (requestParameters['scopeId'] != null) {
|
||
|
|
queryParameters['scope_id'] = requestParameters['scopeId'];
|
||
|
|
}
|
||
|
|
|
||
|
|
if (requestParameters['recursive'] != null) {
|
||
|
|
queryParameters['recursive'] = requestParameters['recursive'];
|
||
|
|
}
|
||
|
|
|
||
|
|
if (requestParameters['filter'] != null) {
|
||
|
|
queryParameters['filter'] = requestParameters['filter'];
|
||
|
|
}
|
||
|
|
|
||
|
|
if (requestParameters['listToken'] != null) {
|
||
|
|
queryParameters['list_token'] = requestParameters['listToken'];
|
||
|
|
}
|
||
|
|
|
||
|
|
if (requestParameters['pageSize'] != null) {
|
||
|
|
queryParameters['page_size'] = requestParameters['pageSize'];
|
||
|
|
}
|
||
|
|
|
||
|
|
const headerParameters: runtime.HTTPHeaders = {};
|
||
|
|
|
||
|
|
if (this.configuration && this.configuration.apiKey) {
|
||
|
|
headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiKeyAuth authentication
|
||
|
|
}
|
||
|
|
|
||
|
|
const response = await this.request({
|
||
|
|
path: `/v1/roles`,
|
||
|
|
method: 'GET',
|
||
|
|
headers: headerParameters,
|
||
|
|
query: queryParameters,
|
||
|
|
}, initOverrides);
|
||
|
|
|
||
|
|
return new runtime.JSONApiResponse(response, (jsonValue) => ControllerApiServicesV1ListRolesResponseFromJSON(jsonValue));
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Lists all Roles.
|
||
|
|
*/
|
||
|
|
async roleServiceListRoles(requestParameters: RoleServiceListRolesRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ControllerApiServicesV1ListRolesResponse> {
|
||
|
|
const response = await this.roleServiceListRolesRaw(requestParameters, initOverrides);
|
||
|
|
return await response.value();
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Removes grant scopes from a Role.
|
||
|
|
*/
|
||
|
|
async roleServiceRemoveRoleGrantScopesRaw(requestParameters: RoleServiceRemoveRoleGrantScopesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ControllerApiResourcesRolesV1Role>> {
|
||
|
|
if (requestParameters['id'] == null) {
|
||
|
|
throw new runtime.RequiredError(
|
||
|
|
'id',
|
||
|
|
'Required parameter "id" was null or undefined when calling roleServiceRemoveRoleGrantScopes().'
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
if (requestParameters['body'] == null) {
|
||
|
|
throw new runtime.RequiredError(
|
||
|
|
'body',
|
||
|
|
'Required parameter "body" was null or undefined when calling roleServiceRemoveRoleGrantScopes().'
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
const queryParameters: any = {};
|
||
|
|
|
||
|
|
const headerParameters: runtime.HTTPHeaders = {};
|
||
|
|
|
||
|
|
headerParameters['Content-Type'] = 'application/json';
|
||
|
|
|
||
|
|
if (this.configuration && this.configuration.apiKey) {
|
||
|
|
headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiKeyAuth authentication
|
||
|
|
}
|
||
|
|
|
||
|
|
const response = await this.request({
|
||
|
|
path: `/v1/roles/{id}:remove-grant-scopes`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))),
|
||
|
|
method: 'POST',
|
||
|
|
headers: headerParameters,
|
||
|
|
query: queryParameters,
|
||
|
|
body: ControllerApiServicesV1RoleServiceRemoveRoleGrantScopesBodyToJSON(requestParameters['body']),
|
||
|
|
}, initOverrides);
|
||
|
|
|
||
|
|
return new runtime.JSONApiResponse(response, (jsonValue) => ControllerApiResourcesRolesV1RoleFromJSON(jsonValue));
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Removes grant scopes from a Role.
|
||
|
|
*/
|
||
|
|
async roleServiceRemoveRoleGrantScopes(requestParameters: RoleServiceRemoveRoleGrantScopesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ControllerApiResourcesRolesV1Role> {
|
||
|
|
const response = await this.roleServiceRemoveRoleGrantScopesRaw(requestParameters, initOverrides);
|
||
|
|
return await response.value();
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Removes grants from a Role.
|
||
|
|
*/
|
||
|
|
async roleServiceRemoveRoleGrantsRaw(requestParameters: RoleServiceRemoveRoleGrantsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ControllerApiResourcesRolesV1Role>> {
|
||
|
|
if (requestParameters['id'] == null) {
|
||
|
|
throw new runtime.RequiredError(
|
||
|
|
'id',
|
||
|
|
'Required parameter "id" was null or undefined when calling roleServiceRemoveRoleGrants().'
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
if (requestParameters['body'] == null) {
|
||
|
|
throw new runtime.RequiredError(
|
||
|
|
'body',
|
||
|
|
'Required parameter "body" was null or undefined when calling roleServiceRemoveRoleGrants().'
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
const queryParameters: any = {};
|
||
|
|
|
||
|
|
const headerParameters: runtime.HTTPHeaders = {};
|
||
|
|
|
||
|
|
headerParameters['Content-Type'] = 'application/json';
|
||
|
|
|
||
|
|
if (this.configuration && this.configuration.apiKey) {
|
||
|
|
headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiKeyAuth authentication
|
||
|
|
}
|
||
|
|
|
||
|
|
const response = await this.request({
|
||
|
|
path: `/v1/roles/{id}:remove-grants`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))),
|
||
|
|
method: 'POST',
|
||
|
|
headers: headerParameters,
|
||
|
|
query: queryParameters,
|
||
|
|
body: ControllerApiServicesV1RoleServiceRemoveRoleGrantsBodyToJSON(requestParameters['body']),
|
||
|
|
}, initOverrides);
|
||
|
|
|
||
|
|
return new runtime.JSONApiResponse(response, (jsonValue) => ControllerApiResourcesRolesV1RoleFromJSON(jsonValue));
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Removes grants from a Role.
|
||
|
|
*/
|
||
|
|
async roleServiceRemoveRoleGrants(requestParameters: RoleServiceRemoveRoleGrantsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ControllerApiResourcesRolesV1Role> {
|
||
|
|
const response = await this.roleServiceRemoveRoleGrantsRaw(requestParameters, initOverrides);
|
||
|
|
return await response.value();
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Removes the specified Users and/or Groups from a Role.
|
||
|
|
*/
|
||
|
|
async roleServiceRemoveRolePrincipalsRaw(requestParameters: RoleServiceRemoveRolePrincipalsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ControllerApiResourcesRolesV1Role>> {
|
||
|
|
if (requestParameters['id'] == null) {
|
||
|
|
throw new runtime.RequiredError(
|
||
|
|
'id',
|
||
|
|
'Required parameter "id" was null or undefined when calling roleServiceRemoveRolePrincipals().'
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
if (requestParameters['body'] == null) {
|
||
|
|
throw new runtime.RequiredError(
|
||
|
|
'body',
|
||
|
|
'Required parameter "body" was null or undefined when calling roleServiceRemoveRolePrincipals().'
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
const queryParameters: any = {};
|
||
|
|
|
||
|
|
const headerParameters: runtime.HTTPHeaders = {};
|
||
|
|
|
||
|
|
headerParameters['Content-Type'] = 'application/json';
|
||
|
|
|
||
|
|
if (this.configuration && this.configuration.apiKey) {
|
||
|
|
headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiKeyAuth authentication
|
||
|
|
}
|
||
|
|
|
||
|
|
const response = await this.request({
|
||
|
|
path: `/v1/roles/{id}:remove-principals`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))),
|
||
|
|
method: 'POST',
|
||
|
|
headers: headerParameters,
|
||
|
|
query: queryParameters,
|
||
|
|
body: ControllerApiServicesV1RoleServiceRemoveRolePrincipalsBodyToJSON(requestParameters['body']),
|
||
|
|
}, initOverrides);
|
||
|
|
|
||
|
|
return new runtime.JSONApiResponse(response, (jsonValue) => ControllerApiResourcesRolesV1RoleFromJSON(jsonValue));
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Removes the specified Users and/or Groups from a Role.
|
||
|
|
*/
|
||
|
|
async roleServiceRemoveRolePrincipals(requestParameters: RoleServiceRemoveRolePrincipalsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ControllerApiResourcesRolesV1Role> {
|
||
|
|
const response = await this.roleServiceRemoveRolePrincipalsRaw(requestParameters, initOverrides);
|
||
|
|
return await response.value();
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Set grant scopes for a Role, removing any grant scopes that are not specified in the request.
|
||
|
|
*/
|
||
|
|
async roleServiceSetRoleGrantScopesRaw(requestParameters: RoleServiceSetRoleGrantScopesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ControllerApiResourcesRolesV1Role>> {
|
||
|
|
if (requestParameters['id'] == null) {
|
||
|
|
throw new runtime.RequiredError(
|
||
|
|
'id',
|
||
|
|
'Required parameter "id" was null or undefined when calling roleServiceSetRoleGrantScopes().'
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
if (requestParameters['body'] == null) {
|
||
|
|
throw new runtime.RequiredError(
|
||
|
|
'body',
|
||
|
|
'Required parameter "body" was null or undefined when calling roleServiceSetRoleGrantScopes().'
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
const queryParameters: any = {};
|
||
|
|
|
||
|
|
const headerParameters: runtime.HTTPHeaders = {};
|
||
|
|
|
||
|
|
headerParameters['Content-Type'] = 'application/json';
|
||
|
|
|
||
|
|
if (this.configuration && this.configuration.apiKey) {
|
||
|
|
headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiKeyAuth authentication
|
||
|
|
}
|
||
|
|
|
||
|
|
const response = await this.request({
|
||
|
|
path: `/v1/roles/{id}:set-grant-scopes`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))),
|
||
|
|
method: 'POST',
|
||
|
|
headers: headerParameters,
|
||
|
|
query: queryParameters,
|
||
|
|
body: ControllerApiServicesV1RoleServiceSetRoleGrantScopesBodyToJSON(requestParameters['body']),
|
||
|
|
}, initOverrides);
|
||
|
|
|
||
|
|
return new runtime.JSONApiResponse(response, (jsonValue) => ControllerApiResourcesRolesV1RoleFromJSON(jsonValue));
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Set grant scopes for a Role, removing any grant scopes that are not specified in the request.
|
||
|
|
*/
|
||
|
|
async roleServiceSetRoleGrantScopes(requestParameters: RoleServiceSetRoleGrantScopesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ControllerApiResourcesRolesV1Role> {
|
||
|
|
const response = await this.roleServiceSetRoleGrantScopesRaw(requestParameters, initOverrides);
|
||
|
|
return await response.value();
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Set grants for a Role, removing any grants that are not specified in the request.
|
||
|
|
*/
|
||
|
|
async roleServiceSetRoleGrantsRaw(requestParameters: RoleServiceSetRoleGrantsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ControllerApiResourcesRolesV1Role>> {
|
||
|
|
if (requestParameters['id'] == null) {
|
||
|
|
throw new runtime.RequiredError(
|
||
|
|
'id',
|
||
|
|
'Required parameter "id" was null or undefined when calling roleServiceSetRoleGrants().'
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
if (requestParameters['body'] == null) {
|
||
|
|
throw new runtime.RequiredError(
|
||
|
|
'body',
|
||
|
|
'Required parameter "body" was null or undefined when calling roleServiceSetRoleGrants().'
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
const queryParameters: any = {};
|
||
|
|
|
||
|
|
const headerParameters: runtime.HTTPHeaders = {};
|
||
|
|
|
||
|
|
headerParameters['Content-Type'] = 'application/json';
|
||
|
|
|
||
|
|
if (this.configuration && this.configuration.apiKey) {
|
||
|
|
headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiKeyAuth authentication
|
||
|
|
}
|
||
|
|
|
||
|
|
const response = await this.request({
|
||
|
|
path: `/v1/roles/{id}:set-grants`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))),
|
||
|
|
method: 'POST',
|
||
|
|
headers: headerParameters,
|
||
|
|
query: queryParameters,
|
||
|
|
body: ControllerApiServicesV1RoleServiceSetRoleGrantsBodyToJSON(requestParameters['body']),
|
||
|
|
}, initOverrides);
|
||
|
|
|
||
|
|
return new runtime.JSONApiResponse(response, (jsonValue) => ControllerApiResourcesRolesV1RoleFromJSON(jsonValue));
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Set grants for a Role, removing any grants that are not specified in the request.
|
||
|
|
*/
|
||
|
|
async roleServiceSetRoleGrants(requestParameters: RoleServiceSetRoleGrantsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ControllerApiResourcesRolesV1Role> {
|
||
|
|
const response = await this.roleServiceSetRoleGrantsRaw(requestParameters, initOverrides);
|
||
|
|
return await response.value();
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Set Users and/or Groups to a Role, removing any principals that are not specified in the request.
|
||
|
|
*/
|
||
|
|
async roleServiceSetRolePrincipalsRaw(requestParameters: RoleServiceSetRolePrincipalsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ControllerApiResourcesRolesV1Role>> {
|
||
|
|
if (requestParameters['id'] == null) {
|
||
|
|
throw new runtime.RequiredError(
|
||
|
|
'id',
|
||
|
|
'Required parameter "id" was null or undefined when calling roleServiceSetRolePrincipals().'
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
if (requestParameters['body'] == null) {
|
||
|
|
throw new runtime.RequiredError(
|
||
|
|
'body',
|
||
|
|
'Required parameter "body" was null or undefined when calling roleServiceSetRolePrincipals().'
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
const queryParameters: any = {};
|
||
|
|
|
||
|
|
const headerParameters: runtime.HTTPHeaders = {};
|
||
|
|
|
||
|
|
headerParameters['Content-Type'] = 'application/json';
|
||
|
|
|
||
|
|
if (this.configuration && this.configuration.apiKey) {
|
||
|
|
headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiKeyAuth authentication
|
||
|
|
}
|
||
|
|
|
||
|
|
const response = await this.request({
|
||
|
|
path: `/v1/roles/{id}:set-principals`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))),
|
||
|
|
method: 'POST',
|
||
|
|
headers: headerParameters,
|
||
|
|
query: queryParameters,
|
||
|
|
body: ControllerApiServicesV1RoleServiceSetRolePrincipalsBodyToJSON(requestParameters['body']),
|
||
|
|
}, initOverrides);
|
||
|
|
|
||
|
|
return new runtime.JSONApiResponse(response, (jsonValue) => ControllerApiResourcesRolesV1RoleFromJSON(jsonValue));
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Set Users and/or Groups to a Role, removing any principals that are not specified in the request.
|
||
|
|
*/
|
||
|
|
async roleServiceSetRolePrincipals(requestParameters: RoleServiceSetRolePrincipalsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ControllerApiResourcesRolesV1Role> {
|
||
|
|
const response = await this.roleServiceSetRolePrincipalsRaw(requestParameters, initOverrides);
|
||
|
|
return await response.value();
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Updates a Role.
|
||
|
|
*/
|
||
|
|
async roleServiceUpdateRoleRaw(requestParameters: RoleServiceUpdateRoleRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ControllerApiResourcesRolesV1Role>> {
|
||
|
|
if (requestParameters['id'] == null) {
|
||
|
|
throw new runtime.RequiredError(
|
||
|
|
'id',
|
||
|
|
'Required parameter "id" was null or undefined when calling roleServiceUpdateRole().'
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
if (requestParameters['item'] == null) {
|
||
|
|
throw new runtime.RequiredError(
|
||
|
|
'item',
|
||
|
|
'Required parameter "item" was null or undefined when calling roleServiceUpdateRole().'
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
const queryParameters: any = {};
|
||
|
|
|
||
|
|
const headerParameters: runtime.HTTPHeaders = {};
|
||
|
|
|
||
|
|
headerParameters['Content-Type'] = 'application/json';
|
||
|
|
|
||
|
|
if (this.configuration && this.configuration.apiKey) {
|
||
|
|
headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiKeyAuth authentication
|
||
|
|
}
|
||
|
|
|
||
|
|
const response = await this.request({
|
||
|
|
path: `/v1/roles/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))),
|
||
|
|
method: 'PATCH',
|
||
|
|
headers: headerParameters,
|
||
|
|
query: queryParameters,
|
||
|
|
body: ControllerApiResourcesRolesV1RoleToJSON(requestParameters['item']),
|
||
|
|
}, initOverrides);
|
||
|
|
|
||
|
|
return new runtime.JSONApiResponse(response, (jsonValue) => ControllerApiResourcesRolesV1RoleFromJSON(jsonValue));
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Updates a Role.
|
||
|
|
*/
|
||
|
|
async roleServiceUpdateRole(requestParameters: RoleServiceUpdateRoleRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ControllerApiResourcesRolesV1Role> {
|
||
|
|
const response = await this.roleServiceUpdateRoleRaw(requestParameters, initOverrides);
|
||
|
|
return await response.value();
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|