/******************************************************************************* * 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.OpsWorks; using Amazon.OpsWorks.Model; namespace Amazon.PowerShell.Cmdlets.OPS { /// /// Creates a new stack. For more information, see Create /// a New Stack. /// /// /// Required Permissions: To use this action, an IAM user must have an attached /// policy that explicitly grants permissions. For more information about user permissions, /// see Managing /// User Permissions. /// /// [Cmdlet("New", "OPSStack", SupportsShouldProcess = true, ConfirmImpact = ConfirmImpact.Medium)] [OutputType("System.String")] [AWSCmdlet("Calls the AWS OpsWorks CreateStack API operation.", Operation = new[] {"CreateStack"}, SelectReturnType = typeof(Amazon.OpsWorks.Model.CreateStackResponse))] [AWSCmdletOutput("System.String or Amazon.OpsWorks.Model.CreateStackResponse", "This cmdlet returns a System.String object.", "The service call response (type Amazon.OpsWorks.Model.CreateStackResponse) can also be referenced from properties attached to the cmdlet entry in the $AWSHistory stack." )] public partial class NewOPSStackCmdlet : AmazonOpsWorksClientCmdlet, IExecutor { #region Parameter AgentVersion /// /// /// The default AWS OpsWorks Stacks agent version. You have the following options:The default setting is the most recent release of the agent. To specify an agent version, /// you must use the complete version number, not the abbreviated number shown on the /// console. For a list of available agent version numbers, call DescribeAgentVersions. /// AgentVersion cannot be set to Chef 12.2.You can also specify an agent version when you create or update an instance, which /// overrides the stack's default setting. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String AgentVersion { get; set; } #endregion #region Parameter Attribute /// /// /// One or more user-defined key-value pairs to be added to the stack attributes. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [Alias("Attributes")] public System.Collections.Hashtable Attribute { get; set; } #endregion #region Parameter ChefConfiguration_BerkshelfVersion /// /// /// The Berkshelf version. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String ChefConfiguration_BerkshelfVersion { get; set; } #endregion #region Parameter CustomJson /// /// /// A string that contains user-defined, custom JSON. It can be used to override the corresponding /// default stack configuration attribute values or to pass data to recipes. The string /// should be in the following format:"{\"key1\": \"value1\", \"key2\": \"value2\",...}"For more information about custom JSON, see Use /// Custom JSON to Modify the Stack Configuration Attributes. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String CustomJson { get; set; } #endregion #region Parameter DefaultAvailabilityZone /// /// /// The stack's default Availability Zone, which must be in the specified region. For /// more information, see Regions /// and Endpoints. If you also specify a value for DefaultSubnetId, the /// subnet must be in the same zone. For more information, see the VpcId /// parameter description. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String DefaultAvailabilityZone { get; set; } #endregion #region Parameter DefaultInstanceProfileArn /// /// /// The Amazon Resource Name (ARN) of an IAM profile that is the default profile for all /// of the stack's EC2 instances. For more information about IAM ARNs, see Using /// Identifiers. /// /// #if !MODULAR [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] #else [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true)] [System.Management.Automation.AllowEmptyString] [System.Management.Automation.AllowNull] #endif [Amazon.PowerShell.Common.AWSRequiredParameter] public System.String DefaultInstanceProfileArn { get; set; } #endregion #region Parameter DefaultOs /// /// /// The stack's default operating system, which is installed on every instance unless /// you specify a different operating system when you create the instance. You can specify /// one of the following.The default option is the current Amazon Linux version. For more information about /// supported operating systems, see AWS /// OpsWorks Stacks Operating Systems. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String DefaultOs { get; set; } #endregion #region Parameter DefaultRootDeviceType /// /// /// The default root device type. This value is the default for all instances in the stack, /// but you can override it when you create an instance. The default option is instance-store. /// For more information, see Storage /// for the Root Device. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [AWSConstantClassSource("Amazon.OpsWorks.RootDeviceType")] public Amazon.OpsWorks.RootDeviceType DefaultRootDeviceType { get; set; } #endregion #region Parameter DefaultSshKeyName /// /// /// A default Amazon EC2 key pair name. The default value is none. If you specify a key /// pair name, AWS OpsWorks installs the public key on the instance and you can use the /// private key with an SSH client to log in to the instance. For more information, see /// /// Using SSH to Communicate with an Instance and /// Managing SSH Access. You can override this setting by specifying a different key /// pair, or no key pair, when you /// create an instance. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String DefaultSshKeyName { get; set; } #endregion #region Parameter DefaultSubnetId /// /// /// The stack's default VPC subnet ID. This parameter is required if you specify a value /// for the VpcId parameter. All instances are launched into this subnet /// unless you specify otherwise when you create the instance. If you also specify a value /// for DefaultAvailabilityZone, the subnet must be in that zone. For information /// on default values and when this parameter is required, see the VpcId /// parameter description. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String DefaultSubnetId { get; set; } #endregion #region Parameter HostnameTheme /// /// /// The stack's host name theme, with spaces replaced by underscores. The theme is used /// to generate host names for the stack's instances. By default, HostnameTheme /// is set to Layer_Dependent, which creates host names by appending integers /// to the layer's short name. The other themes are:To obtain a generated host name, call GetHostNameSuggestion, which returns /// a host name based on the current theme. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String HostnameTheme { get; set; } #endregion #region Parameter ChefConfiguration_ManageBerkshelf /// /// /// Whether to enable Berkshelf. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.Boolean? ChefConfiguration_ManageBerkshelf { get; set; } #endregion #region Parameter ConfigurationManager_Name /// /// /// The name. This parameter must be set to "Chef". /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String ConfigurationManager_Name { get; set; } #endregion #region Parameter Name /// /// /// The stack name. /// /// #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.AllowEmptyString] [System.Management.Automation.AllowNull] #endif [Amazon.PowerShell.Common.AWSRequiredParameter] public System.String Name { get; set; } #endregion #region Parameter CustomCookbooksSource_Password /// /// /// When included in a request, the parameter depends on the repository type.For more information on how to safely handle IAM credentials, see https://docs.aws.amazon.com/general/latest/gr/aws-access-keys-best-practices.html.In responses, AWS OpsWorks Stacks returns *****FILTERED***** instead /// of the actual value. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String CustomCookbooksSource_Password { get; set; } #endregion #region Parameter StackRegion /// /// /// The stack's AWS region, such as ap-south-1. For more information about /// Amazon regions, see Regions /// and Endpoints.In the AWS CLI, this API maps to the --stack-region parameter. If the /// --stack-region parameter and the AWS CLI common parameter --region /// are set to the same value, the stack uses a regional endpoint. If the --stack-region /// parameter is not set, but the AWS CLI --region parameter is, this also /// results in a stack with a regional endpoint. However, if the --region /// parameter is set to us-east-1, and the --stack-region parameter /// is set to one of the following, then the stack uses a legacy or classic region: /// us-west-1, us-west-2, sa-east-1, eu-central-1, eu-west-1, ap-northeast-1, ap-southeast-1, /// ap-southeast-2. In this case, the actual API endpoint of the stack is in us-east-1. /// Only the preceding regions are supported as classic regions in the us-east-1 /// API endpoint. Because it is a best practice to choose the regional endpoint that is /// closest to where you manage AWS, we recommend that you use regional endpoints for /// new stacks. The AWS CLI common --region parameter always specifies a /// regional API endpoint; it cannot be used to specify a classic AWS OpsWorks Stacks /// region. /// /// #if !MODULAR [System.Management.Automation.Parameter(Position = 1, ValueFromPipelineByPropertyName = true)] #else [System.Management.Automation.Parameter(Position = 1, ValueFromPipelineByPropertyName = true, Mandatory = true)] [System.Management.Automation.AllowEmptyString] [System.Management.Automation.AllowNull] #endif [Amazon.PowerShell.Common.AWSRequiredParameter] public System.String StackRegion { get; set; } #endregion #region Parameter CustomCookbooksSource_Revision /// /// /// The application's version. AWS OpsWorks Stacks enables you to easily deploy new versions /// of an application. One of the simplest approaches is to have branches or revisions /// in your repository that represent different versions that can potentially be deployed. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String CustomCookbooksSource_Revision { get; set; } #endregion #region Parameter ServiceRoleArn /// /// /// The stack's AWS Identity and Access Management (IAM) role, which allows AWS OpsWorks /// Stacks to work with AWS resources on your behalf. You must set this parameter to the /// Amazon Resource Name (ARN) for an existing IAM role. For more information about IAM /// ARNs, see Using /// Identifiers. /// /// #if !MODULAR [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] #else [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true)] [System.Management.Automation.AllowEmptyString] [System.Management.Automation.AllowNull] #endif [Amazon.PowerShell.Common.AWSRequiredParameter] public System.String ServiceRoleArn { get; set; } #endregion #region Parameter CustomCookbooksSource_SshKey /// /// /// In requests, the repository's SSH key.In responses, AWS OpsWorks Stacks returns *****FILTERED***** instead /// of the actual value. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String CustomCookbooksSource_SshKey { get; set; } #endregion #region Parameter CustomCookbooksSource_Type /// /// /// The repository type. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [AWSConstantClassSource("Amazon.OpsWorks.SourceType")] public Amazon.OpsWorks.SourceType CustomCookbooksSource_Type { get; set; } #endregion #region Parameter CustomCookbooksSource_Url /// /// /// The source URL. The following is an example of an Amazon S3 source URL: https://s3.amazonaws.com/opsworks-demo-bucket/opsworks_cookbook_demo.tar.gz. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String CustomCookbooksSource_Url { get; set; } #endregion #region Parameter UseCustomCookbook /// /// /// Whether the stack uses custom cookbooks. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [Alias("UseCustomCookbooks")] public System.Boolean? UseCustomCookbook { get; set; } #endregion #region Parameter UseOpsworksSecurityGroup /// /// /// Whether to associate the AWS OpsWorks Stacks built-in security groups with the stack's /// layers.AWS OpsWorks Stacks provides a standard set of built-in security groups, one for each /// layer, which are associated with layers by default. With UseOpsworksSecurityGroups /// you can instead provide your own custom security groups. UseOpsworksSecurityGroups /// has the following settings: For more information, see Create /// a New Stack. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [Alias("UseOpsworksSecurityGroups")] public System.Boolean? UseOpsworksSecurityGroup { get; set; } #endregion #region Parameter CustomCookbooksSource_Username /// /// /// This parameter depends on the repository type. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String CustomCookbooksSource_Username { get; set; } #endregion #region Parameter ConfigurationManager_Version /// /// /// The Chef version. This parameter must be set to 12, 11.10, or 11.4 for Linux stacks, /// and to 12.2 for Windows stacks. The default value for Linux stacks is 11.4. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String ConfigurationManager_Version { get; set; } #endregion #region Parameter VpcId /// /// /// The ID of the VPC that the stack is to be launched into. The VPC must be in the stack's /// region. All instances are launched into this VPC. You cannot change the ID later.If the VPC ID corresponds to a default VPC and you have specified either the DefaultAvailabilityZone /// or the DefaultSubnetId parameter only, AWS OpsWorks Stacks infers the /// value of the other parameter. If you specify neither parameter, AWS OpsWorks Stacks /// sets these parameters to the first valid Availability Zone for the specified region /// and the corresponding default VPC subnet ID, respectively.If you specify a nondefault VPC ID, note the following:For more information about how to use AWS OpsWorks Stacks with a VPC, see Running /// a Stack in a VPC. For more information about default VPC and EC2-Classic, see /// Supported /// Platforms. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String VpcId { get; set; } #endregion #region Parameter Select /// /// Use the -Select parameter to control the cmdlet output. The default value is 'StackId'. /// Specifying -Select '*' will result in the cmdlet returning the whole service response (Amazon.OpsWorks.Model.CreateStackResponse). /// Specifying the name of a property of type Amazon.OpsWorks.Model.CreateStackResponse 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; } = "StackId"; #endregion #region Parameter PassThru /// /// Changes the cmdlet behavior to return the value passed to the Name parameter. /// The -PassThru parameter is deprecated, use -Select '^Name' instead. This parameter will be removed in a future version. /// [System.Obsolete("The -PassThru parameter is deprecated, use -Select '^Name' 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.Name), MyInvocation.BoundParameters); if (!ConfirmShouldProceed(this.Force.IsPresent, resourceIdentifiersText, "New-OPSStack (CreateStack)")) { 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.Name; } #pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute context.AgentVersion = this.AgentVersion; if (this.Attribute != null) { context.Attribute = new Dictionary(StringComparer.Ordinal); foreach (var hashKey in this.Attribute.Keys) { context.Attribute.Add((String)hashKey, (String)(this.Attribute[hashKey])); } } context.ChefConfiguration_BerkshelfVersion = this.ChefConfiguration_BerkshelfVersion; context.ChefConfiguration_ManageBerkshelf = this.ChefConfiguration_ManageBerkshelf; context.ConfigurationManager_Name = this.ConfigurationManager_Name; context.ConfigurationManager_Version = this.ConfigurationManager_Version; context.CustomCookbooksSource_Password = this.CustomCookbooksSource_Password; context.CustomCookbooksSource_Revision = this.CustomCookbooksSource_Revision; context.CustomCookbooksSource_SshKey = this.CustomCookbooksSource_SshKey; context.CustomCookbooksSource_Type = this.CustomCookbooksSource_Type; context.CustomCookbooksSource_Url = this.CustomCookbooksSource_Url; context.CustomCookbooksSource_Username = this.CustomCookbooksSource_Username; context.CustomJson = this.CustomJson; context.DefaultAvailabilityZone = this.DefaultAvailabilityZone; context.DefaultInstanceProfileArn = this.DefaultInstanceProfileArn; #if MODULAR if (this.DefaultInstanceProfileArn == null && ParameterWasBound(nameof(this.DefaultInstanceProfileArn))) { WriteWarning("You are passing $null as a value for parameter DefaultInstanceProfileArn 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.DefaultOs = this.DefaultOs; context.DefaultRootDeviceType = this.DefaultRootDeviceType; context.DefaultSshKeyName = this.DefaultSshKeyName; context.DefaultSubnetId = this.DefaultSubnetId; context.HostnameTheme = this.HostnameTheme; context.Name = this.Name; #if MODULAR if (this.Name == null && ParameterWasBound(nameof(this.Name))) { WriteWarning("You are passing $null as a value for parameter Name 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.StackRegion = this.StackRegion; #if MODULAR if (this.StackRegion == null && ParameterWasBound(nameof(this.StackRegion))) { WriteWarning("You are passing $null as a value for parameter StackRegion 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.ServiceRoleArn = this.ServiceRoleArn; #if MODULAR if (this.ServiceRoleArn == null && ParameterWasBound(nameof(this.ServiceRoleArn))) { WriteWarning("You are passing $null as a value for parameter ServiceRoleArn 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.UseCustomCookbook = this.UseCustomCookbook; context.UseOpsworksSecurityGroup = this.UseOpsworksSecurityGroup; context.VpcId = this.VpcId; // 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.OpsWorks.Model.CreateStackRequest(); if (cmdletContext.AgentVersion != null) { request.AgentVersion = cmdletContext.AgentVersion; } if (cmdletContext.Attribute != null) { request.Attributes = cmdletContext.Attribute; } // populate ChefConfiguration var requestChefConfigurationIsNull = true; request.ChefConfiguration = new Amazon.OpsWorks.Model.ChefConfiguration(); System.String requestChefConfiguration_chefConfiguration_BerkshelfVersion = null; if (cmdletContext.ChefConfiguration_BerkshelfVersion != null) { requestChefConfiguration_chefConfiguration_BerkshelfVersion = cmdletContext.ChefConfiguration_BerkshelfVersion; } if (requestChefConfiguration_chefConfiguration_BerkshelfVersion != null) { request.ChefConfiguration.BerkshelfVersion = requestChefConfiguration_chefConfiguration_BerkshelfVersion; requestChefConfigurationIsNull = false; } System.Boolean? requestChefConfiguration_chefConfiguration_ManageBerkshelf = null; if (cmdletContext.ChefConfiguration_ManageBerkshelf != null) { requestChefConfiguration_chefConfiguration_ManageBerkshelf = cmdletContext.ChefConfiguration_ManageBerkshelf.Value; } if (requestChefConfiguration_chefConfiguration_ManageBerkshelf != null) { request.ChefConfiguration.ManageBerkshelf = requestChefConfiguration_chefConfiguration_ManageBerkshelf.Value; requestChefConfigurationIsNull = false; } // determine if request.ChefConfiguration should be set to null if (requestChefConfigurationIsNull) { request.ChefConfiguration = null; } // populate ConfigurationManager var requestConfigurationManagerIsNull = true; request.ConfigurationManager = new Amazon.OpsWorks.Model.StackConfigurationManager(); System.String requestConfigurationManager_configurationManager_Name = null; if (cmdletContext.ConfigurationManager_Name != null) { requestConfigurationManager_configurationManager_Name = cmdletContext.ConfigurationManager_Name; } if (requestConfigurationManager_configurationManager_Name != null) { request.ConfigurationManager.Name = requestConfigurationManager_configurationManager_Name; requestConfigurationManagerIsNull = false; } System.String requestConfigurationManager_configurationManager_Version = null; if (cmdletContext.ConfigurationManager_Version != null) { requestConfigurationManager_configurationManager_Version = cmdletContext.ConfigurationManager_Version; } if (requestConfigurationManager_configurationManager_Version != null) { request.ConfigurationManager.Version = requestConfigurationManager_configurationManager_Version; requestConfigurationManagerIsNull = false; } // determine if request.ConfigurationManager should be set to null if (requestConfigurationManagerIsNull) { request.ConfigurationManager = null; } // populate CustomCookbooksSource var requestCustomCookbooksSourceIsNull = true; request.CustomCookbooksSource = new Amazon.OpsWorks.Model.Source(); System.String requestCustomCookbooksSource_customCookbooksSource_Password = null; if (cmdletContext.CustomCookbooksSource_Password != null) { requestCustomCookbooksSource_customCookbooksSource_Password = cmdletContext.CustomCookbooksSource_Password; } if (requestCustomCookbooksSource_customCookbooksSource_Password != null) { request.CustomCookbooksSource.Password = requestCustomCookbooksSource_customCookbooksSource_Password; requestCustomCookbooksSourceIsNull = false; } System.String requestCustomCookbooksSource_customCookbooksSource_Revision = null; if (cmdletContext.CustomCookbooksSource_Revision != null) { requestCustomCookbooksSource_customCookbooksSource_Revision = cmdletContext.CustomCookbooksSource_Revision; } if (requestCustomCookbooksSource_customCookbooksSource_Revision != null) { request.CustomCookbooksSource.Revision = requestCustomCookbooksSource_customCookbooksSource_Revision; requestCustomCookbooksSourceIsNull = false; } System.String requestCustomCookbooksSource_customCookbooksSource_SshKey = null; if (cmdletContext.CustomCookbooksSource_SshKey != null) { requestCustomCookbooksSource_customCookbooksSource_SshKey = cmdletContext.CustomCookbooksSource_SshKey; } if (requestCustomCookbooksSource_customCookbooksSource_SshKey != null) { request.CustomCookbooksSource.SshKey = requestCustomCookbooksSource_customCookbooksSource_SshKey; requestCustomCookbooksSourceIsNull = false; } Amazon.OpsWorks.SourceType requestCustomCookbooksSource_customCookbooksSource_Type = null; if (cmdletContext.CustomCookbooksSource_Type != null) { requestCustomCookbooksSource_customCookbooksSource_Type = cmdletContext.CustomCookbooksSource_Type; } if (requestCustomCookbooksSource_customCookbooksSource_Type != null) { request.CustomCookbooksSource.Type = requestCustomCookbooksSource_customCookbooksSource_Type; requestCustomCookbooksSourceIsNull = false; } System.String requestCustomCookbooksSource_customCookbooksSource_Url = null; if (cmdletContext.CustomCookbooksSource_Url != null) { requestCustomCookbooksSource_customCookbooksSource_Url = cmdletContext.CustomCookbooksSource_Url; } if (requestCustomCookbooksSource_customCookbooksSource_Url != null) { request.CustomCookbooksSource.Url = requestCustomCookbooksSource_customCookbooksSource_Url; requestCustomCookbooksSourceIsNull = false; } System.String requestCustomCookbooksSource_customCookbooksSource_Username = null; if (cmdletContext.CustomCookbooksSource_Username != null) { requestCustomCookbooksSource_customCookbooksSource_Username = cmdletContext.CustomCookbooksSource_Username; } if (requestCustomCookbooksSource_customCookbooksSource_Username != null) { request.CustomCookbooksSource.Username = requestCustomCookbooksSource_customCookbooksSource_Username; requestCustomCookbooksSourceIsNull = false; } // determine if request.CustomCookbooksSource should be set to null if (requestCustomCookbooksSourceIsNull) { request.CustomCookbooksSource = null; } if (cmdletContext.CustomJson != null) { request.CustomJson = cmdletContext.CustomJson; } if (cmdletContext.DefaultAvailabilityZone != null) { request.DefaultAvailabilityZone = cmdletContext.DefaultAvailabilityZone; } if (cmdletContext.DefaultInstanceProfileArn != null) { request.DefaultInstanceProfileArn = cmdletContext.DefaultInstanceProfileArn; } if (cmdletContext.DefaultOs != null) { request.DefaultOs = cmdletContext.DefaultOs; } if (cmdletContext.DefaultRootDeviceType != null) { request.DefaultRootDeviceType = cmdletContext.DefaultRootDeviceType; } if (cmdletContext.DefaultSshKeyName != null) { request.DefaultSshKeyName = cmdletContext.DefaultSshKeyName; } if (cmdletContext.DefaultSubnetId != null) { request.DefaultSubnetId = cmdletContext.DefaultSubnetId; } if (cmdletContext.HostnameTheme != null) { request.HostnameTheme = cmdletContext.HostnameTheme; } if (cmdletContext.Name != null) { request.Name = cmdletContext.Name; } if (cmdletContext.StackRegion != null) { request.Region = cmdletContext.StackRegion; } if (cmdletContext.ServiceRoleArn != null) { request.ServiceRoleArn = cmdletContext.ServiceRoleArn; } if (cmdletContext.UseCustomCookbook != null) { request.UseCustomCookbooks = cmdletContext.UseCustomCookbook.Value; } if (cmdletContext.UseOpsworksSecurityGroup != null) { request.UseOpsworksSecurityGroups = cmdletContext.UseOpsworksSecurityGroup.Value; } if (cmdletContext.VpcId != null) { request.VpcId = cmdletContext.VpcId; } 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.OpsWorks.Model.CreateStackResponse CallAWSServiceOperation(IAmazonOpsWorks client, Amazon.OpsWorks.Model.CreateStackRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS OpsWorks", "CreateStack"); try { #if DESKTOP return client.CreateStack(request); #elif CORECLR return client.CreateStackAsync(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.String AgentVersion { get; set; } public Dictionary Attribute { get; set; } public System.String ChefConfiguration_BerkshelfVersion { get; set; } public System.Boolean? ChefConfiguration_ManageBerkshelf { get; set; } public System.String ConfigurationManager_Name { get; set; } public System.String ConfigurationManager_Version { get; set; } public System.String CustomCookbooksSource_Password { get; set; } public System.String CustomCookbooksSource_Revision { get; set; } public System.String CustomCookbooksSource_SshKey { get; set; } public Amazon.OpsWorks.SourceType CustomCookbooksSource_Type { get; set; } public System.String CustomCookbooksSource_Url { get; set; } public System.String CustomCookbooksSource_Username { get; set; } public System.String CustomJson { get; set; } public System.String DefaultAvailabilityZone { get; set; } public System.String DefaultInstanceProfileArn { get; set; } public System.String DefaultOs { get; set; } public Amazon.OpsWorks.RootDeviceType DefaultRootDeviceType { get; set; } public System.String DefaultSshKeyName { get; set; } public System.String DefaultSubnetId { get; set; } public System.String HostnameTheme { get; set; } public System.String Name { get; set; } public System.String StackRegion { get; set; } public System.String ServiceRoleArn { get; set; } public System.Boolean? UseCustomCookbook { get; set; } public System.Boolean? UseOpsworksSecurityGroup { get; set; } public System.String VpcId { get; set; } public System.Func Select { get; set; } = (response, cmdlet) => response.StackId; } } }