The CheckDomainAvailability response includes the following elements.
Inheritance: Amazon.Runtime.AmazonWebServiceResponse
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>  
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            CheckDomainAvailabilityResponse response = new CheckDomainAvailabilityResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;
            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("Availability", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.Availability = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return response;
        }
Beispiel #2
0
        public DomainCheckResult CheckSingleDomainSingleTld(string domainName, string tld)
        {
            var domainCheckResult = new DomainCheckResult()
            {
                Domain = domainName,
                Tld = tld,
                CheckDate = DateTime.UtcNow
            };

            var response = new CheckDomainAvailabilityResponse();
            var request = new CheckDomainAvailabilityRequest() { DomainName = $"{domainName}.{tld}" };

            try
            {
                response = _amazonRoute53DomainsClient.CheckDomainAvailability(request);

                domainCheckResult.Availability = response.Availability;
                domainCheckResult.RequestResult = response.HttpStatusCode.ToString();
            }
            catch (Exception ex)
            {
                domainCheckResult.RequestResult = response.HttpStatusCode.ToString();
                domainCheckResult.ErrorMessage = ex.Message;

                Console.WriteLine($"ERROR {domainCheckResult.Domain} --> {domainCheckResult.ErrorMessage}");
            }

            Console.WriteLine($"{request.DomainName} --> {domainCheckResult.Availability}");

            return domainCheckResult;
        }