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(); }
/// <summary> /// <para> This action creates a new hosted zone.</para> <para>To create a new hosted zone, send a <c>POST</c> request to the /// <c>2013-04-01/hostedzone</c> resource. The request body must include an XML document with a <c>CreateHostedZoneRequest</c> element. The /// response returns the <c>CreateHostedZoneResponse</c> element that contains metadata about the hosted zone.</para> <para>Route 53 /// automatically creates a default SOA record and four NS records for the zone. The NS records in the hosted zone are the name servers you give /// your registrar to delegate your domain to. For more information about SOA and NS records, see <a href="http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/SOA-NSrecords.html">NS and SOA Records that Route 53 Creates for a Hosted /// Zone</a> in the <i>Amazon Route 53 Developer Guide</i> .</para> <para>When you create a zone, its initial status is <c>PENDING</c> . This /// means that it is not yet available on all DNS servers. The status of the zone changes to <c>INSYNC</c> when the NS and SOA records are /// available on all Route 53 DNS servers. </para> /// </summary> /// /// <param name="createHostedZoneRequest">Container for the necessary parameters to execute the CreateHostedZone service method on /// AmazonRoute53.</param> /// /// <returns>The response from the CreateHostedZone service method, as returned by AmazonRoute53.</returns> /// /// <exception cref="T:Amazon.Route53.Model.TooManyHostedZonesException" /> /// <exception cref="T:Amazon.Route53.Model.DelegationSetNotAvailableException" /> /// <exception cref="T:Amazon.Route53.Model.InvalidDomainNameException" /> /// <exception cref="T:Amazon.Route53.Model.InvalidInputException" /> /// <exception cref="T:Amazon.Route53.Model.HostedZoneAlreadyExistsException" /> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> public Task<CreateHostedZoneResponse> CreateHostedZoneAsync(CreateHostedZoneRequest createHostedZoneRequest, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new CreateHostedZoneRequestMarshaller(); var unmarshaller = CreateHostedZoneResponseUnmarshaller.GetInstance(); return Invoke<IRequest, CreateHostedZoneRequest, CreateHostedZoneResponse>(createHostedZoneRequest, marshaller, unmarshaller, signer, cancellationToken); }
internal CreateHostedZoneResponse CreateHostedZone(CreateHostedZoneRequest request) { var task = CreateHostedZoneAsync(request); try { return task.Result; } catch(AggregateException e) { ExceptionDispatchInfo.Capture(e.InnerException).Throw(); return null; } }
/// <summary> /// <para> This action creates a new hosted zone.</para> <para>To create a new hosted zone, send a <c>POST</c> request to the /// <c>2012-12-12/hostedzone</c> resource. The request body must include an XML document with a <c>CreateHostedZoneRequest</c> element. The /// response returns the <c>CreateHostedZoneResponse</c> element that contains metadata about the hosted zone.</para> <para>Route 53 /// automatically creates a default SOA record and four NS records for the zone. The NS records in the hosted zone are the name servers you give /// your registrar to delegate your domain to. For more information about SOA and NS records, see <a href="http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/SOA-NSrecords.html">NS and SOA Records that Route 53 Creates for a Hosted /// Zone</a> in the <i>Amazon Route 53 Developer Guide</i> .</para> <para>When you create a zone, its initial status is <c>PENDING</c> . This /// means that it is not yet available on all DNS servers. The status of the zone changes to <c>INSYNC</c> when the NS and SOA records are /// available on all Route 53 DNS servers. </para> /// </summary> /// /// <param name="createHostedZoneRequest">Container for the necessary parameters to execute the CreateHostedZone service method on /// AmazonRoute53.</param> /// /// <returns>The response from the CreateHostedZone service method, as returned by AmazonRoute53.</returns> /// /// <exception cref="T:Amazon.Route53.Model.HostedZoneAlreadyExistsException" /> /// <exception cref="T:Amazon.Route53.Model.InvalidInputException" /> /// <exception cref="T:Amazon.Route53.Model.InvalidDomainNameException" /> /// <exception cref="T:Amazon.Route53.Model.TooManyHostedZonesException" /> /// <exception cref="T:Amazon.Route53.Model.DelegationSetNotAvailableException" /> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> public async Task<CreateHostedZoneResponse> CreateHostedZoneAsync(CreateHostedZoneRequest createHostedZoneRequest, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new CreateHostedZoneRequestMarshaller(); var unmarshaller = CreateHostedZoneResponseUnmarshaller.GetInstance(); var response = await Invoke<IRequest, CreateHostedZoneRequest, CreateHostedZoneResponse>(createHostedZoneRequest, marshaller, unmarshaller, signer, cancellationToken) .ConfigureAwait(continueOnCapturedContext: false); return response; }
internal CreateHostedZoneResponse CreateHostedZone(CreateHostedZoneRequest request) { var task = CreateHostedZoneAsync(request); try { return task.Result; } catch(AggregateException e) { throw e.InnerException; } }
/// <summary> /// Initiates the asynchronous execution of the CreateHostedZone operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateHostedZone 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<CreateHostedZoneResponse> CreateHostedZoneAsync(CreateHostedZoneRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new CreateHostedZoneRequestMarshaller(); var unmarshaller = CreateHostedZoneResponseUnmarshaller.Instance; return InvokeAsync<CreateHostedZoneRequest,CreateHostedZoneResponse>(request, marshaller, unmarshaller, cancellationToken); }
/// <summary> /// This action creates a new hosted zone. /// /// /// <para> /// To create a new hosted zone, send a <code>POST</code> request to the <code>2013-04-01/hostedzone</code> /// resource. The request body must include an XML document with a <code>CreateHostedZoneRequest</code> /// element. The response returns the <code>CreateHostedZoneResponse</code> element that /// contains metadata about the hosted zone. /// </para> /// /// <para> /// Route 53 automatically creates a default SOA record and four NS records for the zone. /// The NS records in the hosted zone are the name servers you give your registrar to /// delegate your domain to. For more information about SOA and NS records, see <a href="http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/SOA-NSrecords.html">NS /// and SOA Records that Route 53 Creates for a Hosted Zone</a> in the <i>Amazon Route /// 53 Developer Guide</i>. /// </para> /// /// <para> /// When you create a zone, its initial status is <code>PENDING</code>. This means that /// it is not yet available on all DNS servers. The status of the zone changes to <code>INSYNC</code> /// when the NS and SOA records are available on all Route 53 DNS servers. /// </para> /// /// <para> /// When trying to create a hosted zone using a reusable delegation set, you could specify /// an optional DelegationSetId, and Route53 would assign those 4 NS records for the zone, /// instead of alloting a new one. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the CreateHostedZone service method.</param> /// /// <returns>The response from the CreateHostedZone service method, as returned by Route53.</returns> /// <exception cref="Amazon.Route53.Model.ConflictingDomainExistsException"> /// /// </exception> /// <exception cref="Amazon.Route53.Model.DelegationSetNotAvailableException"> /// Route 53 allows some duplicate domain names, but there is a maximum number of duplicate /// names. This error indicates that you have reached that maximum. If you want to create /// another hosted zone with the same name and Route 53 generates this error, you can /// request an increase to the limit on the <a href="http://aws.amazon.com/route53-request/">Contact /// Us</a> page. /// </exception> /// <exception cref="Amazon.Route53.Model.DelegationSetNotReusableException"> /// The specified delegation set has not been marked as reusable. /// </exception> /// <exception cref="Amazon.Route53.Model.HostedZoneAlreadyExistsException"> /// The hosted zone you are trying to create already exists. Route 53 returns this error /// when a hosted zone has already been created with the specified <code>CallerReference</code>. /// </exception> /// <exception cref="Amazon.Route53.Model.InvalidDomainNameException"> /// This error indicates that the specified domain name is not valid. /// </exception> /// <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.InvalidVPCIdException"> /// The hosted zone you are trying to create for your VPC_ID does not belong to you. Route /// 53 returns this error when the VPC specified by <code>VPCId</code> does not belong /// to you. /// </exception> /// <exception cref="Amazon.Route53.Model.NoSuchDelegationSetException"> /// The specified delegation set does not exist. /// </exception> /// <exception cref="Amazon.Route53.Model.TooManyHostedZonesException"> /// This error indicates that you've reached the maximum number of hosted zones that can /// be created for the current AWS account. You can request an increase to the limit on /// the <a href="http://aws.amazon.com/route53-request/">Contact Us</a> page. /// </exception> public CreateHostedZoneResponse CreateHostedZone(CreateHostedZoneRequest request) { var marshaller = new CreateHostedZoneRequestMarshaller(); var unmarshaller = CreateHostedZoneResponseUnmarshaller.Instance; return Invoke<CreateHostedZoneRequest,CreateHostedZoneResponse>(request, marshaller, unmarshaller); }
private Amazon.Route53.Model.CreateHostedZoneResponse CallAWSServiceOperation(IAmazonRoute53 client, Amazon.Route53.Model.CreateHostedZoneRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Route 53", "CreateHostedZone"); try { #if DESKTOP return(client.CreateHostedZone(request)); #elif CORECLR return(client.CreateHostedZoneAsync(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; } }
public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.Route53.Model.CreateHostedZoneRequest(); if (cmdletContext.Name != null) { request.Name = cmdletContext.Name; } // populate VPC var requestVPCIsNull = true; request.VPC = new Amazon.Route53.Model.VPC(); Amazon.Route53.VPCRegion requestVPC_vPC_VPCRegion = null; if (cmdletContext.VPC_VPCRegion != null) { requestVPC_vPC_VPCRegion = cmdletContext.VPC_VPCRegion; } if (requestVPC_vPC_VPCRegion != null) { request.VPC.VPCRegion = requestVPC_vPC_VPCRegion; requestVPCIsNull = false; } System.String requestVPC_vPC_VPCId = null; if (cmdletContext.VPC_VPCId != null) { requestVPC_vPC_VPCId = cmdletContext.VPC_VPCId; } if (requestVPC_vPC_VPCId != null) { request.VPC.VPCId = requestVPC_vPC_VPCId; requestVPCIsNull = false; } // determine if request.VPC should be set to null if (requestVPCIsNull) { request.VPC = null; } if (cmdletContext.CallerReference != null) { request.CallerReference = cmdletContext.CallerReference; } // populate HostedZoneConfig var requestHostedZoneConfigIsNull = true; request.HostedZoneConfig = new Amazon.Route53.Model.HostedZoneConfig(); System.String requestHostedZoneConfig_hostedZoneConfig_Comment = null; if (cmdletContext.HostedZoneConfig_Comment != null) { requestHostedZoneConfig_hostedZoneConfig_Comment = cmdletContext.HostedZoneConfig_Comment; } if (requestHostedZoneConfig_hostedZoneConfig_Comment != null) { request.HostedZoneConfig.Comment = requestHostedZoneConfig_hostedZoneConfig_Comment; requestHostedZoneConfigIsNull = false; } System.Boolean?requestHostedZoneConfig_hostedZoneConfig_PrivateZone = null; if (cmdletContext.HostedZoneConfig_PrivateZone != null) { requestHostedZoneConfig_hostedZoneConfig_PrivateZone = cmdletContext.HostedZoneConfig_PrivateZone.Value; } if (requestHostedZoneConfig_hostedZoneConfig_PrivateZone != null) { request.HostedZoneConfig.PrivateZone = requestHostedZoneConfig_hostedZoneConfig_PrivateZone.Value; requestHostedZoneConfigIsNull = false; } // determine if request.HostedZoneConfig should be set to null if (requestHostedZoneConfigIsNull) { request.HostedZoneConfig = null; } if (cmdletContext.DelegationSetId != null) { request.DelegationSetId = cmdletContext.DelegationSetId; } 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 CreateHostedZone operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateHostedZone 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 EndCreateHostedZone /// operation.</returns> public IAsyncResult BeginCreateHostedZone(CreateHostedZoneRequest request, AsyncCallback callback, object state) { var marshaller = new CreateHostedZoneRequestMarshaller(); var unmarshaller = CreateHostedZoneResponseUnmarshaller.Instance; return BeginInvoke<CreateHostedZoneRequest>(request, marshaller, unmarshaller, callback, state); }
IAsyncResult invokeCreateHostedZone(CreateHostedZoneRequest createHostedZoneRequest, AsyncCallback callback, object state, bool synchronized) { IRequest irequest = new CreateHostedZoneRequestMarshaller().Marshall(createHostedZoneRequest); var unmarshaller = CreateHostedZoneResponseUnmarshaller.GetInstance(); AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller); Invoke(result); return result; }
/// <summary> /// <para> This action creates a new hosted zone.</para> <para>To create a new hosted zone, send a <c>POST</c> request to the /// <c>2011-05-05/hostedzone</c> resource. The request body must include an XML document with a <c>CreateHostedZoneRequest</c> element. The /// response returns the <c>CreateHostedZoneResponse</c> element that contains metadata about the hosted zone.</para> <para>Route 53 /// automatically creates a default SOA record and four NS records for the zone. The NS records in the hosted zone are the name servers you give /// your registrar to delegate your domain to. For more information about SOA and NS records, see NS and SOA Records that Route 53 Creates for a /// Hosted Zone in the <i>Amazon Route 53 Developer Guide</i> .</para> <para>When you create a zone, its initial status is <c>PENDING</c> . This /// means that it is not yet available on all DNS servers. The status of the zone changes to <c>INSYNC</c> when the NS and SOA records are /// available on all Route 53 DNS servers. </para> /// </summary> /// /// <param name="createHostedZoneRequest">Container for the necessary parameters to execute the CreateHostedZone service method on /// AmazonRoute53.</param> /// /// <returns>The response from the CreateHostedZone service method, as returned by AmazonRoute53.</returns> /// /// <exception cref="TooManyHostedZonesException"/> /// <exception cref="InvalidInputException"/> /// <exception cref="HostedZoneAlreadyExistsException"/> /// <exception cref="DelegationSetNotAvailableException"/> /// <exception cref="InvalidDomainNameException"/> public CreateHostedZoneResponse CreateHostedZone(CreateHostedZoneRequest createHostedZoneRequest) { IAsyncResult asyncResult = invokeCreateHostedZone(createHostedZoneRequest, null, null, true); return EndCreateHostedZone(asyncResult); }
/// <summary> /// Initiates the asynchronous execution of the CreateHostedZone operation. /// <seealso cref="Amazon.Route53.AmazonRoute53.CreateHostedZone"/> /// </summary> /// /// <param name="createHostedZoneRequest">Container for the necessary parameters to execute the CreateHostedZone 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 EndCreateHostedZone /// operation.</returns> public IAsyncResult BeginCreateHostedZone(CreateHostedZoneRequest createHostedZoneRequest, AsyncCallback callback, object state) { return invokeCreateHostedZone(createHostedZoneRequest, callback, state, false); }