From d221db954950931cb01694fe3523bed4d39f6e56 Mon Sep 17 00:00:00 2001 From: Ryan Wang Date: Mon, 18 Sep 2023 17:35:22 +0800 Subject: [PATCH] Generate api client Signed-off-by: Ryan Wang --- .../api-client/src/.openapi-generator/FILES | 5 +- console/packages/api-client/src/api.ts | 3 +- ...-run-v1alpha1-personal-access-token-api.ts | 685 ++++++++++++++ ...-run-v1alpha1-personal-access-token-api.ts | 846 ++++++++++++++++++ .../packages/api-client/src/models/index.ts | 2 +- .../api-client/src/models/pat-spec.ts | 81 ++ .../src/models/personal-access-token.ts | 6 +- console/src/utils/api-client.ts | 18 +- 8 files changed, 1633 insertions(+), 13 deletions(-) create mode 100644 console/packages/api-client/src/api/api-console-security-halo-run-v1alpha1-personal-access-token-api.ts create mode 100644 console/packages/api-client/src/api/security-halo-run-v1alpha1-personal-access-token-api.ts create mode 100644 console/packages/api-client/src/models/pat-spec.ts diff --git a/console/packages/api-client/src/.openapi-generator/FILES b/console/packages/api-client/src/.openapi-generator/FILES index c0989d74524..54693000ea0 100644 --- a/console/packages/api-client/src/.openapi-generator/FILES +++ b/console/packages/api-client/src/.openapi-generator/FILES @@ -14,6 +14,7 @@ api/api-console-halo-run-v1alpha1-system-api.ts api/api-console-halo-run-v1alpha1-theme-api.ts api/api-console-halo-run-v1alpha1-user-api.ts api/api-console-migration-halo-run-v1alpha1-migration-api.ts +api/api-console-security-halo-run-v1alpha1-personal-access-token-api.ts api/api-content-halo-run-v1alpha1-category-api.ts api/api-content-halo-run-v1alpha1-post-api.ts api/api-content-halo-run-v1alpha1-single-page-api.ts @@ -42,6 +43,7 @@ api/plugin-halo-run-v1alpha1-extension-point-definition-api.ts api/plugin-halo-run-v1alpha1-plugin-api.ts api/plugin-halo-run-v1alpha1-reverse-proxy-api.ts api/plugin-halo-run-v1alpha1-search-engine-api.ts +api/security-halo-run-v1alpha1-personal-access-token-api.ts api/storage-halo-run-v1alpha1-attachment-api.ts api/storage-halo-run-v1alpha1-group-api.ts api/storage-halo-run-v1alpha1-policy-api.ts @@ -52,7 +54,6 @@ api/v1alpha1-cache-api.ts api/v1alpha1-config-map-api.ts api/v1alpha1-menu-api.ts api/v1alpha1-menu-item-api.ts -api/v1alpha1-personal-access-token-api.ts api/v1alpha1-role-api.ts api/v1alpha1-role-binding-api.ts api/v1alpha1-secret-api.ts @@ -157,8 +158,8 @@ models/menu.ts models/metadata.ts models/navigation-post-vo.ts models/owner-info.ts +models/pat-spec.ts models/personal-access-token-list.ts -models/personal-access-token-spec.ts models/personal-access-token.ts models/plugin-author.ts models/plugin-list.ts diff --git a/console/packages/api-client/src/api.ts b/console/packages/api-client/src/api.ts index e7f9b9a08ce..23a8c25752b 100644 --- a/console/packages/api-client/src/api.ts +++ b/console/packages/api-client/src/api.ts @@ -25,6 +25,7 @@ export * from "./api/api-console-halo-run-v1alpha1-system-api"; export * from "./api/api-console-halo-run-v1alpha1-theme-api"; export * from "./api/api-console-halo-run-v1alpha1-user-api"; export * from "./api/api-console-migration-halo-run-v1alpha1-migration-api"; +export * from "./api/api-console-security-halo-run-v1alpha1-personal-access-token-api"; export * from "./api/api-content-halo-run-v1alpha1-category-api"; export * from "./api/api-content-halo-run-v1alpha1-post-api"; export * from "./api/api-content-halo-run-v1alpha1-single-page-api"; @@ -53,6 +54,7 @@ export * from "./api/plugin-halo-run-v1alpha1-extension-point-definition-api"; export * from "./api/plugin-halo-run-v1alpha1-plugin-api"; export * from "./api/plugin-halo-run-v1alpha1-reverse-proxy-api"; export * from "./api/plugin-halo-run-v1alpha1-search-engine-api"; +export * from "./api/security-halo-run-v1alpha1-personal-access-token-api"; export * from "./api/storage-halo-run-v1alpha1-attachment-api"; export * from "./api/storage-halo-run-v1alpha1-group-api"; export * from "./api/storage-halo-run-v1alpha1-policy-api"; @@ -63,7 +65,6 @@ export * from "./api/v1alpha1-cache-api"; export * from "./api/v1alpha1-config-map-api"; export * from "./api/v1alpha1-menu-api"; export * from "./api/v1alpha1-menu-item-api"; -export * from "./api/v1alpha1-personal-access-token-api"; export * from "./api/v1alpha1-role-api"; export * from "./api/v1alpha1-role-binding-api"; export * from "./api/v1alpha1-secret-api"; diff --git a/console/packages/api-client/src/api/api-console-security-halo-run-v1alpha1-personal-access-token-api.ts b/console/packages/api-client/src/api/api-console-security-halo-run-v1alpha1-personal-access-token-api.ts new file mode 100644 index 00000000000..2ae67b63be2 --- /dev/null +++ b/console/packages/api-client/src/api/api-console-security-halo-run-v1alpha1-personal-access-token-api.ts @@ -0,0 +1,685 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Halo Next API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.0.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 type { Configuration } from "../configuration"; +import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from "axios"; +import globalAxios from "axios"; +// Some imports not used depending on template conditions +// @ts-ignore +import { + DUMMY_BASE_URL, + assertParamExists, + setApiKeyToObject, + setBasicAuthToObject, + setBearerAuthToObject, + setOAuthToObject, + setSearchParams, + serializeDataIfNeeded, + toPathString, + createRequestFunction, +} from "../common"; +// @ts-ignore +import { + BASE_PATH, + COLLECTION_FORMATS, + RequestArgs, + BaseAPI, + RequiredError, +} from "../base"; +// @ts-ignore +import { PersonalAccessToken } from "../models"; +/** + * ApiConsoleSecurityHaloRunV1alpha1PersonalAccessTokenApi - axios parameter creator + * @export + */ +export const ApiConsoleSecurityHaloRunV1alpha1PersonalAccessTokenApiAxiosParamCreator = + function (configuration?: Configuration) { + return { + /** + * Delete a PAT + * @param {string} name + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deletePat: async ( + name: string, + options: AxiosRequestConfig = {} + ): Promise => { + // verify required parameter 'name' is not null or undefined + assertParamExists("deletePat", "name", name); + const localVarPath = + `/apis/api.console.security.halo.run/v1alpha1/users/-/personalaccesstokens/{name}`.replace( + `{${"name"}}`, + encodeURIComponent(String(name)) + ); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { + method: "DELETE", + ...baseOptions, + ...options, + }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BasicAuth required + // http basic authentication required + setBasicAuthToObject(localVarRequestOptions, configuration); + + // authentication BearerAuth required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration); + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = + baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Generate a PAT. + * @param {PersonalAccessToken} personalAccessToken + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + generatePat: async ( + personalAccessToken: PersonalAccessToken, + options: AxiosRequestConfig = {} + ): Promise => { + // verify required parameter 'personalAccessToken' is not null or undefined + assertParamExists( + "generatePat", + "personalAccessToken", + personalAccessToken + ); + const localVarPath = `/apis/api.console.security.halo.run/v1alpha1/users/-/personalaccesstokens`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { + method: "POST", + ...baseOptions, + ...options, + }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BasicAuth required + // http basic authentication required + setBasicAuthToObject(localVarRequestOptions, configuration); + + // authentication BearerAuth required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration); + + localVarHeaderParameter["Content-Type"] = "application/json"; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = + baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; + localVarRequestOptions.data = serializeDataIfNeeded( + personalAccessToken, + localVarRequestOptions, + configuration + ); + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Obtain a PAT. + * @param {string} name + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + obtainPat: async ( + name: string, + options: AxiosRequestConfig = {} + ): Promise => { + // verify required parameter 'name' is not null or undefined + assertParamExists("obtainPat", "name", name); + const localVarPath = + `/apis/api.console.security.halo.run/v1alpha1/users/-/personalaccesstokens/{name}`.replace( + `{${"name"}}`, + encodeURIComponent(String(name)) + ); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { + method: "GET", + ...baseOptions, + ...options, + }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BasicAuth required + // http basic authentication required + setBasicAuthToObject(localVarRequestOptions, configuration); + + // authentication BearerAuth required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration); + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = + baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Obtain PAT list. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + obtainPats: async ( + options: AxiosRequestConfig = {} + ): Promise => { + const localVarPath = `/apis/api.console.security.halo.run/v1alpha1/users/-/personalaccesstokens`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { + method: "GET", + ...baseOptions, + ...options, + }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BasicAuth required + // http basic authentication required + setBasicAuthToObject(localVarRequestOptions, configuration); + + // authentication BearerAuth required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration); + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = + baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Revoke a PAT + * @param {string} name + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + revokePat: async ( + name: string, + options: AxiosRequestConfig = {} + ): Promise => { + // verify required parameter 'name' is not null or undefined + assertParamExists("revokePat", "name", name); + const localVarPath = + `/apis/api.console.security.halo.run/v1alpha1/users/-/personalaccesstokens/{name}/actions/revocation`.replace( + `{${"name"}}`, + encodeURIComponent(String(name)) + ); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { + method: "PUT", + ...baseOptions, + ...options, + }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BasicAuth required + // http basic authentication required + setBasicAuthToObject(localVarRequestOptions, configuration); + + // authentication BearerAuth required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration); + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = + baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + }; + }; + +/** + * ApiConsoleSecurityHaloRunV1alpha1PersonalAccessTokenApi - functional programming interface + * @export + */ +export const ApiConsoleSecurityHaloRunV1alpha1PersonalAccessTokenApiFp = + function (configuration?: Configuration) { + const localVarAxiosParamCreator = + ApiConsoleSecurityHaloRunV1alpha1PersonalAccessTokenApiAxiosParamCreator( + configuration + ); + return { + /** + * Delete a PAT + * @param {string} name + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async deletePat( + name: string, + options?: AxiosRequestConfig + ): Promise< + (axios?: AxiosInstance, basePath?: string) => AxiosPromise + > { + const localVarAxiosArgs = await localVarAxiosParamCreator.deletePat( + name, + options + ); + return createRequestFunction( + localVarAxiosArgs, + globalAxios, + BASE_PATH, + configuration + ); + }, + /** + * Generate a PAT. + * @param {PersonalAccessToken} personalAccessToken + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async generatePat( + personalAccessToken: PersonalAccessToken, + options?: AxiosRequestConfig + ): Promise< + ( + axios?: AxiosInstance, + basePath?: string + ) => AxiosPromise + > { + const localVarAxiosArgs = await localVarAxiosParamCreator.generatePat( + personalAccessToken, + options + ); + return createRequestFunction( + localVarAxiosArgs, + globalAxios, + BASE_PATH, + configuration + ); + }, + /** + * Obtain a PAT. + * @param {string} name + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async obtainPat( + name: string, + options?: AxiosRequestConfig + ): Promise< + (axios?: AxiosInstance, basePath?: string) => AxiosPromise + > { + const localVarAxiosArgs = await localVarAxiosParamCreator.obtainPat( + name, + options + ); + return createRequestFunction( + localVarAxiosArgs, + globalAxios, + BASE_PATH, + configuration + ); + }, + /** + * Obtain PAT list. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async obtainPats( + options?: AxiosRequestConfig + ): Promise< + ( + axios?: AxiosInstance, + basePath?: string + ) => AxiosPromise> + > { + const localVarAxiosArgs = await localVarAxiosParamCreator.obtainPats( + options + ); + return createRequestFunction( + localVarAxiosArgs, + globalAxios, + BASE_PATH, + configuration + ); + }, + /** + * Revoke a PAT + * @param {string} name + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async revokePat( + name: string, + options?: AxiosRequestConfig + ): Promise< + (axios?: AxiosInstance, basePath?: string) => AxiosPromise + > { + const localVarAxiosArgs = await localVarAxiosParamCreator.revokePat( + name, + options + ); + return createRequestFunction( + localVarAxiosArgs, + globalAxios, + BASE_PATH, + configuration + ); + }, + }; + }; + +/** + * ApiConsoleSecurityHaloRunV1alpha1PersonalAccessTokenApi - factory interface + * @export + */ +export const ApiConsoleSecurityHaloRunV1alpha1PersonalAccessTokenApiFactory = + function ( + configuration?: Configuration, + basePath?: string, + axios?: AxiosInstance + ) { + const localVarFp = + ApiConsoleSecurityHaloRunV1alpha1PersonalAccessTokenApiFp(configuration); + return { + /** + * Delete a PAT + * @param {ApiConsoleSecurityHaloRunV1alpha1PersonalAccessTokenApiDeletePatRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deletePat( + requestParameters: ApiConsoleSecurityHaloRunV1alpha1PersonalAccessTokenApiDeletePatRequest, + options?: AxiosRequestConfig + ): AxiosPromise { + return localVarFp + .deletePat(requestParameters.name, options) + .then((request) => request(axios, basePath)); + }, + /** + * Generate a PAT. + * @param {ApiConsoleSecurityHaloRunV1alpha1PersonalAccessTokenApiGeneratePatRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + generatePat( + requestParameters: ApiConsoleSecurityHaloRunV1alpha1PersonalAccessTokenApiGeneratePatRequest, + options?: AxiosRequestConfig + ): AxiosPromise { + return localVarFp + .generatePat(requestParameters.personalAccessToken, options) + .then((request) => request(axios, basePath)); + }, + /** + * Obtain a PAT. + * @param {ApiConsoleSecurityHaloRunV1alpha1PersonalAccessTokenApiObtainPatRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + obtainPat( + requestParameters: ApiConsoleSecurityHaloRunV1alpha1PersonalAccessTokenApiObtainPatRequest, + options?: AxiosRequestConfig + ): AxiosPromise { + return localVarFp + .obtainPat(requestParameters.name, options) + .then((request) => request(axios, basePath)); + }, + /** + * Obtain PAT list. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + obtainPats( + options?: AxiosRequestConfig + ): AxiosPromise> { + return localVarFp + .obtainPats(options) + .then((request) => request(axios, basePath)); + }, + /** + * Revoke a PAT + * @param {ApiConsoleSecurityHaloRunV1alpha1PersonalAccessTokenApiRevokePatRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + revokePat( + requestParameters: ApiConsoleSecurityHaloRunV1alpha1PersonalAccessTokenApiRevokePatRequest, + options?: AxiosRequestConfig + ): AxiosPromise { + return localVarFp + .revokePat(requestParameters.name, options) + .then((request) => request(axios, basePath)); + }, + }; + }; + +/** + * Request parameters for deletePat operation in ApiConsoleSecurityHaloRunV1alpha1PersonalAccessTokenApi. + * @export + * @interface ApiConsoleSecurityHaloRunV1alpha1PersonalAccessTokenApiDeletePatRequest + */ +export interface ApiConsoleSecurityHaloRunV1alpha1PersonalAccessTokenApiDeletePatRequest { + /** + * + * @type {string} + * @memberof ApiConsoleSecurityHaloRunV1alpha1PersonalAccessTokenApiDeletePat + */ + readonly name: string; +} + +/** + * Request parameters for generatePat operation in ApiConsoleSecurityHaloRunV1alpha1PersonalAccessTokenApi. + * @export + * @interface ApiConsoleSecurityHaloRunV1alpha1PersonalAccessTokenApiGeneratePatRequest + */ +export interface ApiConsoleSecurityHaloRunV1alpha1PersonalAccessTokenApiGeneratePatRequest { + /** + * + * @type {PersonalAccessToken} + * @memberof ApiConsoleSecurityHaloRunV1alpha1PersonalAccessTokenApiGeneratePat + */ + readonly personalAccessToken: PersonalAccessToken; +} + +/** + * Request parameters for obtainPat operation in ApiConsoleSecurityHaloRunV1alpha1PersonalAccessTokenApi. + * @export + * @interface ApiConsoleSecurityHaloRunV1alpha1PersonalAccessTokenApiObtainPatRequest + */ +export interface ApiConsoleSecurityHaloRunV1alpha1PersonalAccessTokenApiObtainPatRequest { + /** + * + * @type {string} + * @memberof ApiConsoleSecurityHaloRunV1alpha1PersonalAccessTokenApiObtainPat + */ + readonly name: string; +} + +/** + * Request parameters for revokePat operation in ApiConsoleSecurityHaloRunV1alpha1PersonalAccessTokenApi. + * @export + * @interface ApiConsoleSecurityHaloRunV1alpha1PersonalAccessTokenApiRevokePatRequest + */ +export interface ApiConsoleSecurityHaloRunV1alpha1PersonalAccessTokenApiRevokePatRequest { + /** + * + * @type {string} + * @memberof ApiConsoleSecurityHaloRunV1alpha1PersonalAccessTokenApiRevokePat + */ + readonly name: string; +} + +/** + * ApiConsoleSecurityHaloRunV1alpha1PersonalAccessTokenApi - object-oriented interface + * @export + * @class ApiConsoleSecurityHaloRunV1alpha1PersonalAccessTokenApi + * @extends {BaseAPI} + */ +export class ApiConsoleSecurityHaloRunV1alpha1PersonalAccessTokenApi extends BaseAPI { + /** + * Delete a PAT + * @param {ApiConsoleSecurityHaloRunV1alpha1PersonalAccessTokenApiDeletePatRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiConsoleSecurityHaloRunV1alpha1PersonalAccessTokenApi + */ + public deletePat( + requestParameters: ApiConsoleSecurityHaloRunV1alpha1PersonalAccessTokenApiDeletePatRequest, + options?: AxiosRequestConfig + ) { + return ApiConsoleSecurityHaloRunV1alpha1PersonalAccessTokenApiFp( + this.configuration + ) + .deletePat(requestParameters.name, options) + .then((request) => request(this.axios, this.basePath)); + } + + /** + * Generate a PAT. + * @param {ApiConsoleSecurityHaloRunV1alpha1PersonalAccessTokenApiGeneratePatRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiConsoleSecurityHaloRunV1alpha1PersonalAccessTokenApi + */ + public generatePat( + requestParameters: ApiConsoleSecurityHaloRunV1alpha1PersonalAccessTokenApiGeneratePatRequest, + options?: AxiosRequestConfig + ) { + return ApiConsoleSecurityHaloRunV1alpha1PersonalAccessTokenApiFp( + this.configuration + ) + .generatePat(requestParameters.personalAccessToken, options) + .then((request) => request(this.axios, this.basePath)); + } + + /** + * Obtain a PAT. + * @param {ApiConsoleSecurityHaloRunV1alpha1PersonalAccessTokenApiObtainPatRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiConsoleSecurityHaloRunV1alpha1PersonalAccessTokenApi + */ + public obtainPat( + requestParameters: ApiConsoleSecurityHaloRunV1alpha1PersonalAccessTokenApiObtainPatRequest, + options?: AxiosRequestConfig + ) { + return ApiConsoleSecurityHaloRunV1alpha1PersonalAccessTokenApiFp( + this.configuration + ) + .obtainPat(requestParameters.name, options) + .then((request) => request(this.axios, this.basePath)); + } + + /** + * Obtain PAT list. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiConsoleSecurityHaloRunV1alpha1PersonalAccessTokenApi + */ + public obtainPats(options?: AxiosRequestConfig) { + return ApiConsoleSecurityHaloRunV1alpha1PersonalAccessTokenApiFp( + this.configuration + ) + .obtainPats(options) + .then((request) => request(this.axios, this.basePath)); + } + + /** + * Revoke a PAT + * @param {ApiConsoleSecurityHaloRunV1alpha1PersonalAccessTokenApiRevokePatRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiConsoleSecurityHaloRunV1alpha1PersonalAccessTokenApi + */ + public revokePat( + requestParameters: ApiConsoleSecurityHaloRunV1alpha1PersonalAccessTokenApiRevokePatRequest, + options?: AxiosRequestConfig + ) { + return ApiConsoleSecurityHaloRunV1alpha1PersonalAccessTokenApiFp( + this.configuration + ) + .revokePat(requestParameters.name, options) + .then((request) => request(this.axios, this.basePath)); + } +} diff --git a/console/packages/api-client/src/api/security-halo-run-v1alpha1-personal-access-token-api.ts b/console/packages/api-client/src/api/security-halo-run-v1alpha1-personal-access-token-api.ts new file mode 100644 index 00000000000..9f1ef7c44d2 --- /dev/null +++ b/console/packages/api-client/src/api/security-halo-run-v1alpha1-personal-access-token-api.ts @@ -0,0 +1,846 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Halo Next API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.0.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 type { Configuration } from "../configuration"; +import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from "axios"; +import globalAxios from "axios"; +// Some imports not used depending on template conditions +// @ts-ignore +import { + DUMMY_BASE_URL, + assertParamExists, + setApiKeyToObject, + setBasicAuthToObject, + setBearerAuthToObject, + setOAuthToObject, + setSearchParams, + serializeDataIfNeeded, + toPathString, + createRequestFunction, +} from "../common"; +// @ts-ignore +import { + BASE_PATH, + COLLECTION_FORMATS, + RequestArgs, + BaseAPI, + RequiredError, +} from "../base"; +// @ts-ignore +import { PersonalAccessToken } from "../models"; +// @ts-ignore +import { PersonalAccessTokenList } from "../models"; +/** + * SecurityHaloRunV1alpha1PersonalAccessTokenApi - axios parameter creator + * @export + */ +export const SecurityHaloRunV1alpha1PersonalAccessTokenApiAxiosParamCreator = + function (configuration?: Configuration) { + return { + /** + * Create security.halo.run/v1alpha1/PersonalAccessToken + * @param {PersonalAccessToken} [personalAccessToken] Fresh personalaccesstoken + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createsecurityHaloRunV1alpha1PersonalAccessToken: async ( + personalAccessToken?: PersonalAccessToken, + options: AxiosRequestConfig = {} + ): Promise => { + const localVarPath = `/apis/security.halo.run/v1alpha1/personalaccesstokens`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { + method: "POST", + ...baseOptions, + ...options, + }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BasicAuth required + // http basic authentication required + setBasicAuthToObject(localVarRequestOptions, configuration); + + // authentication BearerAuth required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration); + + localVarHeaderParameter["Content-Type"] = "application/json"; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = + baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; + localVarRequestOptions.data = serializeDataIfNeeded( + personalAccessToken, + localVarRequestOptions, + configuration + ); + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Delete security.halo.run/v1alpha1/PersonalAccessToken + * @param {string} name Name of personalaccesstoken + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deletesecurityHaloRunV1alpha1PersonalAccessToken: async ( + name: string, + options: AxiosRequestConfig = {} + ): Promise => { + // verify required parameter 'name' is not null or undefined + assertParamExists( + "deletesecurityHaloRunV1alpha1PersonalAccessToken", + "name", + name + ); + const localVarPath = + `/apis/security.halo.run/v1alpha1/personalaccesstokens/{name}`.replace( + `{${"name"}}`, + encodeURIComponent(String(name)) + ); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { + method: "DELETE", + ...baseOptions, + ...options, + }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BasicAuth required + // http basic authentication required + setBasicAuthToObject(localVarRequestOptions, configuration); + + // authentication BearerAuth required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration); + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = + baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Get security.halo.run/v1alpha1/PersonalAccessToken + * @param {string} name Name of personalaccesstoken + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getsecurityHaloRunV1alpha1PersonalAccessToken: async ( + name: string, + options: AxiosRequestConfig = {} + ): Promise => { + // verify required parameter 'name' is not null or undefined + assertParamExists( + "getsecurityHaloRunV1alpha1PersonalAccessToken", + "name", + name + ); + const localVarPath = + `/apis/security.halo.run/v1alpha1/personalaccesstokens/{name}`.replace( + `{${"name"}}`, + encodeURIComponent(String(name)) + ); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { + method: "GET", + ...baseOptions, + ...options, + }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BasicAuth required + // http basic authentication required + setBasicAuthToObject(localVarRequestOptions, configuration); + + // authentication BearerAuth required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration); + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = + baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * List security.halo.run/v1alpha1/PersonalAccessToken + * @param {Array} [fieldSelector] Field selector for filtering. + * @param {Array} [labelSelector] Label selector for filtering. + * @param {number} [page] The page number. Zero indicates no page. + * @param {number} [size] Size of one page. Zero indicates no limit. + * @param {Array} [sort] Sort property and direction of the list result. Support sorting based on attribute name path. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + listsecurityHaloRunV1alpha1PersonalAccessToken: async ( + fieldSelector?: Array, + labelSelector?: Array, + page?: number, + size?: number, + sort?: Array, + options: AxiosRequestConfig = {} + ): Promise => { + const localVarPath = `/apis/security.halo.run/v1alpha1/personalaccesstokens`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { + method: "GET", + ...baseOptions, + ...options, + }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BasicAuth required + // http basic authentication required + setBasicAuthToObject(localVarRequestOptions, configuration); + + // authentication BearerAuth required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration); + + if (fieldSelector) { + localVarQueryParameter["fieldSelector"] = fieldSelector; + } + + if (labelSelector) { + localVarQueryParameter["labelSelector"] = labelSelector; + } + + if (page !== undefined) { + localVarQueryParameter["page"] = page; + } + + if (size !== undefined) { + localVarQueryParameter["size"] = size; + } + + if (sort) { + localVarQueryParameter["sort"] = Array.from(sort); + } + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = + baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Update security.halo.run/v1alpha1/PersonalAccessToken + * @param {string} name Name of personalaccesstoken + * @param {PersonalAccessToken} [personalAccessToken] Updated personalaccesstoken + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updatesecurityHaloRunV1alpha1PersonalAccessToken: async ( + name: string, + personalAccessToken?: PersonalAccessToken, + options: AxiosRequestConfig = {} + ): Promise => { + // verify required parameter 'name' is not null or undefined + assertParamExists( + "updatesecurityHaloRunV1alpha1PersonalAccessToken", + "name", + name + ); + const localVarPath = + `/apis/security.halo.run/v1alpha1/personalaccesstokens/{name}`.replace( + `{${"name"}}`, + encodeURIComponent(String(name)) + ); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { + method: "PUT", + ...baseOptions, + ...options, + }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BasicAuth required + // http basic authentication required + setBasicAuthToObject(localVarRequestOptions, configuration); + + // authentication BearerAuth required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration); + + localVarHeaderParameter["Content-Type"] = "application/json"; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = + baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; + localVarRequestOptions.data = serializeDataIfNeeded( + personalAccessToken, + localVarRequestOptions, + configuration + ); + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + }; + }; + +/** + * SecurityHaloRunV1alpha1PersonalAccessTokenApi - functional programming interface + * @export + */ +export const SecurityHaloRunV1alpha1PersonalAccessTokenApiFp = function ( + configuration?: Configuration +) { + const localVarAxiosParamCreator = + SecurityHaloRunV1alpha1PersonalAccessTokenApiAxiosParamCreator( + configuration + ); + return { + /** + * Create security.halo.run/v1alpha1/PersonalAccessToken + * @param {PersonalAccessToken} [personalAccessToken] Fresh personalaccesstoken + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async createsecurityHaloRunV1alpha1PersonalAccessToken( + personalAccessToken?: PersonalAccessToken, + options?: AxiosRequestConfig + ): Promise< + ( + axios?: AxiosInstance, + basePath?: string + ) => AxiosPromise + > { + const localVarAxiosArgs = + await localVarAxiosParamCreator.createsecurityHaloRunV1alpha1PersonalAccessToken( + personalAccessToken, + options + ); + return createRequestFunction( + localVarAxiosArgs, + globalAxios, + BASE_PATH, + configuration + ); + }, + /** + * Delete security.halo.run/v1alpha1/PersonalAccessToken + * @param {string} name Name of personalaccesstoken + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async deletesecurityHaloRunV1alpha1PersonalAccessToken( + name: string, + options?: AxiosRequestConfig + ): Promise< + (axios?: AxiosInstance, basePath?: string) => AxiosPromise + > { + const localVarAxiosArgs = + await localVarAxiosParamCreator.deletesecurityHaloRunV1alpha1PersonalAccessToken( + name, + options + ); + return createRequestFunction( + localVarAxiosArgs, + globalAxios, + BASE_PATH, + configuration + ); + }, + /** + * Get security.halo.run/v1alpha1/PersonalAccessToken + * @param {string} name Name of personalaccesstoken + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getsecurityHaloRunV1alpha1PersonalAccessToken( + name: string, + options?: AxiosRequestConfig + ): Promise< + ( + axios?: AxiosInstance, + basePath?: string + ) => AxiosPromise + > { + const localVarAxiosArgs = + await localVarAxiosParamCreator.getsecurityHaloRunV1alpha1PersonalAccessToken( + name, + options + ); + return createRequestFunction( + localVarAxiosArgs, + globalAxios, + BASE_PATH, + configuration + ); + }, + /** + * List security.halo.run/v1alpha1/PersonalAccessToken + * @param {Array} [fieldSelector] Field selector for filtering. + * @param {Array} [labelSelector] Label selector for filtering. + * @param {number} [page] The page number. Zero indicates no page. + * @param {number} [size] Size of one page. Zero indicates no limit. + * @param {Array} [sort] Sort property and direction of the list result. Support sorting based on attribute name path. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async listsecurityHaloRunV1alpha1PersonalAccessToken( + fieldSelector?: Array, + labelSelector?: Array, + page?: number, + size?: number, + sort?: Array, + options?: AxiosRequestConfig + ): Promise< + ( + axios?: AxiosInstance, + basePath?: string + ) => AxiosPromise + > { + const localVarAxiosArgs = + await localVarAxiosParamCreator.listsecurityHaloRunV1alpha1PersonalAccessToken( + fieldSelector, + labelSelector, + page, + size, + sort, + options + ); + return createRequestFunction( + localVarAxiosArgs, + globalAxios, + BASE_PATH, + configuration + ); + }, + /** + * Update security.halo.run/v1alpha1/PersonalAccessToken + * @param {string} name Name of personalaccesstoken + * @param {PersonalAccessToken} [personalAccessToken] Updated personalaccesstoken + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async updatesecurityHaloRunV1alpha1PersonalAccessToken( + name: string, + personalAccessToken?: PersonalAccessToken, + options?: AxiosRequestConfig + ): Promise< + ( + axios?: AxiosInstance, + basePath?: string + ) => AxiosPromise + > { + const localVarAxiosArgs = + await localVarAxiosParamCreator.updatesecurityHaloRunV1alpha1PersonalAccessToken( + name, + personalAccessToken, + options + ); + return createRequestFunction( + localVarAxiosArgs, + globalAxios, + BASE_PATH, + configuration + ); + }, + }; +}; + +/** + * SecurityHaloRunV1alpha1PersonalAccessTokenApi - factory interface + * @export + */ +export const SecurityHaloRunV1alpha1PersonalAccessTokenApiFactory = function ( + configuration?: Configuration, + basePath?: string, + axios?: AxiosInstance +) { + const localVarFp = + SecurityHaloRunV1alpha1PersonalAccessTokenApiFp(configuration); + return { + /** + * Create security.halo.run/v1alpha1/PersonalAccessToken + * @param {SecurityHaloRunV1alpha1PersonalAccessTokenApiCreatesecurityHaloRunV1alpha1PersonalAccessTokenRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createsecurityHaloRunV1alpha1PersonalAccessToken( + requestParameters: SecurityHaloRunV1alpha1PersonalAccessTokenApiCreatesecurityHaloRunV1alpha1PersonalAccessTokenRequest = {}, + options?: AxiosRequestConfig + ): AxiosPromise { + return localVarFp + .createsecurityHaloRunV1alpha1PersonalAccessToken( + requestParameters.personalAccessToken, + options + ) + .then((request) => request(axios, basePath)); + }, + /** + * Delete security.halo.run/v1alpha1/PersonalAccessToken + * @param {SecurityHaloRunV1alpha1PersonalAccessTokenApiDeletesecurityHaloRunV1alpha1PersonalAccessTokenRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deletesecurityHaloRunV1alpha1PersonalAccessToken( + requestParameters: SecurityHaloRunV1alpha1PersonalAccessTokenApiDeletesecurityHaloRunV1alpha1PersonalAccessTokenRequest, + options?: AxiosRequestConfig + ): AxiosPromise { + return localVarFp + .deletesecurityHaloRunV1alpha1PersonalAccessToken( + requestParameters.name, + options + ) + .then((request) => request(axios, basePath)); + }, + /** + * Get security.halo.run/v1alpha1/PersonalAccessToken + * @param {SecurityHaloRunV1alpha1PersonalAccessTokenApiGetsecurityHaloRunV1alpha1PersonalAccessTokenRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getsecurityHaloRunV1alpha1PersonalAccessToken( + requestParameters: SecurityHaloRunV1alpha1PersonalAccessTokenApiGetsecurityHaloRunV1alpha1PersonalAccessTokenRequest, + options?: AxiosRequestConfig + ): AxiosPromise { + return localVarFp + .getsecurityHaloRunV1alpha1PersonalAccessToken( + requestParameters.name, + options + ) + .then((request) => request(axios, basePath)); + }, + /** + * List security.halo.run/v1alpha1/PersonalAccessToken + * @param {SecurityHaloRunV1alpha1PersonalAccessTokenApiListsecurityHaloRunV1alpha1PersonalAccessTokenRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + listsecurityHaloRunV1alpha1PersonalAccessToken( + requestParameters: SecurityHaloRunV1alpha1PersonalAccessTokenApiListsecurityHaloRunV1alpha1PersonalAccessTokenRequest = {}, + options?: AxiosRequestConfig + ): AxiosPromise { + return localVarFp + .listsecurityHaloRunV1alpha1PersonalAccessToken( + requestParameters.fieldSelector, + requestParameters.labelSelector, + requestParameters.page, + requestParameters.size, + requestParameters.sort, + options + ) + .then((request) => request(axios, basePath)); + }, + /** + * Update security.halo.run/v1alpha1/PersonalAccessToken + * @param {SecurityHaloRunV1alpha1PersonalAccessTokenApiUpdatesecurityHaloRunV1alpha1PersonalAccessTokenRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updatesecurityHaloRunV1alpha1PersonalAccessToken( + requestParameters: SecurityHaloRunV1alpha1PersonalAccessTokenApiUpdatesecurityHaloRunV1alpha1PersonalAccessTokenRequest, + options?: AxiosRequestConfig + ): AxiosPromise { + return localVarFp + .updatesecurityHaloRunV1alpha1PersonalAccessToken( + requestParameters.name, + requestParameters.personalAccessToken, + options + ) + .then((request) => request(axios, basePath)); + }, + }; +}; + +/** + * Request parameters for createsecurityHaloRunV1alpha1PersonalAccessToken operation in SecurityHaloRunV1alpha1PersonalAccessTokenApi. + * @export + * @interface SecurityHaloRunV1alpha1PersonalAccessTokenApiCreatesecurityHaloRunV1alpha1PersonalAccessTokenRequest + */ +export interface SecurityHaloRunV1alpha1PersonalAccessTokenApiCreatesecurityHaloRunV1alpha1PersonalAccessTokenRequest { + /** + * Fresh personalaccesstoken + * @type {PersonalAccessToken} + * @memberof SecurityHaloRunV1alpha1PersonalAccessTokenApiCreatesecurityHaloRunV1alpha1PersonalAccessToken + */ + readonly personalAccessToken?: PersonalAccessToken; +} + +/** + * Request parameters for deletesecurityHaloRunV1alpha1PersonalAccessToken operation in SecurityHaloRunV1alpha1PersonalAccessTokenApi. + * @export + * @interface SecurityHaloRunV1alpha1PersonalAccessTokenApiDeletesecurityHaloRunV1alpha1PersonalAccessTokenRequest + */ +export interface SecurityHaloRunV1alpha1PersonalAccessTokenApiDeletesecurityHaloRunV1alpha1PersonalAccessTokenRequest { + /** + * Name of personalaccesstoken + * @type {string} + * @memberof SecurityHaloRunV1alpha1PersonalAccessTokenApiDeletesecurityHaloRunV1alpha1PersonalAccessToken + */ + readonly name: string; +} + +/** + * Request parameters for getsecurityHaloRunV1alpha1PersonalAccessToken operation in SecurityHaloRunV1alpha1PersonalAccessTokenApi. + * @export + * @interface SecurityHaloRunV1alpha1PersonalAccessTokenApiGetsecurityHaloRunV1alpha1PersonalAccessTokenRequest + */ +export interface SecurityHaloRunV1alpha1PersonalAccessTokenApiGetsecurityHaloRunV1alpha1PersonalAccessTokenRequest { + /** + * Name of personalaccesstoken + * @type {string} + * @memberof SecurityHaloRunV1alpha1PersonalAccessTokenApiGetsecurityHaloRunV1alpha1PersonalAccessToken + */ + readonly name: string; +} + +/** + * Request parameters for listsecurityHaloRunV1alpha1PersonalAccessToken operation in SecurityHaloRunV1alpha1PersonalAccessTokenApi. + * @export + * @interface SecurityHaloRunV1alpha1PersonalAccessTokenApiListsecurityHaloRunV1alpha1PersonalAccessTokenRequest + */ +export interface SecurityHaloRunV1alpha1PersonalAccessTokenApiListsecurityHaloRunV1alpha1PersonalAccessTokenRequest { + /** + * Field selector for filtering. + * @type {Array} + * @memberof SecurityHaloRunV1alpha1PersonalAccessTokenApiListsecurityHaloRunV1alpha1PersonalAccessToken + */ + readonly fieldSelector?: Array; + + /** + * Label selector for filtering. + * @type {Array} + * @memberof SecurityHaloRunV1alpha1PersonalAccessTokenApiListsecurityHaloRunV1alpha1PersonalAccessToken + */ + readonly labelSelector?: Array; + + /** + * The page number. Zero indicates no page. + * @type {number} + * @memberof SecurityHaloRunV1alpha1PersonalAccessTokenApiListsecurityHaloRunV1alpha1PersonalAccessToken + */ + readonly page?: number; + + /** + * Size of one page. Zero indicates no limit. + * @type {number} + * @memberof SecurityHaloRunV1alpha1PersonalAccessTokenApiListsecurityHaloRunV1alpha1PersonalAccessToken + */ + readonly size?: number; + + /** + * Sort property and direction of the list result. Support sorting based on attribute name path. + * @type {Array} + * @memberof SecurityHaloRunV1alpha1PersonalAccessTokenApiListsecurityHaloRunV1alpha1PersonalAccessToken + */ + readonly sort?: Array; +} + +/** + * Request parameters for updatesecurityHaloRunV1alpha1PersonalAccessToken operation in SecurityHaloRunV1alpha1PersonalAccessTokenApi. + * @export + * @interface SecurityHaloRunV1alpha1PersonalAccessTokenApiUpdatesecurityHaloRunV1alpha1PersonalAccessTokenRequest + */ +export interface SecurityHaloRunV1alpha1PersonalAccessTokenApiUpdatesecurityHaloRunV1alpha1PersonalAccessTokenRequest { + /** + * Name of personalaccesstoken + * @type {string} + * @memberof SecurityHaloRunV1alpha1PersonalAccessTokenApiUpdatesecurityHaloRunV1alpha1PersonalAccessToken + */ + readonly name: string; + + /** + * Updated personalaccesstoken + * @type {PersonalAccessToken} + * @memberof SecurityHaloRunV1alpha1PersonalAccessTokenApiUpdatesecurityHaloRunV1alpha1PersonalAccessToken + */ + readonly personalAccessToken?: PersonalAccessToken; +} + +/** + * SecurityHaloRunV1alpha1PersonalAccessTokenApi - object-oriented interface + * @export + * @class SecurityHaloRunV1alpha1PersonalAccessTokenApi + * @extends {BaseAPI} + */ +export class SecurityHaloRunV1alpha1PersonalAccessTokenApi extends BaseAPI { + /** + * Create security.halo.run/v1alpha1/PersonalAccessToken + * @param {SecurityHaloRunV1alpha1PersonalAccessTokenApiCreatesecurityHaloRunV1alpha1PersonalAccessTokenRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof SecurityHaloRunV1alpha1PersonalAccessTokenApi + */ + public createsecurityHaloRunV1alpha1PersonalAccessToken( + requestParameters: SecurityHaloRunV1alpha1PersonalAccessTokenApiCreatesecurityHaloRunV1alpha1PersonalAccessTokenRequest = {}, + options?: AxiosRequestConfig + ) { + return SecurityHaloRunV1alpha1PersonalAccessTokenApiFp(this.configuration) + .createsecurityHaloRunV1alpha1PersonalAccessToken( + requestParameters.personalAccessToken, + options + ) + .then((request) => request(this.axios, this.basePath)); + } + + /** + * Delete security.halo.run/v1alpha1/PersonalAccessToken + * @param {SecurityHaloRunV1alpha1PersonalAccessTokenApiDeletesecurityHaloRunV1alpha1PersonalAccessTokenRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof SecurityHaloRunV1alpha1PersonalAccessTokenApi + */ + public deletesecurityHaloRunV1alpha1PersonalAccessToken( + requestParameters: SecurityHaloRunV1alpha1PersonalAccessTokenApiDeletesecurityHaloRunV1alpha1PersonalAccessTokenRequest, + options?: AxiosRequestConfig + ) { + return SecurityHaloRunV1alpha1PersonalAccessTokenApiFp(this.configuration) + .deletesecurityHaloRunV1alpha1PersonalAccessToken( + requestParameters.name, + options + ) + .then((request) => request(this.axios, this.basePath)); + } + + /** + * Get security.halo.run/v1alpha1/PersonalAccessToken + * @param {SecurityHaloRunV1alpha1PersonalAccessTokenApiGetsecurityHaloRunV1alpha1PersonalAccessTokenRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof SecurityHaloRunV1alpha1PersonalAccessTokenApi + */ + public getsecurityHaloRunV1alpha1PersonalAccessToken( + requestParameters: SecurityHaloRunV1alpha1PersonalAccessTokenApiGetsecurityHaloRunV1alpha1PersonalAccessTokenRequest, + options?: AxiosRequestConfig + ) { + return SecurityHaloRunV1alpha1PersonalAccessTokenApiFp(this.configuration) + .getsecurityHaloRunV1alpha1PersonalAccessToken( + requestParameters.name, + options + ) + .then((request) => request(this.axios, this.basePath)); + } + + /** + * List security.halo.run/v1alpha1/PersonalAccessToken + * @param {SecurityHaloRunV1alpha1PersonalAccessTokenApiListsecurityHaloRunV1alpha1PersonalAccessTokenRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof SecurityHaloRunV1alpha1PersonalAccessTokenApi + */ + public listsecurityHaloRunV1alpha1PersonalAccessToken( + requestParameters: SecurityHaloRunV1alpha1PersonalAccessTokenApiListsecurityHaloRunV1alpha1PersonalAccessTokenRequest = {}, + options?: AxiosRequestConfig + ) { + return SecurityHaloRunV1alpha1PersonalAccessTokenApiFp(this.configuration) + .listsecurityHaloRunV1alpha1PersonalAccessToken( + requestParameters.fieldSelector, + requestParameters.labelSelector, + requestParameters.page, + requestParameters.size, + requestParameters.sort, + options + ) + .then((request) => request(this.axios, this.basePath)); + } + + /** + * Update security.halo.run/v1alpha1/PersonalAccessToken + * @param {SecurityHaloRunV1alpha1PersonalAccessTokenApiUpdatesecurityHaloRunV1alpha1PersonalAccessTokenRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof SecurityHaloRunV1alpha1PersonalAccessTokenApi + */ + public updatesecurityHaloRunV1alpha1PersonalAccessToken( + requestParameters: SecurityHaloRunV1alpha1PersonalAccessTokenApiUpdatesecurityHaloRunV1alpha1PersonalAccessTokenRequest, + options?: AxiosRequestConfig + ) { + return SecurityHaloRunV1alpha1PersonalAccessTokenApiFp(this.configuration) + .updatesecurityHaloRunV1alpha1PersonalAccessToken( + requestParameters.name, + requestParameters.personalAccessToken, + options + ) + .then((request) => request(this.axios, this.basePath)); + } +} diff --git a/console/packages/api-client/src/models/index.ts b/console/packages/api-client/src/models/index.ts index 6e100e14f85..88262a54b68 100644 --- a/console/packages/api-client/src/models/index.ts +++ b/console/packages/api-client/src/models/index.ts @@ -91,9 +91,9 @@ export * from "./menu-vo"; export * from "./metadata"; export * from "./navigation-post-vo"; export * from "./owner-info"; +export * from "./pat-spec"; export * from "./personal-access-token"; export * from "./personal-access-token-list"; -export * from "./personal-access-token-spec"; export * from "./plugin"; export * from "./plugin-author"; export * from "./plugin-list"; diff --git a/console/packages/api-client/src/models/pat-spec.ts b/console/packages/api-client/src/models/pat-spec.ts new file mode 100644 index 00000000000..72ede25da09 --- /dev/null +++ b/console/packages/api-client/src/models/pat-spec.ts @@ -0,0 +1,81 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Halo Next API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 2.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/** + * + * @export + * @interface PatSpec + */ +export interface PatSpec { + /** + * + * @type {string} + * @memberof PatSpec + */ + description?: string; + /** + * + * @type {string} + * @memberof PatSpec + */ + expiresAt?: string; + /** + * + * @type {string} + * @memberof PatSpec + */ + lastUsed?: string; + /** + * + * @type {string} + * @memberof PatSpec + */ + name?: string; + /** + * + * @type {boolean} + * @memberof PatSpec + */ + revoked?: boolean; + /** + * + * @type {string} + * @memberof PatSpec + */ + revokesAt?: string; + /** + * + * @type {Array} + * @memberof PatSpec + */ + roles?: Array; + /** + * + * @type {Array} + * @memberof PatSpec + */ + scopes?: Array; + /** + * + * @type {string} + * @memberof PatSpec + */ + tokenId?: string; + /** + * + * @type {string} + * @memberof PatSpec + */ + username?: string; +} diff --git a/console/packages/api-client/src/models/personal-access-token.ts b/console/packages/api-client/src/models/personal-access-token.ts index 12c33fc3305..08385810b4f 100644 --- a/console/packages/api-client/src/models/personal-access-token.ts +++ b/console/packages/api-client/src/models/personal-access-token.ts @@ -17,7 +17,7 @@ import { Metadata } from "./metadata"; // May contain unused imports in some cases // @ts-ignore -import { PersonalAccessTokenSpec } from "./personal-access-token-spec"; +import { PatSpec } from "./pat-spec"; /** * @@ -45,8 +45,8 @@ export interface PersonalAccessToken { metadata: Metadata; /** * - * @type {PersonalAccessTokenSpec} + * @type {PatSpec} * @memberof PersonalAccessToken */ - spec?: PersonalAccessTokenSpec; + spec?: PatSpec; } diff --git a/console/src/utils/api-client.ts b/console/src/utils/api-client.ts index 52eb57261f8..7c0d5dacc0f 100644 --- a/console/src/utils/api-client.ts +++ b/console/src/utils/api-client.ts @@ -28,7 +28,6 @@ import { V1alpha1ConfigMapApi, V1alpha1MenuApi, V1alpha1MenuItemApi, - V1alpha1PersonalAccessTokenApi, V1alpha1RoleApi, V1alpha1RoleBindingApi, V1alpha1SettingApi, @@ -41,6 +40,8 @@ import { ApiHaloRunV1alpha1UserApi, MigrationHaloRunV1alpha1BackupApi, ApiConsoleMigrationHaloRunV1alpha1MigrationApi, + ApiConsoleSecurityHaloRunV1alpha1PersonalAccessTokenApi, + SecurityHaloRunV1alpha1PersonalAccessTokenApi, } from "@halo-dev/api-client"; import type { AxiosError, AxiosInstance } from "axios"; import axios from "axios"; @@ -117,11 +118,6 @@ function setupApiClient(axios: AxiosInstance) { return { extension: { configMap: new V1alpha1ConfigMapApi(undefined, baseURL, axios), - personalAccessToken: new V1alpha1PersonalAccessTokenApi( - undefined, - baseURL, - axios - ), roleBinding: new V1alpha1RoleBindingApi(undefined, baseURL, axios), role: new V1alpha1RoleApi(undefined, baseURL, axios), setting: new V1alpha1SettingApi(undefined, baseURL, axios), @@ -184,6 +180,11 @@ function setupApiClient(axios: AxiosInstance) { axios ), backup: new MigrationHaloRunV1alpha1BackupApi(undefined, baseURL, axios), + pat: new SecurityHaloRunV1alpha1PersonalAccessTokenApi( + undefined, + baseURL, + axios + ), }, // custom endpoints user: new ApiConsoleHaloRunV1alpha1UserApi(undefined, baseURL, axios), @@ -220,6 +221,11 @@ function setupApiClient(axios: AxiosInstance) { axios ), system: new ApiConsoleHaloRunV1alpha1SystemApi(undefined, baseURL, axios), + pat: new ApiConsoleSecurityHaloRunV1alpha1PersonalAccessTokenApi( + undefined, + baseURL, + axios + ), }; }