diff --git a/src/commands-help/provision.ts b/src/commands-help/provision.ts index e0f99553..7e2219b6 100644 --- a/src/commands-help/provision.ts +++ b/src/commands-help/provision.ts @@ -74,6 +74,10 @@ Examples with CLI: '--ac, --always-allocate-cpu', '[Optional] Specify if always allocate CPU resources to the provisioned instances', ], + [ + '--ag, --always-allocate-gpu', + '[Optional] Specify if always allocate GPU resources to the provisioned instances', + ], [ '--scheduled-actions ', '[Optional] Set the configuration details of scheduled auto scaling.', diff --git a/src/resources/fc/index.ts b/src/resources/fc/index.ts index 08c2c4f5..aa41be4a 100644 --- a/src/resources/fc/index.ts +++ b/src/resources/fc/index.ts @@ -617,7 +617,11 @@ export default class FC extends FC_Client { } } - async listTriggers(functionName: string) { + async listTriggers( + functionName: string, + disable_list_remote_eb_triggers: string, + disable_list_remote_alb_triggers: string, + ) { let nextToken: string; const limit = 10; const triggers: any[] = []; @@ -625,13 +629,18 @@ export default class FC extends FC_Client { while (true) { const request = new ListTriggersRequest({ limit, nextToken }); const runtime = new RuntimeOptions({}); - const headers = {}; + const headers = { + 'x-fc-disable-list-remote-eb-triggers': disable_list_remote_eb_triggers || 'false', + 'x-fc-disable-list-remote-alb-triggers': disable_list_remote_alb_triggers || 'false', + }; + logger.info(`listTriggers headers: ${JSON.stringify(headers, null, 2)}`); const result = await this.fc20230330Client.listTriggersWithOptions( functionName, request, headers, runtime, ); + logger.info(`listTriggers result: ${JSON.stringify(result, null, 2)}`); const { body } = result.toMap(); triggers.push(...body.triggers); if (!body.nextToken) { diff --git a/src/subCommands/remove/index.ts b/src/subCommands/remove/index.ts index ff132e22..4d141efa 100644 --- a/src/subCommands/remove/index.ts +++ b/src/subCommands/remove/index.ts @@ -17,6 +17,8 @@ export default class Remove { private yes = false; private async_invoke_config: boolean; private resources: Record = {}; + private disable_list_remote_eb_triggers: string; + private disable_list_remote_alb_triggers: string; private fcSdk: FC; @@ -26,7 +28,12 @@ export default class Remove { 'assume-yes': 'y', }, boolean: ['function', 'async_invoke_config'], - string: ['function-name', 'region'], + string: [ + 'function-name', + 'region', + 'disable-list-remote-eb-triggers', + 'disable-list-remote-alb-triggers', + ], }); logger.debug(`parse argv: ${JSON.stringify(opts)}`); @@ -37,10 +44,14 @@ export default class Remove { 'assume-yes': yes, 'function-name': functionName, 'async-invoke-config': async_invoke_config, + 'disable-list-remote-eb-triggers': disable_list_remote_eb_triggers, + 'disable-list-remote-alb-triggers': disable_list_remote_alb_triggers, } = opts; const removeAll = !needRemoveFunction && !trigger && !async_invoke_config; this.async_invoke_config = async_invoke_config; + this.disable_list_remote_eb_triggers = disable_list_remote_eb_triggers; + this.disable_list_remote_alb_triggers = disable_list_remote_alb_triggers; this.region = region || _.get(inputs, 'props.region'); logger.debug(`region: ${this.region}`); @@ -261,7 +272,11 @@ export default class Remove { private async getTriggerResource() { let triggers = []; try { - triggers = await this.fcSdk.listTriggers(this.functionName); + triggers = await this.fcSdk.listTriggers( + this.functionName, + this.disable_list_remote_eb_triggers, + this.disable_list_remote_alb_triggers, + ); } catch (ex) { logger.debug( `List function ${this.region}/${this.functionName} triggers error: ${ex.message}`, diff --git a/src/subCommands/sync/index.ts b/src/subCommands/sync/index.ts index 4b939e75..b8fb298e 100644 --- a/src/subCommands/sync/index.ts +++ b/src/subCommands/sync/index.ts @@ -16,6 +16,8 @@ export default class Sync { private fcSdk: FC; private target: string; private qualifier: string; + private disable_list_remote_eb_triggers: string; + private disable_list_remote_alb_triggers: string; constructor(private inputs: IInputs) { const { @@ -23,8 +25,17 @@ export default class Sync { 'function-name': functionName, qualifier, region, + 'disable-list-remote-eb-triggers': disable_list_remote_eb_triggers, + 'disable-list-remote-alb-triggers': disable_list_remote_alb_triggers, } = parseArgv(inputs.args, { - string: ['target-dir', 'function-name', 'qualifier', 'region'], + string: [ + 'target-dir', + 'function-name', + 'qualifier', + 'region', + 'disable-list-remote-eb-triggers', + 'disable-list-remote-alb-triggers', + ], alias: { 'assume-yes': 'y' }, }); @@ -41,6 +52,10 @@ export default class Sync { checkRegion(this.region); this.functionName = functionName || _.get(inputs, 'props.functionName'); logger.debug(`function name: ${this.functionName}`); + this.disable_list_remote_eb_triggers = disable_list_remote_eb_triggers; + logger.debug(`disable_list_remote_eb_triggers: ${disable_list_remote_eb_triggers}`); + this.disable_list_remote_alb_triggers = disable_list_remote_alb_triggers; + logger.debug(`disable_list_remote_alb_triggers: ${disable_list_remote_alb_triggers}`); if (!this.functionName) { throw new Error('Function name not specified, please specify --function-name'); } @@ -55,7 +70,11 @@ export default class Sync { async getTriggers(): Promise { const result: any[] = []; - const triggers = await this.fcSdk.listTriggers(this.functionName); + const triggers = await this.fcSdk.listTriggers( + this.functionName, + this.disable_list_remote_eb_triggers, + this.disable_list_remote_alb_triggers, + ); logger.debug(triggers); for (const t of triggers) { const { triggerName, triggerType, description, qualifier, invocationRole, sourceArn } = t;