예제 #1
0
        /// <summary>
        /// Initiates the asynchronous execution of the GetHostedZone operation.
        /// <seealso cref="Amazon.Route53.IAmazonRoute53.GetHostedZone"/>
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the GetHostedZone 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 <GetHostedZoneResponse> GetHostedZoneAsync(GetHostedZoneRequest request, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = new GetHostedZoneRequestMarshaller();
            var unmarshaller = GetHostedZoneResponseUnmarshaller.GetInstance();

            return(Invoke <IRequest, GetHostedZoneRequest, GetHostedZoneResponse>(request, marshaller, unmarshaller, signer, cancellationToken));
        }
예제 #2
0
        internal GetHostedZoneResponse GetHostedZone(GetHostedZoneRequest request)
        {
            var marshaller   = new GetHostedZoneRequestMarshaller();
            var unmarshaller = GetHostedZoneResponseUnmarshaller.Instance;

            return(Invoke <GetHostedZoneRequest, GetHostedZoneResponse>(request, marshaller, unmarshaller));
        }
예제 #3
0
        /// <summary>
        /// Initiates the asynchronous execution of the GetHostedZone operation.
        /// <seealso cref="Amazon.Route53.IAmazonRoute53"/>
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the GetHostedZone 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 <GetHostedZoneResponse> GetHostedZoneAsync(GetHostedZoneRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = new GetHostedZoneRequestMarshaller();
            var unmarshaller = GetHostedZoneResponseUnmarshaller.Instance;

            return(InvokeAsync <GetHostedZoneRequest, GetHostedZoneResponse>(request, marshaller,
                                                                             unmarshaller, cancellationToken));
        }
        IAsyncResult invokeGetHostedZone(GetHostedZoneRequest getHostedZoneRequest, AsyncCallback callback, object state, bool synchronized)
        {
            IRequest    irequest     = new GetHostedZoneRequestMarshaller().Marshall(getHostedZoneRequest);
            var         unmarshaller = GetHostedZoneResponseUnmarshaller.GetInstance();
            AsyncResult result       = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller);

            Invoke(result);
            return(result);
        }
예제 #5
0
        /// <summary>
        /// <para> To retrieve the delegation set for a hosted zone, send a <c>GET</c> request to the <c>2013-04-01/hostedzone/hosted zone ID </c>
        /// resource. The delegation set is the four Route 53 name servers that were assigned to the hosted zone when you created it.</para>
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the GetHostedZone service method on
        /// AmazonRoute53.</param>
        ///
        /// <returns>The response from the GetHostedZone service method, as returned by AmazonRoute53.</returns>
        ///
        /// <exception cref="T:Amazon.Route53.Model.NoSuchHostedZoneException" />
        /// <exception cref="T:Amazon.Route53.Model.InvalidInputException" />
        public GetHostedZoneResponse GetHostedZone(GetHostedZoneRequest request)
        {
            var task = GetHostedZoneAsync(request);

            try
            {
                return(task.Result);
            }
            catch (AggregateException e)
            {
                ExceptionDispatchInfo.Capture(e.InnerException).Throw();
                return(null);
            }
        }
예제 #6
0
        private async Task <HostedZone> GetZone(Instance instance, ILambdaContext context)
        {
            string zoneId = instance.Tags.GetTag("ZoneId");

            if (string.IsNullOrWhiteSpace(zoneId))
            {
                context.Logger.LogLine($"Zone missing!");
                return(null);
            }

            // Get the hosted zone information from route53.
            GetHostedZoneRequest request = new GetHostedZoneRequest(zoneId);
            var response = _amazonRoute53Client.GetHostedZoneAsync(request);

            var hostedZone = response.Result.HostedZone;

            if (hostedZone != null)
            {
                context.Logger.LogLine($"Found hosted zone: {hostedZone.Name}");
            }

            return(hostedZone);
        }
