/******************************************************************************* * Copyright 2012-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"). You may not use * this file except in compliance with the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. * This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. * ***************************************************************************** * * AWS Tools for Windows (TM) PowerShell (TM) * */ using System; using System.Collections.Generic; using System.Linq; using System.Management.Automation; using System.Text; using Amazon.PowerShell.Common; using Amazon.Runtime; using Amazon.PaymentCryptography; using Amazon.PaymentCryptography.Model; namespace Amazon.PowerShell.Cmdlets.PAYCC { /// /// Creates an Amazon Web Services Payment Cryptography key, a logical representation /// of a cryptographic key, that is unique in your account and Amazon Web Services Region. /// You use keys for cryptographic functions such as encryption and decryption. /// /// /// /// In addition to the key material used in cryptographic operations, an Amazon Web Services /// Payment Cryptography key includes metadata such as the key ARN, key usage, key origin, /// creation date, description, and key state. /// /// When you create a key, you specify both immutable and mutable data about the key. /// The immutable data contains key attributes that defines the scope and cryptographic /// operations that you can perform using the key, for example key class (example: SYMMETRIC_KEY), /// key algorithm (example: TDES_2KEY), key usage (example: TR31_P0_PIN_ENCRYPTION_KEY) /// and key modes of use (example: Encrypt). For information about valid /// combinations of key attributes, see Understanding /// key attributes in the Amazon Web Services Payment Cryptography User Guide. /// The mutable data contained within a key includes usage timestamp and key deletion /// timestamp and can be modified after creation. /// /// Amazon Web Services Payment Cryptography binds key attributes to keys using key blocks /// when you store or export them. Amazon Web Services Payment Cryptography stores the /// key contents wrapped and never stores or transmits them in the clear. /// Cross-account use: This operation can't be used across different Amazon Web /// Services accounts. /// Related operations: /// [Cmdlet("New", "PAYCCKey", SupportsShouldProcess = true, ConfirmImpact = ConfirmImpact.Medium)] [OutputType("Amazon.PaymentCryptography.Model.Key")] [AWSCmdlet("Calls the Payment Cryptography Control Plane CreateKey API operation.", Operation = new[] {"CreateKey"}, SelectReturnType = typeof(Amazon.PaymentCryptography.Model.CreateKeyResponse))] [AWSCmdletOutput("Amazon.PaymentCryptography.Model.Key or Amazon.PaymentCryptography.Model.CreateKeyResponse", "This cmdlet returns an Amazon.PaymentCryptography.Model.Key object.", "The service call response (type Amazon.PaymentCryptography.Model.CreateKeyResponse) can also be referenced from properties attached to the cmdlet entry in the $AWSHistory stack." )] public partial class NewPAYCCKeyCmdlet : AmazonPaymentCryptographyClientCmdlet, IExecutor { #region Parameter KeyModesOfUse_Decrypt /// /// /// Specifies whether an Amazon Web Services Payment Cryptography key can be used to decrypt /// data. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [Alias("KeyAttributes_KeyModesOfUse_Decrypt")] public System.Boolean? KeyModesOfUse_Decrypt { get; set; } #endregion #region Parameter KeyModesOfUse_DeriveKey /// /// /// Specifies whether an Amazon Web Services Payment Cryptography key can be used to derive /// new keys. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [Alias("KeyAttributes_KeyModesOfUse_DeriveKey")] public System.Boolean? KeyModesOfUse_DeriveKey { get; set; } #endregion #region Parameter Enabled /// /// /// Specifies whether to enable the key. If the key is enabled, it is activated for use /// within the service. If the key not enabled, then it is created but not activated. /// The default value is enabled. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.Boolean? Enabled { get; set; } #endregion #region Parameter KeyModesOfUse_Encrypt /// /// /// Specifies whether an Amazon Web Services Payment Cryptography key can be used to encrypt /// data. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [Alias("KeyAttributes_KeyModesOfUse_Encrypt")] public System.Boolean? KeyModesOfUse_Encrypt { get; set; } #endregion #region Parameter Exportable /// /// /// Specifies whether the key is exportable from the service. /// /// #if !MODULAR [System.Management.Automation.Parameter(Position = 0, ValueFromPipelineByPropertyName = true, ValueFromPipeline = true)] #else [System.Management.Automation.Parameter(Position = 0, ValueFromPipelineByPropertyName = true, ValueFromPipeline = true, Mandatory = true)] [System.Management.Automation.AllowNull] #endif [Amazon.PowerShell.Common.AWSRequiredParameter] public System.Boolean? Exportable { get; set; } #endregion #region Parameter KeyModesOfUse_Generate /// /// /// Specifies whether an Amazon Web Services Payment Cryptography key can be used to generate /// and verify other card and PIN verification keys. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [Alias("KeyAttributes_KeyModesOfUse_Generate")] public System.Boolean? KeyModesOfUse_Generate { get; set; } #endregion #region Parameter KeyAttributes_KeyAlgorithm /// /// /// The key algorithm to be use during creation of an Amazon Web Services Payment Cryptography /// key.For symmetric keys, Amazon Web Services Payment Cryptography supports AES /// and TDES algorithms. For asymmetric keys, Amazon Web Services Payment /// Cryptography supports RSA and ECC_NIST algorithms. /// /// #if !MODULAR [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] #else [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true)] [System.Management.Automation.AllowNull] #endif [Amazon.PowerShell.Common.AWSRequiredParameter] [AWSConstantClassSource("Amazon.PaymentCryptography.KeyAlgorithm")] public Amazon.PaymentCryptography.KeyAlgorithm KeyAttributes_KeyAlgorithm { get; set; } #endregion #region Parameter KeyCheckValueAlgorithm /// /// /// The algorithm that Amazon Web Services Payment Cryptography uses to calculate the /// key check value (KCV) for DES and AES keys.For DES key, the KCV is computed by encrypting 8 bytes, each with value '00', with /// the key to be checked and retaining the 3 highest order bytes of the encrypted result. /// For AES key, the KCV is computed by encrypting 8 bytes, each with value '01', with /// the key to be checked and retaining the 3 highest order bytes of the encrypted result. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [AWSConstantClassSource("Amazon.PaymentCryptography.KeyCheckValueAlgorithm")] public Amazon.PaymentCryptography.KeyCheckValueAlgorithm KeyCheckValueAlgorithm { get; set; } #endregion #region Parameter KeyAttributes_KeyClass /// /// /// The type of Amazon Web Services Payment Cryptography key to create, which determines /// the classification of the cryptographic method and whether Amazon Web Services Payment /// Cryptography key contains a symmetric key or an asymmetric key pair. /// /// #if !MODULAR [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] #else [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true)] [System.Management.Automation.AllowNull] #endif [Amazon.PowerShell.Common.AWSRequiredParameter] [AWSConstantClassSource("Amazon.PaymentCryptography.KeyClass")] public Amazon.PaymentCryptography.KeyClass KeyAttributes_KeyClass { get; set; } #endregion #region Parameter KeyAttributes_KeyUsage /// /// /// The cryptographic usage of an Amazon Web Services Payment Cryptography key as defined /// in section A.5.2 of the TR-31 spec. /// /// #if !MODULAR [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] #else [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true)] [System.Management.Automation.AllowNull] #endif [Amazon.PowerShell.Common.AWSRequiredParameter] [AWSConstantClassSource("Amazon.PaymentCryptography.KeyUsage")] public Amazon.PaymentCryptography.KeyUsage KeyAttributes_KeyUsage { get; set; } #endregion #region Parameter KeyModesOfUse_NoRestriction /// /// /// Specifies whether an Amazon Web Services Payment Cryptography key has no special restrictions /// other than the restrictions implied by KeyUsage. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [Alias("KeyAttributes_KeyModesOfUse_NoRestrictions")] public System.Boolean? KeyModesOfUse_NoRestriction { get; set; } #endregion #region Parameter KeyModesOfUse_Sign /// /// /// Specifies whether an Amazon Web Services Payment Cryptography key can be used for signing. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [Alias("KeyAttributes_KeyModesOfUse_Sign")] public System.Boolean? KeyModesOfUse_Sign { get; set; } #endregion #region Parameter Tag /// /// /// The tags to attach to the key. Each tag consists of a tag key and a tag value. Both /// the tag key and the tag value are required, but the tag value can be an empty (null) /// string. You can't have more than one tag on an Amazon Web Services Payment Cryptography /// key with the same tag key. To use this parameter, you must have TagResource permission.Don't include confidential or sensitive information in this field. This field may /// be displayed in plaintext in CloudTrail logs and other output.Tagging or untagging an Amazon Web Services Payment Cryptography key can allow or /// deny permission to the key. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [Alias("Tags")] public Amazon.PaymentCryptography.Model.Tag[] Tag { get; set; } #endregion #region Parameter KeyModesOfUse_Unwrap /// /// /// Specifies whether an Amazon Web Services Payment Cryptography key can be used to unwrap /// other keys. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [Alias("KeyAttributes_KeyModesOfUse_Unwrap")] public System.Boolean? KeyModesOfUse_Unwrap { get; set; } #endregion #region Parameter KeyModesOfUse_Verify /// /// /// Specifies whether an Amazon Web Services Payment Cryptography key can be used to verify /// signatures. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [Alias("KeyAttributes_KeyModesOfUse_Verify")] public System.Boolean? KeyModesOfUse_Verify { get; set; } #endregion #region Parameter KeyModesOfUse_Wrap /// /// /// Specifies whether an Amazon Web Services Payment Cryptography key can be used to wrap /// other keys. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [Alias("KeyAttributes_KeyModesOfUse_Wrap")] public System.Boolean? KeyModesOfUse_Wrap { get; set; } #endregion #region Parameter Select /// /// Use the -Select parameter to control the cmdlet output. The default value is 'Key'. /// Specifying -Select '*' will result in the cmdlet returning the whole service response (Amazon.PaymentCryptography.Model.CreateKeyResponse). /// Specifying the name of a property of type Amazon.PaymentCryptography.Model.CreateKeyResponse will result in that property being returned. /// Specifying -Select '^ParameterName' will result in the cmdlet returning the selected cmdlet parameter value. /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public string Select { get; set; } = "Key"; #endregion #region Parameter PassThru /// /// Changes the cmdlet behavior to return the value passed to the Exportable parameter. /// The -PassThru parameter is deprecated, use -Select '^Exportable' instead. This parameter will be removed in a future version. /// [System.Obsolete("The -PassThru parameter is deprecated, use -Select '^Exportable' instead. This parameter will be removed in a future version.")] [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public SwitchParameter PassThru { get; set; } #endregion #region Parameter Force /// /// This parameter overrides confirmation prompts to force /// the cmdlet to continue its operation. This parameter should always /// be used with caution. /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public SwitchParameter Force { get; set; } #endregion protected override void ProcessRecord() { this._AWSSignerType = "v4"; base.ProcessRecord(); var resourceIdentifiersText = FormatParameterValuesForConfirmationMsg(nameof(this.Exportable), MyInvocation.BoundParameters); if (!ConfirmShouldProceed(this.Force.IsPresent, resourceIdentifiersText, "New-PAYCCKey (CreateKey)")) { return; } var context = new CmdletContext(); // allow for manipulation of parameters prior to loading into context PreExecutionContextLoad(context); #pragma warning disable CS0618, CS0612 //A class member was marked with the Obsolete attribute if (ParameterWasBound(nameof(this.Select))) { context.Select = CreateSelectDelegate(Select) ?? throw new System.ArgumentException("Invalid value for -Select parameter.", nameof(this.Select)); if (this.PassThru.IsPresent) { throw new System.ArgumentException("-PassThru cannot be used when -Select is specified.", nameof(this.Select)); } } else if (this.PassThru.IsPresent) { context.Select = (response, cmdlet) => this.Exportable; } #pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute context.Enabled = this.Enabled; context.Exportable = this.Exportable; #if MODULAR if (this.Exportable == null && ParameterWasBound(nameof(this.Exportable))) { WriteWarning("You are passing $null as a value for parameter Exportable which is marked as required. In case you believe this parameter was incorrectly marked as required, report this by opening an issue at https://github.com/aws/aws-tools-for-powershell/issues."); } #endif context.KeyAttributes_KeyAlgorithm = this.KeyAttributes_KeyAlgorithm; #if MODULAR if (this.KeyAttributes_KeyAlgorithm == null && ParameterWasBound(nameof(this.KeyAttributes_KeyAlgorithm))) { WriteWarning("You are passing $null as a value for parameter KeyAttributes_KeyAlgorithm which is marked as required. In case you believe this parameter was incorrectly marked as required, report this by opening an issue at https://github.com/aws/aws-tools-for-powershell/issues."); } #endif context.KeyAttributes_KeyClass = this.KeyAttributes_KeyClass; #if MODULAR if (this.KeyAttributes_KeyClass == null && ParameterWasBound(nameof(this.KeyAttributes_KeyClass))) { WriteWarning("You are passing $null as a value for parameter KeyAttributes_KeyClass which is marked as required. In case you believe this parameter was incorrectly marked as required, report this by opening an issue at https://github.com/aws/aws-tools-for-powershell/issues."); } #endif context.KeyModesOfUse_Decrypt = this.KeyModesOfUse_Decrypt; context.KeyModesOfUse_DeriveKey = this.KeyModesOfUse_DeriveKey; context.KeyModesOfUse_Encrypt = this.KeyModesOfUse_Encrypt; context.KeyModesOfUse_Generate = this.KeyModesOfUse_Generate; context.KeyModesOfUse_NoRestriction = this.KeyModesOfUse_NoRestriction; context.KeyModesOfUse_Sign = this.KeyModesOfUse_Sign; context.KeyModesOfUse_Unwrap = this.KeyModesOfUse_Unwrap; context.KeyModesOfUse_Verify = this.KeyModesOfUse_Verify; context.KeyModesOfUse_Wrap = this.KeyModesOfUse_Wrap; context.KeyAttributes_KeyUsage = this.KeyAttributes_KeyUsage; #if MODULAR if (this.KeyAttributes_KeyUsage == null && ParameterWasBound(nameof(this.KeyAttributes_KeyUsage))) { WriteWarning("You are passing $null as a value for parameter KeyAttributes_KeyUsage which is marked as required. In case you believe this parameter was incorrectly marked as required, report this by opening an issue at https://github.com/aws/aws-tools-for-powershell/issues."); } #endif context.KeyCheckValueAlgorithm = this.KeyCheckValueAlgorithm; if (this.Tag != null) { context.Tag = new List(this.Tag); } // allow further manipulation of loaded context prior to processing PostExecutionContextLoad(context); var output = Execute(context) as CmdletOutput; ProcessOutput(output); } #region IExecutor Members public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.PaymentCryptography.Model.CreateKeyRequest(); if (cmdletContext.Enabled != null) { request.Enabled = cmdletContext.Enabled.Value; } if (cmdletContext.Exportable != null) { request.Exportable = cmdletContext.Exportable.Value; } // populate KeyAttributes var requestKeyAttributesIsNull = true; request.KeyAttributes = new Amazon.PaymentCryptography.Model.KeyAttributes(); Amazon.PaymentCryptography.KeyAlgorithm requestKeyAttributes_keyAttributes_KeyAlgorithm = null; if (cmdletContext.KeyAttributes_KeyAlgorithm != null) { requestKeyAttributes_keyAttributes_KeyAlgorithm = cmdletContext.KeyAttributes_KeyAlgorithm; } if (requestKeyAttributes_keyAttributes_KeyAlgorithm != null) { request.KeyAttributes.KeyAlgorithm = requestKeyAttributes_keyAttributes_KeyAlgorithm; requestKeyAttributesIsNull = false; } Amazon.PaymentCryptography.KeyClass requestKeyAttributes_keyAttributes_KeyClass = null; if (cmdletContext.KeyAttributes_KeyClass != null) { requestKeyAttributes_keyAttributes_KeyClass = cmdletContext.KeyAttributes_KeyClass; } if (requestKeyAttributes_keyAttributes_KeyClass != null) { request.KeyAttributes.KeyClass = requestKeyAttributes_keyAttributes_KeyClass; requestKeyAttributesIsNull = false; } Amazon.PaymentCryptography.KeyUsage requestKeyAttributes_keyAttributes_KeyUsage = null; if (cmdletContext.KeyAttributes_KeyUsage != null) { requestKeyAttributes_keyAttributes_KeyUsage = cmdletContext.KeyAttributes_KeyUsage; } if (requestKeyAttributes_keyAttributes_KeyUsage != null) { request.KeyAttributes.KeyUsage = requestKeyAttributes_keyAttributes_KeyUsage; requestKeyAttributesIsNull = false; } Amazon.PaymentCryptography.Model.KeyModesOfUse requestKeyAttributes_keyAttributes_KeyModesOfUse = null; // populate KeyModesOfUse var requestKeyAttributes_keyAttributes_KeyModesOfUseIsNull = true; requestKeyAttributes_keyAttributes_KeyModesOfUse = new Amazon.PaymentCryptography.Model.KeyModesOfUse(); System.Boolean? requestKeyAttributes_keyAttributes_KeyModesOfUse_keyModesOfUse_Decrypt = null; if (cmdletContext.KeyModesOfUse_Decrypt != null) { requestKeyAttributes_keyAttributes_KeyModesOfUse_keyModesOfUse_Decrypt = cmdletContext.KeyModesOfUse_Decrypt.Value; } if (requestKeyAttributes_keyAttributes_KeyModesOfUse_keyModesOfUse_Decrypt != null) { requestKeyAttributes_keyAttributes_KeyModesOfUse.Decrypt = requestKeyAttributes_keyAttributes_KeyModesOfUse_keyModesOfUse_Decrypt.Value; requestKeyAttributes_keyAttributes_KeyModesOfUseIsNull = false; } System.Boolean? requestKeyAttributes_keyAttributes_KeyModesOfUse_keyModesOfUse_DeriveKey = null; if (cmdletContext.KeyModesOfUse_DeriveKey != null) { requestKeyAttributes_keyAttributes_KeyModesOfUse_keyModesOfUse_DeriveKey = cmdletContext.KeyModesOfUse_DeriveKey.Value; } if (requestKeyAttributes_keyAttributes_KeyModesOfUse_keyModesOfUse_DeriveKey != null) { requestKeyAttributes_keyAttributes_KeyModesOfUse.DeriveKey = requestKeyAttributes_keyAttributes_KeyModesOfUse_keyModesOfUse_DeriveKey.Value; requestKeyAttributes_keyAttributes_KeyModesOfUseIsNull = false; } System.Boolean? requestKeyAttributes_keyAttributes_KeyModesOfUse_keyModesOfUse_Encrypt = null; if (cmdletContext.KeyModesOfUse_Encrypt != null) { requestKeyAttributes_keyAttributes_KeyModesOfUse_keyModesOfUse_Encrypt = cmdletContext.KeyModesOfUse_Encrypt.Value; } if (requestKeyAttributes_keyAttributes_KeyModesOfUse_keyModesOfUse_Encrypt != null) { requestKeyAttributes_keyAttributes_KeyModesOfUse.Encrypt = requestKeyAttributes_keyAttributes_KeyModesOfUse_keyModesOfUse_Encrypt.Value; requestKeyAttributes_keyAttributes_KeyModesOfUseIsNull = false; } System.Boolean? requestKeyAttributes_keyAttributes_KeyModesOfUse_keyModesOfUse_Generate = null; if (cmdletContext.KeyModesOfUse_Generate != null) { requestKeyAttributes_keyAttributes_KeyModesOfUse_keyModesOfUse_Generate = cmdletContext.KeyModesOfUse_Generate.Value; } if (requestKeyAttributes_keyAttributes_KeyModesOfUse_keyModesOfUse_Generate != null) { requestKeyAttributes_keyAttributes_KeyModesOfUse.Generate = requestKeyAttributes_keyAttributes_KeyModesOfUse_keyModesOfUse_Generate.Value; requestKeyAttributes_keyAttributes_KeyModesOfUseIsNull = false; } System.Boolean? requestKeyAttributes_keyAttributes_KeyModesOfUse_keyModesOfUse_NoRestriction = null; if (cmdletContext.KeyModesOfUse_NoRestriction != null) { requestKeyAttributes_keyAttributes_KeyModesOfUse_keyModesOfUse_NoRestriction = cmdletContext.KeyModesOfUse_NoRestriction.Value; } if (requestKeyAttributes_keyAttributes_KeyModesOfUse_keyModesOfUse_NoRestriction != null) { requestKeyAttributes_keyAttributes_KeyModesOfUse.NoRestrictions = requestKeyAttributes_keyAttributes_KeyModesOfUse_keyModesOfUse_NoRestriction.Value; requestKeyAttributes_keyAttributes_KeyModesOfUseIsNull = false; } System.Boolean? requestKeyAttributes_keyAttributes_KeyModesOfUse_keyModesOfUse_Sign = null; if (cmdletContext.KeyModesOfUse_Sign != null) { requestKeyAttributes_keyAttributes_KeyModesOfUse_keyModesOfUse_Sign = cmdletContext.KeyModesOfUse_Sign.Value; } if (requestKeyAttributes_keyAttributes_KeyModesOfUse_keyModesOfUse_Sign != null) { requestKeyAttributes_keyAttributes_KeyModesOfUse.Sign = requestKeyAttributes_keyAttributes_KeyModesOfUse_keyModesOfUse_Sign.Value; requestKeyAttributes_keyAttributes_KeyModesOfUseIsNull = false; } System.Boolean? requestKeyAttributes_keyAttributes_KeyModesOfUse_keyModesOfUse_Unwrap = null; if (cmdletContext.KeyModesOfUse_Unwrap != null) { requestKeyAttributes_keyAttributes_KeyModesOfUse_keyModesOfUse_Unwrap = cmdletContext.KeyModesOfUse_Unwrap.Value; } if (requestKeyAttributes_keyAttributes_KeyModesOfUse_keyModesOfUse_Unwrap != null) { requestKeyAttributes_keyAttributes_KeyModesOfUse.Unwrap = requestKeyAttributes_keyAttributes_KeyModesOfUse_keyModesOfUse_Unwrap.Value; requestKeyAttributes_keyAttributes_KeyModesOfUseIsNull = false; } System.Boolean? requestKeyAttributes_keyAttributes_KeyModesOfUse_keyModesOfUse_Verify = null; if (cmdletContext.KeyModesOfUse_Verify != null) { requestKeyAttributes_keyAttributes_KeyModesOfUse_keyModesOfUse_Verify = cmdletContext.KeyModesOfUse_Verify.Value; } if (requestKeyAttributes_keyAttributes_KeyModesOfUse_keyModesOfUse_Verify != null) { requestKeyAttributes_keyAttributes_KeyModesOfUse.Verify = requestKeyAttributes_keyAttributes_KeyModesOfUse_keyModesOfUse_Verify.Value; requestKeyAttributes_keyAttributes_KeyModesOfUseIsNull = false; } System.Boolean? requestKeyAttributes_keyAttributes_KeyModesOfUse_keyModesOfUse_Wrap = null; if (cmdletContext.KeyModesOfUse_Wrap != null) { requestKeyAttributes_keyAttributes_KeyModesOfUse_keyModesOfUse_Wrap = cmdletContext.KeyModesOfUse_Wrap.Value; } if (requestKeyAttributes_keyAttributes_KeyModesOfUse_keyModesOfUse_Wrap != null) { requestKeyAttributes_keyAttributes_KeyModesOfUse.Wrap = requestKeyAttributes_keyAttributes_KeyModesOfUse_keyModesOfUse_Wrap.Value; requestKeyAttributes_keyAttributes_KeyModesOfUseIsNull = false; } // determine if requestKeyAttributes_keyAttributes_KeyModesOfUse should be set to null if (requestKeyAttributes_keyAttributes_KeyModesOfUseIsNull) { requestKeyAttributes_keyAttributes_KeyModesOfUse = null; } if (requestKeyAttributes_keyAttributes_KeyModesOfUse != null) { request.KeyAttributes.KeyModesOfUse = requestKeyAttributes_keyAttributes_KeyModesOfUse; requestKeyAttributesIsNull = false; } // determine if request.KeyAttributes should be set to null if (requestKeyAttributesIsNull) { request.KeyAttributes = null; } if (cmdletContext.KeyCheckValueAlgorithm != null) { request.KeyCheckValueAlgorithm = cmdletContext.KeyCheckValueAlgorithm; } if (cmdletContext.Tag != null) { request.Tags = cmdletContext.Tag; } CmdletOutput output; // issue call var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint); try { var response = CallAWSServiceOperation(client, request); object pipelineOutput = null; pipelineOutput = cmdletContext.Select(response, this); output = new CmdletOutput { PipelineOutput = pipelineOutput, ServiceResponse = response }; } catch (Exception e) { output = new CmdletOutput { ErrorResponse = e }; } return output; } public ExecutorContext CreateContext() { return new CmdletContext(); } #endregion #region AWS Service Operation Call private Amazon.PaymentCryptography.Model.CreateKeyResponse CallAWSServiceOperation(IAmazonPaymentCryptography client, Amazon.PaymentCryptography.Model.CreateKeyRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Payment Cryptography Control Plane", "CreateKey"); try { #if DESKTOP return client.CreateKey(request); #elif CORECLR return client.CreateKeyAsync(request).GetAwaiter().GetResult(); #else #error "Unknown build edition" #endif } catch (AmazonServiceException exc) { var webException = exc.InnerException as System.Net.WebException; if (webException != null) { throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException); } throw; } } #endregion internal partial class CmdletContext : ExecutorContext { public System.Boolean? Enabled { get; set; } public System.Boolean? Exportable { get; set; } public Amazon.PaymentCryptography.KeyAlgorithm KeyAttributes_KeyAlgorithm { get; set; } public Amazon.PaymentCryptography.KeyClass KeyAttributes_KeyClass { get; set; } public System.Boolean? KeyModesOfUse_Decrypt { get; set; } public System.Boolean? KeyModesOfUse_DeriveKey { get; set; } public System.Boolean? KeyModesOfUse_Encrypt { get; set; } public System.Boolean? KeyModesOfUse_Generate { get; set; } public System.Boolean? KeyModesOfUse_NoRestriction { get; set; } public System.Boolean? KeyModesOfUse_Sign { get; set; } public System.Boolean? KeyModesOfUse_Unwrap { get; set; } public System.Boolean? KeyModesOfUse_Verify { get; set; } public System.Boolean? KeyModesOfUse_Wrap { get; set; } public Amazon.PaymentCryptography.KeyUsage KeyAttributes_KeyUsage { get; set; } public Amazon.PaymentCryptography.KeyCheckValueAlgorithm KeyCheckValueAlgorithm { get; set; } public List Tag { get; set; } public System.Func Select { get; set; } = (response, cmdlet) => response.Key; } } }