public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.EC2.Model.ModifyIdFormatRequest(); if (cmdletContext.Resource != null) { request.Resource = cmdletContext.Resource; } if (cmdletContext.UseLongId != null) { request.UseLongIds = cmdletContext.UseLongId.Value; } 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); }
/// <summary> /// Initiates the asynchronous execution of the ModifyIdFormat operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the ModifyIdFormat operation on AmazonEC2Client.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndModifyIdFormat /// operation.</returns> public IAsyncResult BeginModifyIdFormat(ModifyIdFormatRequest request, AsyncCallback callback, object state) { var marshaller = new ModifyIdFormatRequestMarshaller(); var unmarshaller = ModifyIdFormatResponseUnmarshaller.Instance; return BeginInvoke<ModifyIdFormatRequest>(request, marshaller, unmarshaller, callback, state); }
/// <summary> /// Modifies the ID format for the specified resource on a per-region basis. You can specify /// that resources should receive longer IDs (17-character IDs) when they are created. /// The following resource types support longer IDs: <code>instance</code> | <code>reservation</code> /// | <code>snapshot</code> | <code>volume</code>. /// /// /// <para> /// This setting applies to the IAM user who makes the request; it does not apply to the /// entire AWS account. By default, an IAM user defaults to the same settings as the root /// user. If you're using this action as the root user, then these settings apply to the /// entire account, unless an IAM user explicitly overrides these settings for themselves. /// For more information, see <a href="http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/resource-ids.html">Resource /// IDs</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>. /// </para> /// /// <para> /// Resources created with longer IDs are visible to all IAM roles and users, regardless /// of these settings and provided that they have permission to use the relevant <code>Describe</code> /// command for the resource type. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the ModifyIdFormat service method.</param> /// /// <returns>The response from the ModifyIdFormat service method, as returned by EC2.</returns> public ModifyIdFormatResponse ModifyIdFormat(ModifyIdFormatRequest request) { var marshaller = new ModifyIdFormatRequestMarshaller(); var unmarshaller = ModifyIdFormatResponseUnmarshaller.Instance; return Invoke<ModifyIdFormatRequest,ModifyIdFormatResponse>(request, marshaller, unmarshaller); }
/// <summary> /// Initiates the asynchronous execution of the ModifyIdFormat operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the ModifyIdFormat operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> public Task<ModifyIdFormatResponse> ModifyIdFormatAsync(ModifyIdFormatRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new ModifyIdFormatRequestMarshaller(); var unmarshaller = ModifyIdFormatResponseUnmarshaller.Instance; return InvokeAsync<ModifyIdFormatRequest,ModifyIdFormatResponse>(request, marshaller, unmarshaller, cancellationToken); }
private Amazon.EC2.Model.ModifyIdFormatResponse CallAWSServiceOperation(IAmazonEC2 client, Amazon.EC2.Model.ModifyIdFormatRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Elastic Compute Cloud (EC2)", "ModifyIdFormat"); try { #if DESKTOP return(client.ModifyIdFormat(request)); #elif CORECLR return(client.ModifyIdFormatAsync(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; } }