UNPKG

@aws-sdk/client-account

Version:

AWS SDK for JavaScript Account Client for Node.js, Browser and React Native

397 lines (370 loc) 15.1 kB
'use strict'; var client$1 = require('@aws-sdk/core/client'); var core = require('@smithy/core'); var client = require('@smithy/core/client'); var config = require('@smithy/core/config'); var endpoints = require('@smithy/core/endpoints'); var protocols = require('@smithy/core/protocols'); var retry = require('@smithy/core/retry'); var schema = require('@smithy/core/schema'); var httpAuthSchemeProvider = require('./auth/httpAuthSchemeProvider'); var runtimeConfig = require('./runtimeConfig'); var schemas_0 = require('./schemas/schemas_0'); var errors = require('./models/errors'); var AccountServiceException = require('./models/AccountServiceException'); const resolveClientEndpointParameters = (options) => { return Object.assign(options, { useDualstackEndpoint: options.useDualstackEndpoint ?? false, useFipsEndpoint: options.useFipsEndpoint ?? false, defaultSigningName: "account", }); }; const commonParams = { UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, Endpoint: { type: "builtInParams", name: "endpoint" }, Region: { type: "builtInParams", name: "region" }, UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" }, }; const getHttpAuthExtensionConfiguration = (runtimeConfig) => { const _httpAuthSchemes = runtimeConfig.httpAuthSchemes; let _httpAuthSchemeProvider = runtimeConfig.httpAuthSchemeProvider; let _credentials = runtimeConfig.credentials; return { setHttpAuthScheme(httpAuthScheme) { const index = _httpAuthSchemes.findIndex((scheme) => scheme.schemeId === httpAuthScheme.schemeId); if (index === -1) { _httpAuthSchemes.push(httpAuthScheme); } else { _httpAuthSchemes.splice(index, 1, httpAuthScheme); } }, httpAuthSchemes() { return _httpAuthSchemes; }, setHttpAuthSchemeProvider(httpAuthSchemeProvider) { _httpAuthSchemeProvider = httpAuthSchemeProvider; }, httpAuthSchemeProvider() { return _httpAuthSchemeProvider; }, setCredentials(credentials) { _credentials = credentials; }, credentials() { return _credentials; }, }; }; const resolveHttpAuthRuntimeConfig = (config) => { return { httpAuthSchemes: config.httpAuthSchemes(), httpAuthSchemeProvider: config.httpAuthSchemeProvider(), credentials: config.credentials(), }; }; const resolveRuntimeExtensions = (runtimeConfig, extensions) => { const extensionConfiguration = Object.assign(client$1.getAwsRegionExtensionConfiguration(runtimeConfig), client.getDefaultExtensionConfiguration(runtimeConfig), protocols.getHttpHandlerExtensionConfiguration(runtimeConfig), getHttpAuthExtensionConfiguration(runtimeConfig)); extensions.forEach((extension) => extension.configure(extensionConfiguration)); return Object.assign(runtimeConfig, client$1.resolveAwsRegionExtensionConfiguration(extensionConfiguration), client.resolveDefaultRuntimeConfig(extensionConfiguration), protocols.resolveHttpHandlerRuntimeConfig(extensionConfiguration), resolveHttpAuthRuntimeConfig(extensionConfiguration)); }; class AccountClient extends client.Client { config; constructor(...[configuration]) { const _config_0 = runtimeConfig.getRuntimeConfig(configuration || {}); super(_config_0); this.initConfig = _config_0; const _config_1 = resolveClientEndpointParameters(_config_0); const _config_2 = client$1.resolveUserAgentConfig(_config_1); const _config_3 = retry.resolveRetryConfig(_config_2); const _config_4 = config.resolveRegionConfig(_config_3); const _config_5 = client$1.resolveHostHeaderConfig(_config_4); const _config_6 = endpoints.resolveEndpointConfig(_config_5); const _config_7 = httpAuthSchemeProvider.resolveHttpAuthSchemeConfig(_config_6); const _config_8 = resolveRuntimeExtensions(_config_7, configuration?.extensions || []); this.config = _config_8; this.middlewareStack.use(schema.getSchemaSerdePlugin(this.config)); this.middlewareStack.use(client$1.getUserAgentPlugin(this.config)); this.middlewareStack.use(retry.getRetryPlugin(this.config)); this.middlewareStack.use(protocols.getContentLengthPlugin(this.config)); this.middlewareStack.use(client$1.getHostHeaderPlugin(this.config)); this.middlewareStack.use(client$1.getLoggerPlugin(this.config)); this.middlewareStack.use(client$1.getRecursionDetectionPlugin(this.config)); this.middlewareStack.use(core.getHttpAuthSchemeEndpointRuleSetPlugin(this.config, { httpAuthSchemeParametersProvider: httpAuthSchemeProvider.defaultAccountHttpAuthSchemeParametersProvider, identityProviderConfigProvider: async (config) => new core.DefaultIdentityProviderConfig({ "aws.auth#sigv4": config.credentials, }), })); this.middlewareStack.use(core.getHttpSigningPlugin(this.config)); } destroy() { super.destroy(); } } class AcceptPrimaryEmailUpdateCommand extends client.Command .classBuilder() .ep(commonParams) .m(function (Command, cs, config, o) { return [endpoints.getEndpointPlugin(config, Command.getEndpointParameterInstructions())]; }) .s("Account", "AcceptPrimaryEmailUpdate", {}) .n("AccountClient", "AcceptPrimaryEmailUpdateCommand") .sc(schemas_0.AcceptPrimaryEmailUpdate$) .build() { } class DeleteAlternateContactCommand extends client.Command .classBuilder() .ep(commonParams) .m(function (Command, cs, config, o) { return [endpoints.getEndpointPlugin(config, Command.getEndpointParameterInstructions())]; }) .s("Account", "DeleteAlternateContact", {}) .n("AccountClient", "DeleteAlternateContactCommand") .sc(schemas_0.DeleteAlternateContact$) .build() { } class DisableRegionCommand extends client.Command .classBuilder() .ep(commonParams) .m(function (Command, cs, config, o) { return [endpoints.getEndpointPlugin(config, Command.getEndpointParameterInstructions())]; }) .s("Account", "DisableRegion", {}) .n("AccountClient", "DisableRegionCommand") .sc(schemas_0.DisableRegion$) .build() { } class EnableRegionCommand extends client.Command .classBuilder() .ep(commonParams) .m(function (Command, cs, config, o) { return [endpoints.getEndpointPlugin(config, Command.getEndpointParameterInstructions())]; }) .s("Account", "EnableRegion", {}) .n("AccountClient", "EnableRegionCommand") .sc(schemas_0.EnableRegion$) .build() { } class GetAccountInformationCommand extends client.Command .classBuilder() .ep(commonParams) .m(function (Command, cs, config, o) { return [endpoints.getEndpointPlugin(config, Command.getEndpointParameterInstructions())]; }) .s("Account", "GetAccountInformation", {}) .n("AccountClient", "GetAccountInformationCommand") .sc(schemas_0.GetAccountInformation$) .build() { } class GetAlternateContactCommand extends client.Command .classBuilder() .ep(commonParams) .m(function (Command, cs, config, o) { return [endpoints.getEndpointPlugin(config, Command.getEndpointParameterInstructions())]; }) .s("Account", "GetAlternateContact", {}) .n("AccountClient", "GetAlternateContactCommand") .sc(schemas_0.GetAlternateContact$) .build() { } class GetContactInformationCommand extends client.Command .classBuilder() .ep(commonParams) .m(function (Command, cs, config, o) { return [endpoints.getEndpointPlugin(config, Command.getEndpointParameterInstructions())]; }) .s("Account", "GetContactInformation", {}) .n("AccountClient", "GetContactInformationCommand") .sc(schemas_0.GetContactInformation$) .build() { } class GetGovCloudAccountInformationCommand extends client.Command .classBuilder() .ep(commonParams) .m(function (Command, cs, config, o) { return [endpoints.getEndpointPlugin(config, Command.getEndpointParameterInstructions())]; }) .s("Account", "GetGovCloudAccountInformation", {}) .n("AccountClient", "GetGovCloudAccountInformationCommand") .sc(schemas_0.GetGovCloudAccountInformation$) .build() { } class GetPrimaryEmailCommand extends client.Command .classBuilder() .ep(commonParams) .m(function (Command, cs, config, o) { return [endpoints.getEndpointPlugin(config, Command.getEndpointParameterInstructions())]; }) .s("Account", "GetPrimaryEmail", {}) .n("AccountClient", "GetPrimaryEmailCommand") .sc(schemas_0.GetPrimaryEmail$) .build() { } class GetRegionOptStatusCommand extends client.Command .classBuilder() .ep(commonParams) .m(function (Command, cs, config, o) { return [endpoints.getEndpointPlugin(config, Command.getEndpointParameterInstructions())]; }) .s("Account", "GetRegionOptStatus", {}) .n("AccountClient", "GetRegionOptStatusCommand") .sc(schemas_0.GetRegionOptStatus$) .build() { } class ListRegionsCommand extends client.Command .classBuilder() .ep(commonParams) .m(function (Command, cs, config, o) { return [endpoints.getEndpointPlugin(config, Command.getEndpointParameterInstructions())]; }) .s("Account", "ListRegions", {}) .n("AccountClient", "ListRegionsCommand") .sc(schemas_0.ListRegions$) .build() { } class PutAccountNameCommand extends client.Command .classBuilder() .ep(commonParams) .m(function (Command, cs, config, o) { return [endpoints.getEndpointPlugin(config, Command.getEndpointParameterInstructions())]; }) .s("Account", "PutAccountName", {}) .n("AccountClient", "PutAccountNameCommand") .sc(schemas_0.PutAccountName$) .build() { } class PutAlternateContactCommand extends client.Command .classBuilder() .ep(commonParams) .m(function (Command, cs, config, o) { return [endpoints.getEndpointPlugin(config, Command.getEndpointParameterInstructions())]; }) .s("Account", "PutAlternateContact", {}) .n("AccountClient", "PutAlternateContactCommand") .sc(schemas_0.PutAlternateContact$) .build() { } class PutContactInformationCommand extends client.Command .classBuilder() .ep(commonParams) .m(function (Command, cs, config, o) { return [endpoints.getEndpointPlugin(config, Command.getEndpointParameterInstructions())]; }) .s("Account", "PutContactInformation", {}) .n("AccountClient", "PutContactInformationCommand") .sc(schemas_0.PutContactInformation$) .build() { } class StartPrimaryEmailUpdateCommand extends client.Command .classBuilder() .ep(commonParams) .m(function (Command, cs, config, o) { return [endpoints.getEndpointPlugin(config, Command.getEndpointParameterInstructions())]; }) .s("Account", "StartPrimaryEmailUpdate", {}) .n("AccountClient", "StartPrimaryEmailUpdateCommand") .sc(schemas_0.StartPrimaryEmailUpdate$) .build() { } const paginateListRegions = core.createPaginator(AccountClient, ListRegionsCommand, "NextToken", "NextToken", "MaxResults"); const commands = { AcceptPrimaryEmailUpdateCommand, DeleteAlternateContactCommand, DisableRegionCommand, EnableRegionCommand, GetAccountInformationCommand, GetAlternateContactCommand, GetContactInformationCommand, GetGovCloudAccountInformationCommand, GetPrimaryEmailCommand, GetRegionOptStatusCommand, ListRegionsCommand, PutAccountNameCommand, PutAlternateContactCommand, PutContactInformationCommand, StartPrimaryEmailUpdateCommand, }; const paginators = { paginateListRegions, }; class Account extends AccountClient { } client.createAggregatedClient(commands, Account, { paginators }); const PrimaryEmailUpdateStatus = { ACCEPTED: "ACCEPTED", PENDING: "PENDING", }; const ValidationExceptionReason = { FIELD_VALIDATION_FAILED: "fieldValidationFailed", INVALID_REGION_OPT_TARGET: "invalidRegionOptTarget", }; const AccountState = { ACTIVE: "ACTIVE", CLOSED: "CLOSED", PENDING_ACTIVATION: "PENDING_ACTIVATION", SUSPENDED: "SUSPENDED", }; const AlternateContactType = { BILLING: "BILLING", OPERATIONS: "OPERATIONS", SECURITY: "SECURITY", }; const AwsAccountState = { ACTIVE: "ACTIVE", CLOSED: "CLOSED", PENDING_ACTIVATION: "PENDING_ACTIVATION", SUSPENDED: "SUSPENDED", }; const RegionOptStatus = { DISABLED: "DISABLED", DISABLING: "DISABLING", ENABLED: "ENABLED", ENABLED_BY_DEFAULT: "ENABLED_BY_DEFAULT", ENABLING: "ENABLING", }; exports.$Command = client.Command; exports.__Client = client.Client; exports.AccountServiceException = AccountServiceException.AccountServiceException; exports.AcceptPrimaryEmailUpdateCommand = AcceptPrimaryEmailUpdateCommand; exports.Account = Account; exports.AccountClient = AccountClient; exports.AccountState = AccountState; exports.AlternateContactType = AlternateContactType; exports.AwsAccountState = AwsAccountState; exports.DeleteAlternateContactCommand = DeleteAlternateContactCommand; exports.DisableRegionCommand = DisableRegionCommand; exports.EnableRegionCommand = EnableRegionCommand; exports.GetAccountInformationCommand = GetAccountInformationCommand; exports.GetAlternateContactCommand = GetAlternateContactCommand; exports.GetContactInformationCommand = GetContactInformationCommand; exports.GetGovCloudAccountInformationCommand = GetGovCloudAccountInformationCommand; exports.GetPrimaryEmailCommand = GetPrimaryEmailCommand; exports.GetRegionOptStatusCommand = GetRegionOptStatusCommand; exports.ListRegionsCommand = ListRegionsCommand; exports.PrimaryEmailUpdateStatus = PrimaryEmailUpdateStatus; exports.PutAccountNameCommand = PutAccountNameCommand; exports.PutAlternateContactCommand = PutAlternateContactCommand; exports.PutContactInformationCommand = PutContactInformationCommand; exports.RegionOptStatus = RegionOptStatus; exports.StartPrimaryEmailUpdateCommand = StartPrimaryEmailUpdateCommand; exports.ValidationExceptionReason = ValidationExceptionReason; exports.paginateListRegions = paginateListRegions; Object.prototype.hasOwnProperty.call(schemas_0, '__proto__') && !Object.prototype.hasOwnProperty.call(exports, '__proto__') && Object.defineProperty(exports, '__proto__', { enumerable: true, value: schemas_0['__proto__'] }); Object.keys(schemas_0).forEach(function (k) { if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = schemas_0[k]; }); Object.prototype.hasOwnProperty.call(errors, '__proto__') && !Object.prototype.hasOwnProperty.call(exports, '__proto__') && Object.defineProperty(exports, '__proto__', { enumerable: true, value: errors['__proto__'] }); Object.keys(errors).forEach(function (k) { if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = errors[k]; });