protected override void ProcessRecord() { base.ProcessRecord(); var resourceIdentifiersText = FormatParameterValuesForConfirmationMsg(nameof(this.InstanceEventWindowId), MyInvocation.BoundParameters); if (!ConfirmShouldProceed(this.Force.IsPresent, resourceIdentifiersText, "Register-EC2InstanceEventWindow (AssociateInstanceEventWindow)")) { 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 <Amazon.EC2.Model.AssociateInstanceEventWindowResponse, RegisterEC2InstanceEventWindowCmdlet>(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.InstanceEventWindowId; } #pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute if (this.AssociationTarget_DedicatedHostId != null) { context.AssociationTarget_DedicatedHostId = new List <System.String>(this.AssociationTarget_DedicatedHostId); } if (this.AssociationTarget_InstanceId != null) { context.AssociationTarget_InstanceId = AmazonEC2Helper.InstanceParamToIDs(this.AssociationTarget_InstanceId); } if (this.AssociationTarget_InstanceTag != null) { context.AssociationTarget_InstanceTag = new List <Amazon.EC2.Model.Tag>(this.AssociationTarget_InstanceTag); } context.InstanceEventWindowId = this.InstanceEventWindowId; #if MODULAR if (this.InstanceEventWindowId == null && ParameterWasBound(nameof(this.InstanceEventWindowId))) { WriteWarning("You are passing $null as a value for parameter InstanceEventWindowId 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 // allow further manipulation of loaded context prior to processing PostExecutionContextLoad(context); var output = Execute(context) as CmdletOutput; ProcessOutput(output); }
protected override void ProcessRecord() { base.ProcessRecord(); 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 <Amazon.EC2.Model.DescribeInstanceStatusResponse, GetEC2InstanceStatusCmdlet>(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.InstanceId; } #pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute if (this.Filter != null) { context.Filter = new List <Amazon.EC2.Model.Filter>(this.Filter); } context.IncludeAllInstance = this.IncludeAllInstance; if (this.InstanceId != null) { context.InstanceId = AmazonEC2Helper.InstanceParamToIDs(this.InstanceId); } context.MaxResult = this.MaxResult; #if !MODULAR if (ParameterWasBound(nameof(this.MaxResult)) && this.MaxResult.HasValue) { WriteWarning("AWSPowerShell and AWSPowerShell.NetCore use the MaxResult parameter to limit the total number of items returned by the cmdlet." + " This behavior is obsolete and will be removed in a future version of these modules. Pipe the output of this cmdlet into Select-Object -First to terminate" + " retrieving data pages early and control the number of items returned. AWS.Tools already implements the new behavior of simply passing MaxResult" + " to the service to specify how many items should be returned by each service call."); } #endif context.NextToken = this.NextToken; // allow further manipulation of loaded context prior to processing PostExecutionContextLoad(context); var output = Execute(context) as CmdletOutput; ProcessOutput(output); }
protected override void ProcessRecord() { base.ProcessRecord(); var resourceIdentifiersText = FormatParameterValuesForConfirmationMsg(nameof(this.InstanceId), MyInvocation.BoundParameters); if (!ConfirmShouldProceed(this.Force.IsPresent, resourceIdentifiersText, "Stop-EC2Instance (StopInstances)")) { 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 <Amazon.EC2.Model.StopInstancesResponse, StopEC2InstanceCmdlet>(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.InstanceId; } #pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute context.Enforce = this.Enforce; context.Hibernate = this.Hibernate; if (this.InstanceId != null) { context.InstanceId = AmazonEC2Helper.InstanceParamToIDs(this.InstanceId); } // allow further manipulation of loaded context prior to processing PostExecutionContextLoad(context); var output = Execute(context) as CmdletOutput; ProcessOutput(output); }
protected override void ProcessRecord() { base.ProcessRecord(); 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 <Amazon.EC2.Model.DescribeInstancesResponse, GetEC2InstanceCmdlet>(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.InstanceId; } #pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute if (this.Filter != null) { context.Filter = new List <Amazon.EC2.Model.Filter>(this.Filter); } if (this.InstanceId != null) { context.InstanceId = AmazonEC2Helper.InstanceParamToIDs(this.InstanceId); } context.MaxResult = this.MaxResult; context.NextToken = this.NextToken; // allow further manipulation of loaded context prior to processing PostExecutionContextLoad(context); var output = Execute(context) as CmdletOutput; ProcessOutput(output); }