/// <summary> /// The ResetImageAttribute operation resets an attribute of an AMI to its default /// value. /// Note: /// The productCodes attribute cannot be reset. /// /// </summary> /// <param name="service">Instance of AmazonEC2 service</param> /// <param name="request">ResetImageAttributeRequest request</param> public static void InvokeResetImageAttribute(AmazonEC2 service, ResetImageAttributeRequest request) { try { ResetImageAttributeResponse response = service.ResetImageAttribute(request); Console.WriteLine ("Service Response"); Console.WriteLine ("============================================================================="); Console.WriteLine (); Console.WriteLine(" ResetImageAttributeResponse"); if (response.IsSetResponseMetadata()) { Console.WriteLine(" ResponseMetadata"); ResponseMetadata responseMetadata = response.ResponseMetadata; if (responseMetadata.IsSetRequestId()) { Console.WriteLine(" RequestId"); Console.WriteLine(" {0}", responseMetadata.RequestId); } } } catch (AmazonEC2Exception ex) { Console.WriteLine("Caught Exception: " + ex.Message); Console.WriteLine("Response Status Code: " + ex.StatusCode); Console.WriteLine("Error Code: " + ex.ErrorCode); Console.WriteLine("Error Type: " + ex.ErrorType); Console.WriteLine("Request ID: " + ex.RequestId); Console.WriteLine("XML: " + ex.XML); } }
protected override void ProcessRecord() { AmazonEC2 client = base.GetClient(); Amazon.EC2.Model.ResetImageAttributeRequest request = new Amazon.EC2.Model.ResetImageAttributeRequest(); request.ImageId = this._ImageId; request.Attribute = this._Attribute; Amazon.EC2.Model.ResetImageAttributeResponse response = client.ResetImageAttribute(request); }
public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.EC2.Model.ResetImageAttributeRequest(); if (cmdletContext.Attribute != null) { request.Attribute = cmdletContext.Attribute; } if (cmdletContext.ImageId != null) { request.ImageId = cmdletContext.ImageId; } 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 ResetImageAttribute operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the ResetImageAttribute 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<ResetImageAttributeResponse> ResetImageAttributeAsync(ResetImageAttributeRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new ResetImageAttributeRequestMarshaller(); var unmarshaller = ResetImageAttributeResponseUnmarshaller.Instance; return InvokeAsync<ResetImageAttributeRequest,ResetImageAttributeResponse>(request, marshaller, unmarshaller, cancellationToken); }
/// <summary> /// Resets an attribute of an AMI to its default value. /// /// <note> /// <para> /// The productCodes attribute can't be reset. /// </para> /// </note> /// </summary> /// <param name="request">Container for the necessary parameters to execute the ResetImageAttribute service method.</param> /// /// <returns>The response from the ResetImageAttribute service method, as returned by EC2.</returns> public ResetImageAttributeResponse ResetImageAttribute(ResetImageAttributeRequest request) { var marshaller = new ResetImageAttributeRequestMarshaller(); var unmarshaller = ResetImageAttributeResponseUnmarshaller.Instance; return Invoke<ResetImageAttributeRequest,ResetImageAttributeResponse>(request, marshaller, unmarshaller); }
/// <summary> /// Initiates the asynchronous execution of the ResetImageAttribute operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the ResetImageAttribute 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 EndResetImageAttribute /// operation.</returns> public IAsyncResult BeginResetImageAttribute(ResetImageAttributeRequest request, AsyncCallback callback, object state) { var marshaller = new ResetImageAttributeRequestMarshaller(); var unmarshaller = ResetImageAttributeResponseUnmarshaller.Instance; return BeginInvoke<ResetImageAttributeRequest>(request, marshaller, unmarshaller, callback, state); }
IAsyncResult invokeResetImageAttribute(ResetImageAttributeRequest resetImageAttributeRequest, AsyncCallback callback, object state, bool synchronized) { IRequest irequest = new ResetImageAttributeRequestMarshaller().Marshall(resetImageAttributeRequest); var unmarshaller = ResetImageAttributeResponseUnmarshaller.GetInstance(); AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller); Invoke(result); return result; }
/// <summary> /// Initiates the asynchronous execution of the ResetImageAttribute operation. /// <seealso cref="Amazon.EC2.IAmazonEC2.ResetImageAttribute"/> /// </summary> /// /// <param name="resetImageAttributeRequest">Container for the necessary parameters to execute the ResetImageAttribute operation on /// AmazonEC2.</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> public IAsyncResult BeginResetImageAttribute(ResetImageAttributeRequest resetImageAttributeRequest, AsyncCallback callback, object state) { return invokeResetImageAttribute(resetImageAttributeRequest, callback, state, false); }
/// <summary> /// <para>Resets an attribute of an AMI to its default value.</para> /// </summary> /// /// <param name="resetImageAttributeRequest">Container for the necessary parameters to execute the ResetImageAttribute service method on /// AmazonEC2.</param> /// public ResetImageAttributeResponse ResetImageAttribute(ResetImageAttributeRequest resetImageAttributeRequest) { IAsyncResult asyncResult = invokeResetImageAttribute(resetImageAttributeRequest, null, null, true); return EndResetImageAttribute(asyncResult); }
/// <summary> /// <para>Resets an attribute of an AMI to its default value.</para> /// </summary> /// /// <param name="resetImageAttributeRequest">Container for the necessary parameters to execute the ResetImageAttribute service method on /// AmazonEC2.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> public Task<ResetImageAttributeResponse> ResetImageAttributeAsync(ResetImageAttributeRequest resetImageAttributeRequest, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new ResetImageAttributeRequestMarshaller(); var unmarshaller = ResetImageAttributeResponseUnmarshaller.GetInstance(); return Invoke<IRequest, ResetImageAttributeRequest, ResetImageAttributeResponse>(resetImageAttributeRequest, marshaller, unmarshaller, signer, cancellationToken); }
internal ResetImageAttributeResponse ResetImageAttribute(ResetImageAttributeRequest request) { var task = ResetImageAttributeAsync(request); try { return task.Result; } catch(AggregateException e) { ExceptionDispatchInfo.Capture(e.InnerException).Throw(); return null; } }
/// <summary> /// Initiates the asynchronous execution of the ResetImageAttribute operation. /// <seealso cref="Amazon.EC2.IAmazonEC2.ResetImageAttribute"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the ResetImageAttribute 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 async Task<ResetImageAttributeResponse> ResetImageAttributeAsync(ResetImageAttributeRequest request, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new ResetImageAttributeRequestMarshaller(); var unmarshaller = ResetImageAttributeResponseUnmarshaller.GetInstance(); var response = await Invoke<IRequest, ResetImageAttributeRequest, ResetImageAttributeResponse>(request, marshaller, unmarshaller, signer, cancellationToken) .ConfigureAwait(continueOnCapturedContext: false); return response; }
/// <summary> /// <para> The ResetImageAttribute operation resets an attribute of an AMI to its default value. </para> <para><b>NOTE:</b> The productCodes /// attribute cannot be reset. </para> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the ResetImageAttribute service method on /// AmazonEC2.</param> public ResetImageAttributeResponse ResetImageAttribute(ResetImageAttributeRequest request) { var task = ResetImageAttributeAsync(request); try { return task.Result; } catch(AggregateException e) { throw e.InnerException; } }
private Amazon.EC2.Model.ResetImageAttributeResponse CallAWSServiceOperation(IAmazonEC2 client, Amazon.EC2.Model.ResetImageAttributeRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Elastic Compute Cloud (EC2)", "ResetImageAttribute"); try { #if DESKTOP return(client.ResetImageAttribute(request)); #elif CORECLR return(client.ResetImageAttributeAsync(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; } }