From 30bf294698b5ee72a595f09af3b5e298ee847e97 Mon Sep 17 00:00:00 2001 From: Christian Nuss Date: Thu, 17 Feb 2022 21:25:20 -0800 Subject: [PATCH] post commit sha --- .openapis | 2 +- api/github-sls-rest-api/api.ts | 316 ++++++++++++++++++++++- api/github-sls-rest-api/base.ts | 2 +- api/github-sls-rest-api/common.ts | 2 +- api/github-sls-rest-api/configuration.ts | 2 +- api/github-sls-rest-api/index.ts | 2 +- api/github-sls-rest-api/version.json | 2 +- src/action.ts | 3 +- 8 files changed, 316 insertions(+), 15 deletions(-) diff --git a/.openapis b/.openapis index 43a97ad..51b0c7d 100644 --- a/.openapis +++ b/.openapis @@ -6,5 +6,5 @@ # This file is *safe* to add to source control and will increase the speed of builds --- - serviceName: github-sls-rest-api - version: 1.0.38-8 + version: 1.0.51-0 diff --git a/api/github-sls-rest-api/api.ts b/api/github-sls-rest-api/api.ts index c335214..d87d063 100644 --- a/api/github-sls-rest-api/api.ts +++ b/api/github-sls-rest-api/api.ts @@ -4,7 +4,7 @@ * github-sls-rest-api * To generate a JWT token, go to the JWT Token Generator * - * The version of the OpenAPI document: 1.0.38-8 + * The version of the OpenAPI document: 1.0.51-0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -21,6 +21,19 @@ import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObj // @ts-ignore import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from './base'; +/** + * + * @export + * @interface GithubSlsRestApiAssumeBrowserResponse + */ +export interface GithubSlsRestApiAssumeBrowserResponse { + /** + * + * @type {string} + * @memberof GithubSlsRestApiAssumeBrowserResponse + */ + 'browserUri': string; +} /** * * @export @@ -127,12 +140,24 @@ export interface GithubSlsRestApiConfigBaseSupportedVersions { * @memberof GithubSlsRestApiConfigBaseSupportedVersions */ 'org'?: string; + /** + * + * @type {string} + * @memberof GithubSlsRestApiConfigBaseSupportedVersions + */ + 'ref'?: string; /** * * @type {string} * @memberof GithubSlsRestApiConfigBaseSupportedVersions */ 'sha'?: string; + /** + * + * @type {string} + * @memberof GithubSlsRestApiConfigBaseSupportedVersions + */ + 'path'?: string; /** * * @type {GithubSlsRestApiSupportedVersions} @@ -158,12 +183,24 @@ export interface GithubSlsRestApiConfigV20220101 { * @memberof GithubSlsRestApiConfigV20220101 */ 'org'?: string; + /** + * + * @type {string} + * @memberof GithubSlsRestApiConfigV20220101 + */ + 'ref'?: string; /** * * @type {string} * @memberof GithubSlsRestApiConfigV20220101 */ 'sha'?: string; + /** + * + * @type {string} + * @memberof GithubSlsRestApiConfigV20220101 + */ + 'path'?: string; /** * * @type {GithubSlsRestApiSupportedVersions} @@ -699,6 +736,92 @@ export interface GithubSlsRestApiOrgRepo { */ 'sk': string; } +/** + * + * @export + * @interface GithubSlsRestApiOrgRepoConfigRefreshResponse + */ +export interface GithubSlsRestApiOrgRepoConfigRefreshResponse { + /** + * + * @type {string} + * @memberof GithubSlsRestApiOrgRepoConfigRefreshResponse + */ + 'repo': string; + /** + * + * @type {string} + * @memberof GithubSlsRestApiOrgRepoConfigRefreshResponse + */ + 'org': string; + /** + * + * @type {string} + * @memberof GithubSlsRestApiOrgRepoConfigRefreshResponse + */ + 'branch'?: string; + /** + * + * @type {string} + * @memberof GithubSlsRestApiOrgRepoConfigRefreshResponse + */ + 'path'?: string; + /** + * + * @type {string} + * @memberof GithubSlsRestApiOrgRepoConfigRefreshResponse + */ + 'sha'?: string; + /** + * + * @type {boolean} + * @memberof GithubSlsRestApiOrgRepoConfigRefreshResponse + */ + 'dryrun': boolean; + /** + * + * @type {GithubSlsRestApiConfigV20220101} + * @memberof GithubSlsRestApiOrgRepoConfigRefreshResponse + */ + 'config': GithubSlsRestApiConfigV20220101; +} +/** + * + * @export + * @interface GithubSlsRestApiOrgRepoConfigRefreshResponseAllOf + */ +export interface GithubSlsRestApiOrgRepoConfigRefreshResponseAllOf { + /** + * + * @type {string} + * @memberof GithubSlsRestApiOrgRepoConfigRefreshResponseAllOf + */ + 'branch'?: string; + /** + * + * @type {string} + * @memberof GithubSlsRestApiOrgRepoConfigRefreshResponseAllOf + */ + 'path'?: string; + /** + * + * @type {string} + * @memberof GithubSlsRestApiOrgRepoConfigRefreshResponseAllOf + */ + 'sha'?: string; + /** + * + * @type {boolean} + * @memberof GithubSlsRestApiOrgRepoConfigRefreshResponseAllOf + */ + 'dryrun': boolean; + /** + * + * @type {GithubSlsRestApiConfigV20220101} + * @memberof GithubSlsRestApiOrgRepoConfigRefreshResponseAllOf + */ + 'config': GithubSlsRestApiConfigV20220101; +} /** * This file was automatically generated by joi-to-typescript Do not modify this file manually * @export @@ -1209,6 +1332,49 @@ export const IDPApiAxiosParamCreator = function (configuration?: Configuration) + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {string} role + * @param {string} [org] + * @param {string} [provider] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + assumeRoleForBrowser: async (role: string, org?: string, provider?: string, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'role' is not null or undefined + assertParamExists('assumeRoleForBrowser', 'role', role) + const localVarPath = `/api/v1/idp/roles/{role}/assume/browser` + .replace(`{${"role"}}`, encodeURIComponent(String(role))); + // 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; + + if (org !== undefined) { + localVarQueryParameter['org'] = org; + } + + if (provider !== undefined) { + localVarQueryParameter['provider'] = provider; + } + + + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -1224,10 +1390,11 @@ export const IDPApiAxiosParamCreator = function (configuration?: Configuration) * @param {string} repo * @param {string} role * @param {string} [provider] + * @param {string} [commitSha] * @param {*} [options] Override http request option. * @throws {RequiredError} */ - assumeRoleForRepo: async (org: string, repo: string, role: string, provider?: string, options: AxiosRequestConfig = {}): Promise => { + assumeRoleForRepo: async (org: string, repo: string, role: string, provider?: string, commitSha?: string, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'org' is not null or undefined assertParamExists('assumeRoleForRepo', 'org', org) // verify required parameter 'repo' is not null or undefined @@ -1257,6 +1424,10 @@ export const IDPApiAxiosParamCreator = function (configuration?: Configuration) localVarQueryParameter['provider'] = provider; } + if (commitSha !== undefined) { + localVarQueryParameter['commitSha'] = commitSha; + } + setSearchParams(localVarUrlObj, localVarQueryParameter); @@ -1539,6 +1710,57 @@ export const IDPApiAxiosParamCreator = function (configuration?: Configuration) + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {string} org + * @param {string} repo + * @param {boolean} [dryrun] + * @param {string} [commitSha] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + refreshOrgRepoConfig: async (org: string, repo: string, dryrun?: boolean, commitSha?: string, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'org' is not null or undefined + assertParamExists('refreshOrgRepoConfig', 'org', org) + // verify required parameter 'repo' is not null or undefined + assertParamExists('refreshOrgRepoConfig', 'repo', repo) + const localVarPath = `/api/v1/idp/orgs/{org}/repos/{repo}/config` + .replace(`{${"org"}}`, encodeURIComponent(String(org))) + .replace(`{${"repo"}}`, encodeURIComponent(String(repo))); + // 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 jwt required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) + + if (dryrun !== undefined) { + localVarQueryParameter['dryrun'] = dryrun; + } + + if (commitSha !== undefined) { + localVarQueryParameter['commitSha'] = commitSha; + } + + + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -1616,17 +1838,30 @@ export const IDPApiFp = function(configuration?: Configuration) { const localVarAxiosArgs = await localVarAxiosParamCreator.assumeRole(role, org, provider, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, + /** + * + * @param {string} role + * @param {string} [org] + * @param {string} [provider] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async assumeRoleForBrowser(role: string, org?: string, provider?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.assumeRoleForBrowser(role, org, provider, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, /** * * @param {string} org * @param {string} repo * @param {string} role * @param {string} [provider] + * @param {string} [commitSha] * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async assumeRoleForRepo(org: string, repo: string, role: string, provider?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.assumeRoleForRepo(org, repo, role, provider, options); + async assumeRoleForRepo(org: string, repo: string, role: string, provider?: string, commitSha?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.assumeRoleForRepo(org, repo, role, provider, commitSha, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** @@ -1704,6 +1939,19 @@ export const IDPApiFp = function(configuration?: Configuration) { const localVarAxiosArgs = await localVarAxiosParamCreator.providerLogin(provider, org, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, + /** + * + * @param {string} org + * @param {string} repo + * @param {boolean} [dryrun] + * @param {string} [commitSha] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async refreshOrgRepoConfig(org: string, repo: string, dryrun?: boolean, commitSha?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.refreshOrgRepoConfig(org, repo, dryrun, commitSha, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, /** * * @param {string} org @@ -1737,17 +1985,29 @@ export const IDPApiFactory = function (configuration?: Configuration, basePath?: assumeRole(role: string, org?: string, provider?: string, options?: any): AxiosPromise { return localVarFp.assumeRole(role, org, provider, options).then((request) => request(axios, basePath)); }, + /** + * + * @param {string} role + * @param {string} [org] + * @param {string} [provider] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + assumeRoleForBrowser(role: string, org?: string, provider?: string, options?: any): AxiosPromise { + return localVarFp.assumeRoleForBrowser(role, org, provider, options).then((request) => request(axios, basePath)); + }, /** * * @param {string} org * @param {string} repo * @param {string} role * @param {string} [provider] + * @param {string} [commitSha] * @param {*} [options] Override http request option. * @throws {RequiredError} */ - assumeRoleForRepo(org: string, repo: string, role: string, provider?: string, options?: any): AxiosPromise { - return localVarFp.assumeRoleForRepo(org, repo, role, provider, options).then((request) => request(axios, basePath)); + assumeRoleForRepo(org: string, repo: string, role: string, provider?: string, commitSha?: string, options?: any): AxiosPromise { + return localVarFp.assumeRoleForRepo(org, repo, role, provider, commitSha, options).then((request) => request(axios, basePath)); }, /** * @@ -1817,6 +2077,18 @@ export const IDPApiFactory = function (configuration?: Configuration, basePath?: providerLogin(provider: string, org?: string, options?: any): AxiosPromise { return localVarFp.providerLogin(provider, org, options).then((request) => request(axios, basePath)); }, + /** + * + * @param {string} org + * @param {string} repo + * @param {boolean} [dryrun] + * @param {string} [commitSha] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + refreshOrgRepoConfig(org: string, repo: string, dryrun?: boolean, commitSha?: string, options?: any): AxiosPromise { + return localVarFp.refreshOrgRepoConfig(org, repo, dryrun, commitSha, options).then((request) => request(axios, basePath)); + }, /** * * @param {string} org @@ -1851,18 +2123,32 @@ export class IDPApi extends BaseAPI { return IDPApiFp(this.configuration).assumeRole(role, org, provider, options).then((request) => request(this.axios, this.basePath)); } + /** + * + * @param {string} role + * @param {string} [org] + * @param {string} [provider] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof IDPApi + */ + public assumeRoleForBrowser(role: string, org?: string, provider?: string, options?: AxiosRequestConfig) { + return IDPApiFp(this.configuration).assumeRoleForBrowser(role, org, provider, options).then((request) => request(this.axios, this.basePath)); + } + /** * * @param {string} org * @param {string} repo * @param {string} role * @param {string} [provider] + * @param {string} [commitSha] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof IDPApi */ - public assumeRoleForRepo(org: string, repo: string, role: string, provider?: string, options?: AxiosRequestConfig) { - return IDPApiFp(this.configuration).assumeRoleForRepo(org, repo, role, provider, options).then((request) => request(this.axios, this.basePath)); + public assumeRoleForRepo(org: string, repo: string, role: string, provider?: string, commitSha?: string, options?: AxiosRequestConfig) { + return IDPApiFp(this.configuration).assumeRoleForRepo(org, repo, role, provider, commitSha, options).then((request) => request(this.axios, this.basePath)); } /** @@ -1947,6 +2233,20 @@ export class IDPApi extends BaseAPI { return IDPApiFp(this.configuration).providerLogin(provider, org, options).then((request) => request(this.axios, this.basePath)); } + /** + * + * @param {string} org + * @param {string} repo + * @param {boolean} [dryrun] + * @param {string} [commitSha] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof IDPApi + */ + public refreshOrgRepoConfig(org: string, repo: string, dryrun?: boolean, commitSha?: string, options?: AxiosRequestConfig) { + return IDPApiFp(this.configuration).refreshOrgRepoConfig(org, repo, dryrun, commitSha, options).then((request) => request(this.axios, this.basePath)); + } + /** * * @param {string} org diff --git a/api/github-sls-rest-api/base.ts b/api/github-sls-rest-api/base.ts index a0b6efd..9bcfb0d 100644 --- a/api/github-sls-rest-api/base.ts +++ b/api/github-sls-rest-api/base.ts @@ -4,7 +4,7 @@ * github-sls-rest-api * To generate a JWT token, go to the JWT Token Generator * - * The version of the OpenAPI document: 1.0.38-8 + * The version of the OpenAPI document: 1.0.51-0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/api/github-sls-rest-api/common.ts b/api/github-sls-rest-api/common.ts index 2ca66f7..a8087ae 100644 --- a/api/github-sls-rest-api/common.ts +++ b/api/github-sls-rest-api/common.ts @@ -4,7 +4,7 @@ * github-sls-rest-api * To generate a JWT token, go to the JWT Token Generator * - * The version of the OpenAPI document: 1.0.38-8 + * The version of the OpenAPI document: 1.0.51-0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/api/github-sls-rest-api/configuration.ts b/api/github-sls-rest-api/configuration.ts index 0c8717f..68fa067 100644 --- a/api/github-sls-rest-api/configuration.ts +++ b/api/github-sls-rest-api/configuration.ts @@ -4,7 +4,7 @@ * github-sls-rest-api * To generate a JWT token, go to the JWT Token Generator * - * The version of the OpenAPI document: 1.0.38-8 + * The version of the OpenAPI document: 1.0.51-0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/api/github-sls-rest-api/index.ts b/api/github-sls-rest-api/index.ts index ff2bf8f..c0c22d4 100644 --- a/api/github-sls-rest-api/index.ts +++ b/api/github-sls-rest-api/index.ts @@ -4,7 +4,7 @@ * github-sls-rest-api * To generate a JWT token, go to the JWT Token Generator * - * The version of the OpenAPI document: 1.0.38-8 + * The version of the OpenAPI document: 1.0.51-0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/api/github-sls-rest-api/version.json b/api/github-sls-rest-api/version.json index 08f7b69..75446ce 100644 --- a/api/github-sls-rest-api/version.json +++ b/api/github-sls-rest-api/version.json @@ -1 +1 @@ -{"version":"1.0.38-8"} \ No newline at end of file +{"version":"1.0.51-0"} \ No newline at end of file diff --git a/src/action.ts b/src/action.ts index fca9672..f5b7f5c 100644 --- a/src/action.ts +++ b/src/action.ts @@ -16,7 +16,7 @@ import { GithubSlsRestApiAwsAssumeSdkOptions, } from '../api/github-sls-rest-api'; -const { GITHUB_TOKEN, GITHUB_REPOSITORY, DEV, API_KEY } = process.env; +const { GITHUB_TOKEN, GITHUB_REPOSITORY, GITHUB_SHA, DEV, API_KEY } = process.env; export class Action { async run(): Promise { @@ -60,6 +60,7 @@ export class Action { repo, role, provider || undefined, + GITHUB_SHA, ); info(`SAML Response generated for login to ${response.provider} via ${response.recipient}`);