import { EndpointsInputConfig , EndpointsResolvedConfig , RegionInputConfig , RegionResolvedConfig , resolveEndpointsConfig , resolveRegionConfig , } from "@aws-sdk/config-resolver" ; import { getContentLengthPlugin } from "@aws-sdk/middleware-content-length" ; import { getHostHeaderPlugin , HostHeaderInputConfig , HostHeaderResolvedConfig , resolveHostHeaderConfig , } from "@aws-sdk/middleware-host-header" ; import { getLoggerPlugin } from "@aws-sdk/middleware-logger" ; import { getRetryPlugin , resolveRetryConfig , RetryInputConfig , RetryResolvedConfig } from "@aws-sdk/middleware-retry" ; import { AwsAuthInputConfig , AwsAuthResolvedConfig , getAwsAuthPlugin , resolveAwsAuthConfig , } from "@aws-sdk/middleware-signing" ; import { getUserAgentPlugin , resolveUserAgentConfig , UserAgentInputConfig , UserAgentResolvedConfig , } from "@aws-sdk/middleware-user-agent" ; import { HttpHandler as __HttpHandler } from "@aws-sdk/protocol-http" ; import { Client as __Client , DefaultsMode , SmithyConfiguration as __SmithyConfiguration , SmithyResolvedConfiguration as __SmithyResolvedConfiguration , } from "@aws-sdk/smithy-client" ; import { Credentials as __Credentials , Decoder as __Decoder , Encoder as __Encoder , Hash as __Hash , HashConstructor as __HashConstructor , HttpHandlerOptions as __HttpHandlerOptions , Logger as __Logger , Provider as __Provider , Provider , RegionInfoProvider , StreamCollector as __StreamCollector , UrlParser as __UrlParser , UserAgent as __UserAgent , } from "@aws-sdk/types" ; import { CancelKeyDeletionCommandInput , CancelKeyDeletionCommandOutput } from "./commands/CancelKeyDeletionCommand" ; import { ConnectCustomKeyStoreCommandInput , ConnectCustomKeyStoreCommandOutput , } from "./commands/ConnectCustomKeyStoreCommand" ; import { CreateAliasCommandInput , CreateAliasCommandOutput } from "./commands/CreateAliasCommand" ; import { CreateCustomKeyStoreCommandInput , CreateCustomKeyStoreCommandOutput , } from "./commands/CreateCustomKeyStoreCommand" ; import { CreateGrantCommandInput , CreateGrantCommandOutput } from "./commands/CreateGrantCommand" ; import { CreateKeyCommandInput , CreateKeyCommandOutput } from "./commands/CreateKeyCommand" ; import { DecryptCommandInput , DecryptCommandOutput } from "./commands/DecryptCommand" ; import { DeleteAliasCommandInput , DeleteAliasCommandOutput } from "./commands/DeleteAliasCommand" ; import { DeleteCustomKeyStoreCommandInput , DeleteCustomKeyStoreCommandOutput , } from "./commands/DeleteCustomKeyStoreCommand" ; import { DeleteImportedKeyMaterialCommandInput , DeleteImportedKeyMaterialCommandOutput , } from "./commands/DeleteImportedKeyMaterialCommand" ; import { DescribeCustomKeyStoresCommandInput , DescribeCustomKeyStoresCommandOutput , } from "./commands/DescribeCustomKeyStoresCommand" ; import { DescribeKeyCommandInput , DescribeKeyCommandOutput } from "./commands/DescribeKeyCommand" ; import { DisableKeyCommandInput , DisableKeyCommandOutput } from "./commands/DisableKeyCommand" ; import { DisableKeyRotationCommandInput , DisableKeyRotationCommandOutput } from "./commands/DisableKeyRotationCommand" ; import { DisconnectCustomKeyStoreCommandInput , DisconnectCustomKeyStoreCommandOutput , } from "./commands/DisconnectCustomKeyStoreCommand" ; import { EnableKeyCommandInput , EnableKeyCommandOutput } from "./commands/EnableKeyCommand" ; import { EnableKeyRotationCommandInput , EnableKeyRotationCommandOutput } from "./commands/EnableKeyRotationCommand" ; import { EncryptCommandInput , EncryptCommandOutput } from "./commands/EncryptCommand" ; import { GenerateDataKeyCommandInput , GenerateDataKeyCommandOutput } from "./commands/GenerateDataKeyCommand" ; import { GenerateDataKeyPairCommandInput , GenerateDataKeyPairCommandOutput , } from "./commands/GenerateDataKeyPairCommand" ; import { GenerateDataKeyPairWithoutPlaintextCommandInput , GenerateDataKeyPairWithoutPlaintextCommandOutput , } from "./commands/GenerateDataKeyPairWithoutPlaintextCommand" ; import { GenerateDataKeyWithoutPlaintextCommandInput , GenerateDataKeyWithoutPlaintextCommandOutput , } from "./commands/GenerateDataKeyWithoutPlaintextCommand" ; import { GenerateRandomCommandInput , GenerateRandomCommandOutput } from "./commands/GenerateRandomCommand" ; import { GetKeyPolicyCommandInput , GetKeyPolicyCommandOutput } from "./commands/GetKeyPolicyCommand" ; import { GetKeyRotationStatusCommandInput , GetKeyRotationStatusCommandOutput , } from "./commands/GetKeyRotationStatusCommand" ; import { GetParametersForImportCommandInput , GetParametersForImportCommandOutput , } from "./commands/GetParametersForImportCommand" ; import { GetPublicKeyCommandInput , GetPublicKeyCommandOutput } from "./commands/GetPublicKeyCommand" ; import { ImportKeyMaterialCommandInput , ImportKeyMaterialCommandOutput } from "./commands/ImportKeyMaterialCommand" ; import { ListAliasesCommandInput , ListAliasesCommandOutput } from "./commands/ListAliasesCommand" ; import { ListGrantsCommandInput , ListGrantsCommandOutput } from "./commands/ListGrantsCommand" ; import { ListKeyPoliciesCommandInput , ListKeyPoliciesCommandOutput } from "./commands/ListKeyPoliciesCommand" ; import { ListKeysCommandInput , ListKeysCommandOutput } from "./commands/ListKeysCommand" ; import { ListResourceTagsCommandInput , ListResourceTagsCommandOutput } from "./commands/ListResourceTagsCommand" ; import { ListRetirableGrantsCommandInput , ListRetirableGrantsCommandOutput , } from "./commands/ListRetirableGrantsCommand" ; import { PutKeyPolicyCommandInput , PutKeyPolicyCommandOutput } from "./commands/PutKeyPolicyCommand" ; import { ReEncryptCommandInput , ReEncryptCommandOutput } from "./commands/ReEncryptCommand" ; import { ReplicateKeyCommandInput , ReplicateKeyCommandOutput } from "./commands/ReplicateKeyCommand" ; import { RetireGrantCommandInput , RetireGrantCommandOutput } from "./commands/RetireGrantCommand" ; import { RevokeGrantCommandInput , RevokeGrantCommandOutput } from "./commands/RevokeGrantCommand" ; import { ScheduleKeyDeletionCommandInput , ScheduleKeyDeletionCommandOutput , } from "./commands/ScheduleKeyDeletionCommand" ; import { SignCommandInput , SignCommandOutput } from "./commands/SignCommand" ; import { TagResourceCommandInput , TagResourceCommandOutput } from "./commands/TagResourceCommand" ; import { UntagResourceCommandInput , UntagResourceCommandOutput } from "./commands/UntagResourceCommand" ; import { UpdateAliasCommandInput , UpdateAliasCommandOutput } from "./commands/UpdateAliasCommand" ; import { UpdateCustomKeyStoreCommandInput , UpdateCustomKeyStoreCommandOutput , } from "./commands/UpdateCustomKeyStoreCommand" ; import { UpdateKeyDescriptionCommandInput , UpdateKeyDescriptionCommandOutput , } from "./commands/UpdateKeyDescriptionCommand" ; import { UpdatePrimaryRegionCommandInput , UpdatePrimaryRegionCommandOutput , } from "./commands/UpdatePrimaryRegionCommand" ; import { VerifyCommandInput , VerifyCommandOutput } from "./commands/VerifyCommand" ; import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig" ; export type ServiceInputTypes = CancelKeyDeletionCommandInput | ConnectCustomKeyStoreCommandInput | CreateAliasCommandInput | CreateCustomKeyStoreCommandInput | CreateGrantCommandInput | CreateKeyCommandInput | DecryptCommandInput | DeleteAliasCommandInput | DeleteCustomKeyStoreCommandInput | DeleteImportedKeyMaterialCommandInput | DescribeCustomKeyStoresCommandInput | DescribeKeyCommandInput | DisableKeyCommandInput | DisableKeyRotationCommandInput | DisconnectCustomKeyStoreCommandInput | EnableKeyCommandInput | EnableKeyRotationCommandInput | EncryptCommandInput | GenerateDataKeyCommandInput | GenerateDataKeyPairCommandInput | GenerateDataKeyPairWithoutPlaintextCommandInput | GenerateDataKeyWithoutPlaintextCommandInput | GenerateRandomCommandInput | GetKeyPolicyCommandInput | GetKeyRotationStatusCommandInput | GetParametersForImportCommandInput | GetPublicKeyCommandInput | ImportKeyMaterialCommandInput | ListAliasesCommandInput | ListGrantsCommandInput | ListKeyPoliciesCommandInput | ListKeysCommandInput | ListResourceTagsCommandInput | ListRetirableGrantsCommandInput | PutKeyPolicyCommandInput | ReEncryptCommandInput | ReplicateKeyCommandInput | RetireGrantCommandInput | RevokeGrantCommandInput | ScheduleKeyDeletionCommandInput | SignCommandInput | TagResourceCommandInput | UntagResourceCommandInput | UpdateAliasCommandInput | UpdateCustomKeyStoreCommandInput | UpdateKeyDescriptionCommandInput | UpdatePrimaryRegionCommandInput | VerifyCommandInput ; export type ServiceOutputTypes = CancelKeyDeletionCommandOutput | ConnectCustomKeyStoreCommandOutput | CreateAliasCommandOutput | CreateCustomKeyStoreCommandOutput | CreateGrantCommandOutput | CreateKeyCommandOutput | DecryptCommandOutput | DeleteAliasCommandOutput | DeleteCustomKeyStoreCommandOutput | DeleteImportedKeyMaterialCommandOutput | DescribeCustomKeyStoresCommandOutput | DescribeKeyCommandOutput | DisableKeyCommandOutput | DisableKeyRotationCommandOutput | DisconnectCustomKeyStoreCommandOutput | EnableKeyCommandOutput | EnableKeyRotationCommandOutput | EncryptCommandOutput | GenerateDataKeyCommandOutput | GenerateDataKeyPairCommandOutput | GenerateDataKeyPairWithoutPlaintextCommandOutput | GenerateDataKeyWithoutPlaintextCommandOutput | GenerateRandomCommandOutput | GetKeyPolicyCommandOutput | GetKeyRotationStatusCommandOutput | GetParametersForImportCommandOutput | GetPublicKeyCommandOutput | ImportKeyMaterialCommandOutput | ListAliasesCommandOutput | ListGrantsCommandOutput | ListKeyPoliciesCommandOutput | ListKeysCommandOutput | ListResourceTagsCommandOutput | ListRetirableGrantsCommandOutput | PutKeyPolicyCommandOutput | ReEncryptCommandOutput | ReplicateKeyCommandOutput | RetireGrantCommandOutput | RevokeGrantCommandOutput | ScheduleKeyDeletionCommandOutput | SignCommandOutput | TagResourceCommandOutput | UntagResourceCommandOutput | UpdateAliasCommandOutput | UpdateCustomKeyStoreCommandOutput | UpdateKeyDescriptionCommandOutput | UpdatePrimaryRegionCommandOutput | VerifyCommandOutput ; export interface ClientDefaults extends Partial < __SmithyResolvedConfiguration < __HttpHandlerOptions > > { /**
     * The HTTP handler to use. Fetch in browser and Https in Nodejs.
     */ requestHandler ? : __HttpHandler ; /**
     * A constructor for a class implementing the  __Hash interface
     * that computes the SHA-256 HMAC or checksum of a string or binary buffer.
     *  internal sha256 ? : __HashConstructor ; internal urlParser ? : __UrlParser ; internal bodyLengthChecker ? : ( body : any ) => number | undefined ; internal streamCollector ? : __StreamCollector ; internal base64Decoder ? : __Decoder ; internal base64Encoder ? : __Encoder ; internal utf8Decoder ? : __Decoder ; internal utf8Encoder ? : __Encoder ; internal runtime ? : string ; /**
     * Disable dyanamically changing the endpoint of the client based on the hostPrefix
     * trait of an operation.
     */ disableHostPrefix ? : boolean ; /**
     * Value for how many times a request will be made at most in case of retry.
     */ maxAttempts ? : number | __Provider < number > ; /**
     * Specifies which retry algorithm to use.
     */ retryMode ? : string | __Provider < string > ; /**
     * Optional logger for logging debug/info/warn/error.
     */ logger ? : __Logger ; /**
     * Enables IPv6/IPv4 dualstack endpoint.
     */ useDualstackEndpoint ? : boolean | __Provider < boolean > ; /**
     * Enables FIPS compatible endpoints.
     */ useFipsEndpoint ? : boolean | __Provider < boolean > ; internal serviceId ? : string ; /**
     * The AWS region to which this client will send requests
     */ region ? : string | __Provider < string > ; internal credentialDefaultProvider ? : ( input : any ) => __Provider < __Credentials > ; internal regionInfoProvider ? : RegionInfoProvider ; internal defaultUserAgentProvider ? : Provider < __UserAgent > ; /**
     * The  DefaultsMode that will be used to determine how certain default configuration options are resolved in the SDK.
      defaultsMode ? : DefaultsMode | Provider < DefaultsMode > ; } type KMSClientConfigType = Partial < __SmithyConfiguration < __HttpHandlerOptions > > & ClientDefaults & RegionInputConfig & EndpointsInputConfig & RetryInputConfig & HostHeaderInputConfig & AwsAuthInputConfig & UserAgentInputConfig ; /**
 * The configuration interface of KMSClient class constructor that set the region, credentials and other options.
 */ export interface KMSClientConfig extends KMSClientConfigType { } type KMSClientResolvedConfigType = __SmithyResolvedConfiguration < __HttpHandlerOptions > & Required < ClientDefaults > & RegionResolvedConfig & EndpointsResolvedConfig & RetryResolvedConfig & HostHeaderResolvedConfig & AwsAuthResolvedConfig & UserAgentResolvedConfig ; /**
 * The resolved configuration interface of KMSClient class. This is resolved and normalized from the  KMSClientConfig .
  export interface KMSClientResolvedConfig extends KMSClientResolvedConfigType { } /**
 * <fullname>Key Management Service</fullname>
 *          <p>Key Management Service (KMS) is an encryption and key management web service. This guide describes
 *       the KMS operations that you can call programmatically. For general information about KMS,
 *       see the <a href="https://docs.aws.amazon.com/kms/latest/developerguide/">
 *                <i>Key Management Service Developer Guide</i>
 *             </a>.</p>
 *          <note>
 *             <p>KMS is replacing the term <i>customer master key (CMK)</i> with <i>KMS key</i> and <i>KMS key</i>. The concept has not changed. To prevent breaking changes, KMS is keeping some variations of this term.</p>
 *             <p>Amazon Web Services provides SDKs that consist of libraries and sample code for various programming
 *         languages and platforms (Java, Ruby, .Net, macOS, Android, etc.). The SDKs provide a
 *         convenient way to create programmatic access to KMS and other Amazon Web Services services. For example,
 *         the SDKs take care of tasks such as signing requests (see below), managing errors, and
 *         retrying requests automatically. For more information about the Amazon Web Services SDKs, including how to
 *         download and install them, see <a href="http://aws.amazon.com/tools/">Tools for Amazon Web
 *           Services</a>.</p>
 *          </note>
 *          <p>We recommend that you use the Amazon Web Services SDKs to make programmatic API calls to KMS.</p>
 *          <p>Clients must support TLS (Transport Layer Security) 1.0. We recommend TLS 1.2. Clients
 *       must also support cipher suites with Perfect Forward Secrecy (PFS) such as Ephemeral
 *       Diffie-Hellman (DHE) or Elliptic Curve Ephemeral Diffie-Hellman (ECDHE). Most modern systems
 *       such as Java 7 and later support these modes.</p>
 *          <p>
 *             <b>Signing Requests</b>
 *          </p>
 *          <p>Requests must be signed by using an access key ID and a secret access key. We strongly
 *       recommend that you <i>do not</i> use your Amazon Web Services account (root) access key ID and
 *       secret key for everyday work with KMS. Instead, use the access key ID and secret access key
 *       for an IAM user. You can also use the Amazon Web Services Security Token Service to generate temporary
 *       security credentials that you can use to sign requests.</p>
 *          <p>All KMS operations require <a href="https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html">Signature Version 4</a>.</p>
 *          <p>
 *             <b>Logging API Requests</b>
 *          </p>
 *          <p>KMS supports CloudTrail, a service that logs Amazon Web Services API calls and related events for your
 *       Amazon Web Services account and delivers them to an Amazon S3 bucket that you specify. By using the
 *       information collected by CloudTrail, you can determine what requests were made to KMS, who made
 *       the request, when it was made, and so on. To learn more about CloudTrail, including how to turn it
 *       on and find your log files, see the <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/">CloudTrail User Guide</a>.</p>
 *          <p>
 *             <b>Additional Resources</b>
 *          </p>
 *          <p>For more information about credentials and request signing, see the following:</p>
 *          <ul>
 *             <li>
 *                <p>
 *                   <a href="https://docs.aws.amazon.com/general/latest/gr/aws-security-credentials.html">Amazon Web Services
 *             Security Credentials</a> - This topic provides general information about the types
 *           of credentials used to access Amazon Web Services.</p>
 *             </li>
 *             <li>
 *                <p>
 *                   <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp.html">Temporary
 *             Security Credentials</a> - This section of the <i>IAM User Guide</i>
 *           describes how to create and use temporary security credentials.</p>
 *             </li>
 *             <li>
 *                <p>
 *                   <a href="https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html">Signature Version
 *             4 Signing Process</a> - This set of topics walks you through the process of signing
 *           a request using an access key ID and a secret access key.</p>
 *             </li>
 *          </ul>
 *          <p>
 *             <b>Commonly Used API Operations</b>
 *          </p>
 *          <p>Of the API operations discussed in this guide, the following will prove the most useful
 *       for most applications. You will likely perform operations other than these, such as creating
 *       keys and assigning policies, by using the console.</p>
 *          <ul>
 *             <li>
 *                <p>
 *                   <a>Encrypt</a>
 *                </p>
 *             </li>
 *             <li>
 *                <p>
 *                   <a>Decrypt</a>
 *                </p>
 *             </li>
 *             <li>
 *                <p>
 *                   <a>GenerateDataKey</a>
 *                </p>
 *             </li>
 *             <li>
 *                <p>
 *                   <a>GenerateDataKeyWithoutPlaintext</a>
 *                </p>
 *             </li>
 *          </ul>
 */ export class KMSClient extends __Client < __HttpHandlerOptions , ServiceInputTypes , ServiceOutputTypes , KMSClientResolvedConfig > { /**
     * The resolved configuration of KMSClient class. This is resolved and normalized from the  KMSClientConfig .
      readonly config : KMSClientResolvedConfig ; constructor ( configuration ) { const _config_0 = __getRuntimeConfig ( configuration ) ; const _config_1 = resolveRegionConfig ( _config_0 ) ; const _config_2 = resolveEndpointsConfig ( _config_1 ) ; const _config_3 = resolveRetryConfig ( _config_2 ) ; const _config_4 = resolveHostHeaderConfig ( _config_3 ) ; const _config_5 = resolveAwsAuthConfig ( _config_4 ) ; const _config_6 = resolveUserAgentConfig ( _config_5 ) ; super ( _config_6 ) ; this . config = _config_6 ; this . middlewareStack . use ( getRetryPlugin ( this . config ) ) ; this . middlewareStack . use ( getContentLengthPlugin ( this . config ) ) ; this . middlewareStack . use ( getHostHeaderPlugin ( this . config ) ) ; this . middlewareStack . use ( getLoggerPlugin ( this . config ) ) ; this . middlewareStack . use ( getAwsAuthPlugin ( this . config ) ) ; this . middlewareStack . use ( getUserAgentPlugin ( this . config ) ) ; } /**
     * Destroy underlying resources, like sockets. It's usually not necessary to do this.
     * However in Node.js, it's best to explicitly shut down the client's agent when it is no longer needed.
     * Otherwise, sockets might stay open for quite a long time before the server terminates them.
     */ destroy ( ) { super . destroy ( ) ; } }