private Amazon.AppSync.Model.CreateGraphqlApiResponse CallAWSServiceOperation(IAmazonAppSync client, Amazon.AppSync.Model.CreateGraphqlApiRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS AppSync", "CreateGraphqlApi");
     try
     {
         #if DESKTOP
         return(client.CreateGraphqlApi(request));
         #elif CORECLR
         return(client.CreateGraphqlApiAsync(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.AppSync.Model.CreateGraphqlApiRequest();

            if (cmdletContext.AdditionalAuthenticationProvider != null)
            {
                request.AdditionalAuthenticationProviders = cmdletContext.AdditionalAuthenticationProvider;
            }
            if (cmdletContext.AuthenticationType != null)
            {
                request.AuthenticationType = cmdletContext.AuthenticationType;
            }

            // populate LogConfig
            var requestLogConfigIsNull = true;

            request.LogConfig = new Amazon.AppSync.Model.LogConfig();
            System.String requestLogConfig_logConfig_CloudWatchLogsRoleArn = null;
            if (cmdletContext.LogConfig_CloudWatchLogsRoleArn != null)
            {
                requestLogConfig_logConfig_CloudWatchLogsRoleArn = cmdletContext.LogConfig_CloudWatchLogsRoleArn;
            }
            if (requestLogConfig_logConfig_CloudWatchLogsRoleArn != null)
            {
                request.LogConfig.CloudWatchLogsRoleArn = requestLogConfig_logConfig_CloudWatchLogsRoleArn;
                requestLogConfigIsNull = false;
            }
            System.Boolean?requestLogConfig_logConfig_ExcludeVerboseContent = null;
            if (cmdletContext.LogConfig_ExcludeVerboseContent != null)
            {
                requestLogConfig_logConfig_ExcludeVerboseContent = cmdletContext.LogConfig_ExcludeVerboseContent.Value;
            }
            if (requestLogConfig_logConfig_ExcludeVerboseContent != null)
            {
                request.LogConfig.ExcludeVerboseContent = requestLogConfig_logConfig_ExcludeVerboseContent.Value;
                requestLogConfigIsNull = false;
            }
            Amazon.AppSync.FieldLogLevel requestLogConfig_logConfig_FieldLogLevel = null;
            if (cmdletContext.LogConfig_FieldLogLevel != null)
            {
                requestLogConfig_logConfig_FieldLogLevel = cmdletContext.LogConfig_FieldLogLevel;
            }
            if (requestLogConfig_logConfig_FieldLogLevel != null)
            {
                request.LogConfig.FieldLogLevel = requestLogConfig_logConfig_FieldLogLevel;
                requestLogConfigIsNull          = false;
            }
            // determine if request.LogConfig should be set to null
            if (requestLogConfigIsNull)
            {
                request.LogConfig = null;
            }
            if (cmdletContext.Name != null)
            {
                request.Name = cmdletContext.Name;
            }

            // populate OpenIDConnectConfig
            var requestOpenIDConnectConfigIsNull = true;

            request.OpenIDConnectConfig = new Amazon.AppSync.Model.OpenIDConnectConfig();
            System.Int64?requestOpenIDConnectConfig_openIDConnectConfig_AuthTTL = null;
            if (cmdletContext.OpenIDConnectConfig_AuthTTL != null)
            {
                requestOpenIDConnectConfig_openIDConnectConfig_AuthTTL = cmdletContext.OpenIDConnectConfig_AuthTTL.Value;
            }
            if (requestOpenIDConnectConfig_openIDConnectConfig_AuthTTL != null)
            {
                request.OpenIDConnectConfig.AuthTTL = requestOpenIDConnectConfig_openIDConnectConfig_AuthTTL.Value;
                requestOpenIDConnectConfigIsNull    = false;
            }
            System.String requestOpenIDConnectConfig_openIDConnectConfig_ClientId = null;
            if (cmdletContext.OpenIDConnectConfig_ClientId != null)
            {
                requestOpenIDConnectConfig_openIDConnectConfig_ClientId = cmdletContext.OpenIDConnectConfig_ClientId;
            }
            if (requestOpenIDConnectConfig_openIDConnectConfig_ClientId != null)
            {
                request.OpenIDConnectConfig.ClientId = requestOpenIDConnectConfig_openIDConnectConfig_ClientId;
                requestOpenIDConnectConfigIsNull     = false;
            }
            System.Int64?requestOpenIDConnectConfig_openIDConnectConfig_IatTTL = null;
            if (cmdletContext.OpenIDConnectConfig_IatTTL != null)
            {
                requestOpenIDConnectConfig_openIDConnectConfig_IatTTL = cmdletContext.OpenIDConnectConfig_IatTTL.Value;
            }
            if (requestOpenIDConnectConfig_openIDConnectConfig_IatTTL != null)
            {
                request.OpenIDConnectConfig.IatTTL = requestOpenIDConnectConfig_openIDConnectConfig_IatTTL.Value;
                requestOpenIDConnectConfigIsNull   = false;
            }
            System.String requestOpenIDConnectConfig_openIDConnectConfig_Issuer = null;
            if (cmdletContext.OpenIDConnectConfig_Issuer != null)
            {
                requestOpenIDConnectConfig_openIDConnectConfig_Issuer = cmdletContext.OpenIDConnectConfig_Issuer;
            }
            if (requestOpenIDConnectConfig_openIDConnectConfig_Issuer != null)
            {
                request.OpenIDConnectConfig.Issuer = requestOpenIDConnectConfig_openIDConnectConfig_Issuer;
                requestOpenIDConnectConfigIsNull   = false;
            }
            // determine if request.OpenIDConnectConfig should be set to null
            if (requestOpenIDConnectConfigIsNull)
            {
                request.OpenIDConnectConfig = null;
            }
            if (cmdletContext.Tag != null)
            {
                request.Tags = cmdletContext.Tag;
            }
            if (cmdletContext.UserPoolConfig != null)
            {
                request.UserPoolConfig = cmdletContext.UserPoolConfig;
            }

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