A complex type that contains an optional comment and the changes that you want to make with a change batch request.

Esempio n. 1
0
    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 ChangeResourceRecordSetsResponse updateRRSet(string hostedZoneId, ResourceRecordSet oldRRset, ResourceRecordSet newRRset)
        {
            logger.Info("Calling ChangeResourceRecordSets");
            List<Change> changes = new List<Change>() {
                new Change().WithAction(Action.DELETE.ToString()).WithResourceRecordSet(oldRRset),
                new Change().WithAction(Action.CREATE.ToString()).WithResourceRecordSet(newRRset)
            };

            ChangeBatch batch = new ChangeBatch().WithChanges(changes.ToArray());
            return client.ChangeResourceRecordSets(new ChangeResourceRecordSetsRequest()
                                                        .WithHostedZoneId(hostedZoneId)
                                                        .WithChangeBatch(batch));
        }
        public ChangeResourceRecordSetsResponse updateRRSet(
            string hostedZoneId, ResourceRecordSet oldRRset, ResourceRecordSet newRRset)
        {
            logger.Info("Calling ChangeResourceRecordSets");
            Change delete = new Change()
            {
                Action = Action.DELETE.ToString(),
                ResourceRecordSet = oldRRset
            };
            Change create = new Change() {
                Action = Action.CREATE.ToString(),
                ResourceRecordSet = newRRset
            };
            List<Change> changes = new List<Change>() { delete, create };

            ChangeBatch batch = new ChangeBatch() { Changes = changes };

            return client.ChangeResourceRecordSets(new ChangeResourceRecordSetsRequest(){
                HostedZoneId = hostedZoneId,
                ChangeBatch = batch
            });
        }
Esempio n. 4
0
 /// <summary>
 /// Instantiates ChangeResourceRecordSetsRequest with the parameterized properties
 /// </summary>
 /// <param name="hostedZoneId">The ID of the hosted zone that contains the resource record sets that you want to change.</param>
 /// <param name="changeBatch">A complex type that contains an optional comment and the <code>Changes</code> element.</param>
 public ChangeResourceRecordSetsRequest(string hostedZoneId, ChangeBatch changeBatch)
 {
     _hostedZoneId = hostedZoneId;
     _changeBatch  = changeBatch;
 }
 /// <summary>
 /// Instantiates ChangeResourceRecordSetsRequest with the parameterized properties
 /// </summary>
 /// <param name="hostedZoneId"> The ID of the hosted zone that contains the resource record sets that you want to change.</param>
 /// <param name="changeBatch">A complex type that contains an optional comment and the <code>Changes</code> element.</param>
 public ChangeResourceRecordSetsRequest(string hostedZoneId, ChangeBatch changeBatch)
 {
     _hostedZoneId = hostedZoneId;
     _changeBatch = changeBatch;
 }
 /// <summary>
 /// Sets the ChangeBatch property
 /// </summary>
 /// <param name="changeBatch">The value to set for the ChangeBatch property </param>
 /// <returns>this instance</returns>
 public ChangeResourceRecordSetsRequest WithChangeBatch(ChangeBatch changeBatch)
 {
     this.changeBatch = changeBatch;
     return(this);
 }
 /// <summary>
 /// Sets the ChangeBatch property
 /// </summary>
 /// <param name="changeBatch">The value to set for the ChangeBatch property </param>
 /// <returns>this instance</returns>
 public ChangeResourceRecordSetsRequest WithChangeBatch(ChangeBatch changeBatch)
 {
     this.changeBatch = changeBatch;
     return this;
 }