예제 #7
0
        public void TestRoute53()
        {
            var geoLocations = Client.ListGeoLocations(new ListGeoLocationsRequest()).GeoLocationDetailsList;

            Assert.IsNotNull(geoLocations);
            Assert.AreNotEqual(0, geoLocations.Count);

            CreateHostedZoneRequest createRequest = new CreateHostedZoneRequest
            {
                Name             = ZONE_NAME,
                CallerReference  = CALLER_REFERENCE,
                HostedZoneConfig = new HostedZoneConfig {
                    Comment = COMMENT
                }
            };
            // Create Hosted Zone
            var response = Client.CreateHostedZone(createRequest);

            createdZoneId       = response.HostedZone.Id;
            createdZoneChangeId = response.ChangeInfo.Id;

            assertValidCreatedHostedZone(response.HostedZone);
            assertValidDelegationSet(response.DelegationSet);
            assertValidChangeInfo(response.ChangeInfo);
            Assert.IsNotNull(response.Location);


            // Get Hosted Zone
            GetHostedZoneRequest getRequest = new GetHostedZoneRequest {
                Id = createdZoneId
            };
            var getHostedZoneResponse = Client.GetHostedZone(getRequest);

            assertValidDelegationSet(getHostedZoneResponse.DelegationSet);
            assertValidCreatedHostedZone(getHostedZoneResponse.HostedZone);


            // List Hosted Zones
            List <HostedZone> hostedZones = Client.ListHostedZones().HostedZones;

            Assert.IsTrue(hostedZones.Count > 0);
            foreach (HostedZone hostedZone in hostedZones)
            {
                Assert.IsNotNull(hostedZone.CallerReference);
                Assert.IsNotNull(hostedZone.Id);
                Assert.IsNotNull(hostedZone.Name);
            }


            // List Resource Record Sets
            ListResourceRecordSetsRequest listRequest = new ListResourceRecordSetsRequest {
                HostedZoneId = createdZoneId, MaxItems = "10"
            };
            List <ResourceRecordSet> resourceRecordSets = Client.ListResourceRecordSets(listRequest).ResourceRecordSets;

            Assert.IsTrue(resourceRecordSets.Count > 0);
            ResourceRecordSet existingResourceRecordSet = resourceRecordSets[0];

            foreach (ResourceRecordSet rrset in resourceRecordSets)
            {
                Assert.IsNotNull(rrset.Name);
                Assert.IsNotNull(rrset.Type);
                Assert.IsNotNull(rrset.TTL);
                Assert.IsTrue(rrset.ResourceRecords.Count > 0);
            }


            // Get Change
            ChangeInfo changeInfo = Client.GetChange(new GetChangeRequest {
                Id = createdZoneChangeId
            }).ChangeInfo;

            Assert.IsTrue(changeInfo.Id.EndsWith(createdZoneChangeId));
            assertValidChangeInfo(changeInfo);


            // Change Resource Record Sets
            ResourceRecordSet newResourceRecordSet = new ResourceRecordSet
            {
                Name            = ZONE_NAME,
                ResourceRecords = existingResourceRecordSet.ResourceRecords,
                TTL             = existingResourceRecordSet.TTL + 100,
                Type            = existingResourceRecordSet.Type,
                HealthCheckId   = null
            };

            changeInfo = Client.ChangeResourceRecordSets(new ChangeResourceRecordSetsRequest
            {
                HostedZoneId = createdZoneId,
                ChangeBatch  = new ChangeBatch
                {
                    Comment = COMMENT,
                    Changes = new List <Change>
                    {
                        new Change {
                            Action = "DELETE", ResourceRecordSet = existingResourceRecordSet
                        },
                        new Change {
                            Action = "CREATE", ResourceRecordSet = newResourceRecordSet
                        }
                    }
                }
            }).ChangeInfo;

            assertValidChangeInfo(changeInfo);

            // Delete Hosted Zone
            DeleteHostedZoneResult deleteHostedZoneResult = Client.DeleteHostedZone(new DeleteHostedZoneRequest {
                Id = createdZoneId
            });

            assertValidChangeInfo(deleteHostedZoneResult.ChangeInfo);
        }
 /// <summary>
 /// Initiates the asynchronous execution of the GetHostedZone operation.
 /// <seealso cref="Amazon.Route53.AmazonRoute53.GetHostedZone"/>
 /// </summary>
 ///
 /// <param name="getHostedZoneRequest">Container for the necessary parameters to execute the GetHostedZone 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 EndGetHostedZone
 ///         operation.</returns>
 public IAsyncResult BeginGetHostedZone(GetHostedZoneRequest getHostedZoneRequest, AsyncCallback callback, object state)
 {
     return(invokeGetHostedZone(getHostedZoneRequest, callback, state, false));
 }
        /// <summary>
        /// <para> To retrieve the delegation set for a hosted zone, send a <c>GET</c> request to the <c>2012-02-29/hostedzone/hosted zone ID </c>
        /// resource. The delegation set is the four Route 53 name servers that were assigned to the hosted zone when you created it.</para>
        /// </summary>
        ///
        /// <param name="getHostedZoneRequest">Container for the necessary parameters to execute the GetHostedZone service method on
        ///          AmazonRoute53.</param>
        ///
        /// <returns>The response from the GetHostedZone service method, as returned by AmazonRoute53.</returns>
        ///
        /// <exception cref="NoSuchHostedZoneException"/>
        /// <exception cref="InvalidInputException"/>
        public GetHostedZoneResponse GetHostedZone(GetHostedZoneRequest getHostedZoneRequest)
        {
            IAsyncResult asyncResult = invokeGetHostedZone(getHostedZoneRequest, null, null, true);

            return(EndGetHostedZone(asyncResult));
        }
예제 #10
0
 public virtual Task <GetHostedZoneResponse> GetHostedZoneAsync(GetHostedZoneRequest request, CancellationToken cancellationToken = default(CancellationToken))
 {
     throw new NotImplementedException();
 }