aws-sdk#Support TypeScript Examples

The following examples show how to use aws-sdk#Support. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: handlers.ts    From aws-resource-providers with MIT License 6 votes vote down vote up
@handlerEvent(Action.Create)
    @commonAws({ serviceName: 'Support', debug: true })
    public async create(action: Action, args: HandlerArgs<ResourceModel>, service: Support, model: ResourceModel): Promise<ResourceModel> {
        const targetAccountId = args.request.awsAccountId;

        await checkContextIsOrganizationMasterAccount(args);
        await createSupportCase(model, service);

        model.arn = `arn:community:organizations::${targetAccountId}:support/support-level-${model.accountId}`;

        return model;
    }
Example #2
Source File: handlers.ts    From aws-resource-providers with MIT License 6 votes vote down vote up
@handlerEvent(Action.Update)
    @commonAws({ serviceName: 'Support', debug: true })
    public async update(action: Action, args: HandlerArgs<ResourceModel>, service: Support, model: ResourceModel): Promise<ResourceModel> {
        if (args.request.previousResourceState.supportLevel !== args.request.desiredResourceState.supportLevel) {
            await createSupportCase(model, service);
        }

        return model;
    }
Example #3
Source File: handlers.ts    From aws-resource-providers with MIT License 6 votes vote down vote up
export async function createSupportCase(model: ResourceModel, service: Support): Promise<void> {
    if (model.disableSupportCaseCreation) {
        return;
    }

    const createCaseRequest: CreateCaseRequest = {
        subject: `Enable ${model.supportLevel} support for account: ${model.accountId}`,
        communicationBody: `Hi AWS,
        Please enable ${model.supportLevel} on account ${model.accountId}.
        This case was created automatically - please resolve when done.

        Thank you!
            `,
        serviceCode: 'customer-account',
        categoryCode: 'other-account-issues',
        severityCode: 'low',
        issueType: 'customer-service',
        ccEmailAddresses: model.cCEmailAddresses,
    };

    await service.createCase(createCaseRequest).promise();
}
Example #4
Source File: handlers.ts    From aws-resource-providers with MIT License 5 votes vote down vote up
@handlerEvent(Action.Read)
    @commonAws({ serviceName: 'Support', debug: true })
    public async read(action: Action, args: HandlerArgs<ResourceModel>, service: Support, model: ResourceModel): Promise<ResourceModel> {
        const read = new ResourceModel({
            Arn: model.arn,
        });
        return Promise.resolve(read);
    }