private Amazon.Elasticsearch.Model.CreateOutboundCrossClusterSearchConnectionResponse CallAWSServiceOperation(IAmazonElasticsearch client, Amazon.Elasticsearch.Model.CreateOutboundCrossClusterSearchConnectionRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Elasticsearch", "CreateOutboundCrossClusterSearchConnection");
     try
     {
         #if DESKTOP
         return(client.CreateOutboundCrossClusterSearchConnection(request));
         #elif CORECLR
         return(client.CreateOutboundCrossClusterSearchConnectionAsync(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.Elasticsearch.Model.CreateOutboundCrossClusterSearchConnectionRequest();

            if (cmdletContext.ConnectionAlias != null)
            {
                request.ConnectionAlias = cmdletContext.ConnectionAlias;
            }

            // populate DestinationDomainInfo
            var requestDestinationDomainInfoIsNull = true;

            request.DestinationDomainInfo = new Amazon.Elasticsearch.Model.DomainInformation();
            System.String requestDestinationDomainInfo_destinationDomainInfo_DomainName = null;
            if (cmdletContext.DestinationDomainInfo_DomainName != null)
            {
                requestDestinationDomainInfo_destinationDomainInfo_DomainName = cmdletContext.DestinationDomainInfo_DomainName;
            }
            if (requestDestinationDomainInfo_destinationDomainInfo_DomainName != null)
            {
                request.DestinationDomainInfo.DomainName = requestDestinationDomainInfo_destinationDomainInfo_DomainName;
                requestDestinationDomainInfoIsNull       = false;
            }
            System.String requestDestinationDomainInfo_destinationDomainInfo_OwnerId = null;
            if (cmdletContext.DestinationDomainInfo_OwnerId != null)
            {
                requestDestinationDomainInfo_destinationDomainInfo_OwnerId = cmdletContext.DestinationDomainInfo_OwnerId;
            }
            if (requestDestinationDomainInfo_destinationDomainInfo_OwnerId != null)
            {
                request.DestinationDomainInfo.OwnerId = requestDestinationDomainInfo_destinationDomainInfo_OwnerId;
                requestDestinationDomainInfoIsNull    = false;
            }
            System.String requestDestinationDomainInfo_destinationDomainInfo_Region = null;
            if (cmdletContext.DestinationDomainInfo_Region != null)
            {
                requestDestinationDomainInfo_destinationDomainInfo_Region = cmdletContext.DestinationDomainInfo_Region;
            }
            if (requestDestinationDomainInfo_destinationDomainInfo_Region != null)
            {
                request.DestinationDomainInfo.Region = requestDestinationDomainInfo_destinationDomainInfo_Region;
                requestDestinationDomainInfoIsNull   = false;
            }
            // determine if request.DestinationDomainInfo should be set to null
            if (requestDestinationDomainInfoIsNull)
            {
                request.DestinationDomainInfo = null;
            }

            // populate SourceDomainInfo
            var requestSourceDomainInfoIsNull = true;

            request.SourceDomainInfo = new Amazon.Elasticsearch.Model.DomainInformation();
            System.String requestSourceDomainInfo_sourceDomainInfo_DomainName = null;
            if (cmdletContext.SourceDomainInfo_DomainName != null)
            {
                requestSourceDomainInfo_sourceDomainInfo_DomainName = cmdletContext.SourceDomainInfo_DomainName;
            }
            if (requestSourceDomainInfo_sourceDomainInfo_DomainName != null)
            {
                request.SourceDomainInfo.DomainName = requestSourceDomainInfo_sourceDomainInfo_DomainName;
                requestSourceDomainInfoIsNull       = false;
            }
            System.String requestSourceDomainInfo_sourceDomainInfo_OwnerId = null;
            if (cmdletContext.SourceDomainInfo_OwnerId != null)
            {
                requestSourceDomainInfo_sourceDomainInfo_OwnerId = cmdletContext.SourceDomainInfo_OwnerId;
            }
            if (requestSourceDomainInfo_sourceDomainInfo_OwnerId != null)
            {
                request.SourceDomainInfo.OwnerId = requestSourceDomainInfo_sourceDomainInfo_OwnerId;
                requestSourceDomainInfoIsNull    = false;
            }
            System.String requestSourceDomainInfo_sourceDomainInfo_Region = null;
            if (cmdletContext.SourceDomainInfo_Region != null)
            {
                requestSourceDomainInfo_sourceDomainInfo_Region = cmdletContext.SourceDomainInfo_Region;
            }
            if (requestSourceDomainInfo_sourceDomainInfo_Region != null)
            {
                request.SourceDomainInfo.Region = requestSourceDomainInfo_sourceDomainInfo_Region;
                requestSourceDomainInfoIsNull   = false;
            }
            // determine if request.SourceDomainInfo should be set to null
            if (requestSourceDomainInfoIsNull)
            {
                request.SourceDomainInfo = null;
            }

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