public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.ServiceDiscovery.Model.CreatePublicDnsNamespaceRequest();

            if (cmdletContext.CreatorRequestId != null)
            {
                request.CreatorRequestId = cmdletContext.CreatorRequestId;
            }
            if (cmdletContext.Description != null)
            {
                request.Description = cmdletContext.Description;
            }
            if (cmdletContext.Name != null)
            {
                request.Name = cmdletContext.Name;
            }
            if (cmdletContext.Tag != null)
            {
                request.Tags = cmdletContext.Tag;
            }

            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);
        }
 private Amazon.ServiceDiscovery.Model.CreatePublicDnsNamespaceResponse CallAWSServiceOperation(IAmazonServiceDiscovery client, Amazon.ServiceDiscovery.Model.CreatePublicDnsNamespaceRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Cloud Map", "CreatePublicDnsNamespace");
     try
     {
         #if DESKTOP
         return(client.CreatePublicDnsNamespace(request));
         #elif CORECLR
         return(client.CreatePublicDnsNamespaceAsync(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.ServiceDiscovery.Model.CreatePublicDnsNamespaceRequest();

            if (cmdletContext.CreatorRequestId != null)
            {
                request.CreatorRequestId = cmdletContext.CreatorRequestId;
            }
            if (cmdletContext.Description != null)
            {
                request.Description = cmdletContext.Description;
            }
            if (cmdletContext.Name != null)
            {
                request.Name = cmdletContext.Name;
            }

            // populate Properties
            var requestPropertiesIsNull = true;

            request.Properties = new Amazon.ServiceDiscovery.Model.PublicDnsNamespaceProperties();
            Amazon.ServiceDiscovery.Model.PublicDnsPropertiesMutable requestProperties_properties_DnsProperties = null;

            // populate DnsProperties
            var requestProperties_properties_DnsPropertiesIsNull = true;

            requestProperties_properties_DnsProperties = new Amazon.ServiceDiscovery.Model.PublicDnsPropertiesMutable();
            Amazon.ServiceDiscovery.Model.SOA requestProperties_properties_DnsProperties_properties_DnsProperties_SOA = null;

            // populate SOA
            var requestProperties_properties_DnsProperties_properties_DnsProperties_SOAIsNull = true;

            requestProperties_properties_DnsProperties_properties_DnsProperties_SOA = new Amazon.ServiceDiscovery.Model.SOA();
            System.Int64?requestProperties_properties_DnsProperties_properties_DnsProperties_SOA_sOA_TTL = null;
            if (cmdletContext.SOA_TTL != null)
            {
                requestProperties_properties_DnsProperties_properties_DnsProperties_SOA_sOA_TTL = cmdletContext.SOA_TTL.Value;
            }
            if (requestProperties_properties_DnsProperties_properties_DnsProperties_SOA_sOA_TTL != null)
            {
                requestProperties_properties_DnsProperties_properties_DnsProperties_SOA.TTL   = requestProperties_properties_DnsProperties_properties_DnsProperties_SOA_sOA_TTL.Value;
                requestProperties_properties_DnsProperties_properties_DnsProperties_SOAIsNull = false;
            }
            // determine if requestProperties_properties_DnsProperties_properties_DnsProperties_SOA should be set to null
            if (requestProperties_properties_DnsProperties_properties_DnsProperties_SOAIsNull)
            {
                requestProperties_properties_DnsProperties_properties_DnsProperties_SOA = null;
            }
            if (requestProperties_properties_DnsProperties_properties_DnsProperties_SOA != null)
            {
                requestProperties_properties_DnsProperties.SOA   = requestProperties_properties_DnsProperties_properties_DnsProperties_SOA;
                requestProperties_properties_DnsPropertiesIsNull = false;
            }
            // determine if requestProperties_properties_DnsProperties should be set to null
            if (requestProperties_properties_DnsPropertiesIsNull)
            {
                requestProperties_properties_DnsProperties = null;
            }
            if (requestProperties_properties_DnsProperties != null)
            {
                request.Properties.DnsProperties = requestProperties_properties_DnsProperties;
                requestPropertiesIsNull          = false;
            }
            // determine if request.Properties should be set to null
            if (requestPropertiesIsNull)
            {
                request.Properties = null;
            }
            if (cmdletContext.Tag != null)
            {
                request.Tags = cmdletContext.Tag;
            }

            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);
        }