public static void Route53CreateAdd(string[] args) { #region Route53CreateAdd string domainName = "www.example.org"; IAmazonRoute53 route53Client = new AmazonRoute53Client(); CreateHostedZoneRequest zoneRequest = new CreateHostedZoneRequest { Name = domainName, CallerReference = "my_change_request" }; CreateHostedZoneResponse zoneResponse = route53Client.CreateHostedZone(zoneRequest); ResourceRecordSet recordSet = new ResourceRecordSet { Name = domainName, TTL = 60, Type = RRType.A, ResourceRecords = new List<ResourceRecord> { new ResourceRecord { Value = "192.0.2.235" } } }; Change change1 = new Change { ResourceRecordSet = recordSet, Action = ChangeAction.CREATE }; ChangeBatch changeBatch = new ChangeBatch { Changes = new List<Change> { change1 } }; ChangeResourceRecordSetsRequest recordsetRequest = new ChangeResourceRecordSetsRequest { HostedZoneId = zoneResponse.HostedZone.Id, ChangeBatch = changeBatch }; ChangeResourceRecordSetsResponse recordsetResponse = route53Client.ChangeResourceRecordSets(recordsetRequest); GetChangeRequest changeRequest = new GetChangeRequest { Id = recordsetResponse.ChangeInfo.Id }; while (route53Client.GetChange(changeRequest).ChangeInfo.Status == ChangeStatus.PENDING) { Console.WriteLine("Change is pending."); Thread.Sleep(TimeSpan.FromSeconds(15)); } #endregion Console.WriteLine("Change is complete."); Console.ReadKey(); }
public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.Route53.Model.GetChangeRequest(); if (cmdletContext.Id != null) { request.Id = cmdletContext.Id; } 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> /// <para> This action returns the current status of a change batch request. The status is one of the following values:</para> <para>- /// <c>PENDING</c> indicates that the changes in this request have not replicated to all Route 53 DNS servers. This is the initial status of all /// change batch requests.</para> <para>- <c>INSYNC</c> indicates that the changes have replicated to all Amazon Route 53 DNS servers. </para> /// </summary> /// /// <param name="getChangeRequest">Container for the necessary parameters to execute the GetChange service method on AmazonRoute53.</param> /// /// <returns>The response from the GetChange service method, as returned by AmazonRoute53.</returns> /// /// <exception cref="T:Amazon.Route53.Model.NoSuchChangeException" /> /// <exception cref="T:Amazon.Route53.Model.InvalidInputException" /> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> public Task<GetChangeResponse> GetChangeAsync(GetChangeRequest getChangeRequest, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new GetChangeRequestMarshaller(); var unmarshaller = GetChangeResponseUnmarshaller.GetInstance(); return Invoke<IRequest, GetChangeRequest, GetChangeResponse>(getChangeRequest, marshaller, unmarshaller, signer, cancellationToken); }
internal GetChangeResponse GetChange(GetChangeRequest request) { var task = GetChangeAsync(request); try { return task.Result; } catch(AggregateException e) { ExceptionDispatchInfo.Capture(e.InnerException).Throw(); return null; } }
/// <summary> /// <para> This action returns the current status of a change batch request. The status is one of the following values:</para> <para>- /// <c>PENDING</c> indicates that the changes in this request have not replicated to all Route 53 DNS servers. This is the initial status of all /// change batch requests.</para> <para>- <c>INSYNC</c> indicates that the changes have replicated to all Amazon Route 53 DNS servers. </para> /// </summary> /// /// <param name="getChangeRequest">Container for the necessary parameters to execute the GetChange service method on AmazonRoute53.</param> /// /// <returns>The response from the GetChange service method, as returned by AmazonRoute53.</returns> /// /// <exception cref="T:Amazon.Route53.Model.NoSuchChangeException" /> /// <exception cref="T:Amazon.Route53.Model.InvalidInputException" /> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> public async Task<GetChangeResponse> GetChangeAsync(GetChangeRequest getChangeRequest, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new GetChangeRequestMarshaller(); var unmarshaller = GetChangeResponseUnmarshaller.GetInstance(); var response = await Invoke<IRequest, GetChangeRequest, GetChangeResponse>(getChangeRequest, marshaller, unmarshaller, signer, cancellationToken) .ConfigureAwait(continueOnCapturedContext: false); return response; }
internal GetChangeResponse GetChange(GetChangeRequest request) { var task = GetChangeAsync(request); try { return task.Result; } catch(AggregateException e) { throw e.InnerException; } }
/// <summary> /// Initiates the asynchronous execution of the GetChange operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the GetChange 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<GetChangeResponse> GetChangeAsync(GetChangeRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new GetChangeRequestMarshaller(); var unmarshaller = GetChangeResponseUnmarshaller.Instance; return InvokeAsync<GetChangeRequest,GetChangeResponse>(request, marshaller, unmarshaller, cancellationToken); }
/// <summary> /// This action returns the current status of a change batch request. The status is one /// of the following values: /// /// /// <para> /// - <code>PENDING</code> indicates that the changes in this request have not replicated /// to all Route 53 DNS servers. This is the initial status of all change batch requests. /// </para> /// /// <para> /// - <code>INSYNC</code> indicates that the changes have replicated to all Amazon Route /// 53 DNS servers. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the GetChange service method.</param> /// /// <returns>The response from the GetChange service method, as returned by Route53.</returns> /// <exception cref="Amazon.Route53.Model.InvalidInputException"> /// Some value specified in the request is invalid or the XML document is malformed. /// </exception> /// <exception cref="Amazon.Route53.Model.NoSuchChangeException"> /// /// </exception> public GetChangeResponse GetChange(GetChangeRequest request) { var marshaller = new GetChangeRequestMarshaller(); var unmarshaller = GetChangeResponseUnmarshaller.Instance; return Invoke<GetChangeRequest,GetChangeResponse>(request, marshaller, unmarshaller); }
/// <summary> /// Initiates the asynchronous execution of the GetChange operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the GetChange operation on AmazonRoute53Client.</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 EndGetChange /// operation.</returns> public IAsyncResult BeginGetChange(GetChangeRequest request, AsyncCallback callback, object state) { var marshaller = new GetChangeRequestMarshaller(); var unmarshaller = GetChangeResponseUnmarshaller.Instance; return BeginInvoke<GetChangeRequest>(request, marshaller, unmarshaller, callback, state); }
IAsyncResult invokeGetChange(GetChangeRequest getChangeRequest, AsyncCallback callback, object state, bool synchronized) { IRequest irequest = new GetChangeRequestMarshaller().Marshall(getChangeRequest); var unmarshaller = GetChangeResponseUnmarshaller.GetInstance(); AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller); Invoke(result); return result; }
/// <summary> /// <para> This action returns the current status of a change batch request. The status is one of the following values:</para> <para>- /// <c>PENDING</c> indicates that the changes in this request have not replicated to all Route 53 DNS servers. This is the initial status of all /// change batch requests.</para> <para>- <c>INSYNC</c> indicates that the changes have replicated to all Amazon Route 53 DNS servers. </para> /// </summary> /// /// <param name="getChangeRequest">Container for the necessary parameters to execute the GetChange service method on AmazonRoute53.</param> /// /// <returns>The response from the GetChange service method, as returned by AmazonRoute53.</returns> /// /// <exception cref="InvalidInputException"/> public GetChangeResponse GetChange(GetChangeRequest getChangeRequest) { IAsyncResult asyncResult = invokeGetChange(getChangeRequest, null, null, true); return EndGetChange(asyncResult); }
/// <summary> /// Initiates the asynchronous execution of the GetChange operation. /// <seealso cref="Amazon.Route53.AmazonRoute53.GetChange"/> /// </summary> /// /// <param name="getChangeRequest">Container for the necessary parameters to execute the GetChange operation on AmazonRoute53.</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 EndGetChange /// operation.</returns> public IAsyncResult BeginGetChange(GetChangeRequest getChangeRequest, AsyncCallback callback, object state) { return invokeGetChange(getChangeRequest, callback, state, false); }
private Amazon.Route53.Model.GetChangeResponse CallAWSServiceOperation(IAmazonRoute53 client, Amazon.Route53.Model.GetChangeRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Route 53", "GetChange"); try { #if DESKTOP return(client.GetChange(request)); #elif CORECLR return(client.GetChangeAsync(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; } }