Ejemplo n.º 1
0
 private Amazon.LexModelsV2.Model.CreateExportResponse CallAWSServiceOperation(IAmazonLexModelsV2 client, Amazon.LexModelsV2.Model.CreateExportRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Lex Model Building V2", "CreateExport");
     try
     {
         #if DESKTOP
         return(client.CreateExport(request));
         #elif CORECLR
         return(client.CreateExportAsync(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;
     }
 }
Ejemplo n.º 2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.LexModelsV2.Model.CreateExportRequest();

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

            // populate ResourceSpecification
            var requestResourceSpecificationIsNull = true;

            request.ResourceSpecification = new Amazon.LexModelsV2.Model.ExportResourceSpecification();
            Amazon.LexModelsV2.Model.BotExportSpecification requestResourceSpecification_resourceSpecification_BotExportSpecification = null;

            // populate BotExportSpecification
            var requestResourceSpecification_resourceSpecification_BotExportSpecificationIsNull = true;

            requestResourceSpecification_resourceSpecification_BotExportSpecification = new Amazon.LexModelsV2.Model.BotExportSpecification();
            System.String requestResourceSpecification_resourceSpecification_BotExportSpecification_botExportSpecification_BotId = null;
            if (cmdletContext.BotExportSpecification_BotId != null)
            {
                requestResourceSpecification_resourceSpecification_BotExportSpecification_botExportSpecification_BotId = cmdletContext.BotExportSpecification_BotId;
            }
            if (requestResourceSpecification_resourceSpecification_BotExportSpecification_botExportSpecification_BotId != null)
            {
                requestResourceSpecification_resourceSpecification_BotExportSpecification.BotId = requestResourceSpecification_resourceSpecification_BotExportSpecification_botExportSpecification_BotId;
                requestResourceSpecification_resourceSpecification_BotExportSpecificationIsNull = false;
            }
            System.String requestResourceSpecification_resourceSpecification_BotExportSpecification_botExportSpecification_BotVersion = null;
            if (cmdletContext.BotExportSpecification_BotVersion != null)
            {
                requestResourceSpecification_resourceSpecification_BotExportSpecification_botExportSpecification_BotVersion = cmdletContext.BotExportSpecification_BotVersion;
            }
            if (requestResourceSpecification_resourceSpecification_BotExportSpecification_botExportSpecification_BotVersion != null)
            {
                requestResourceSpecification_resourceSpecification_BotExportSpecification.BotVersion = requestResourceSpecification_resourceSpecification_BotExportSpecification_botExportSpecification_BotVersion;
                requestResourceSpecification_resourceSpecification_BotExportSpecificationIsNull      = false;
            }
            // determine if requestResourceSpecification_resourceSpecification_BotExportSpecification should be set to null
            if (requestResourceSpecification_resourceSpecification_BotExportSpecificationIsNull)
            {
                requestResourceSpecification_resourceSpecification_BotExportSpecification = null;
            }
            if (requestResourceSpecification_resourceSpecification_BotExportSpecification != null)
            {
                request.ResourceSpecification.BotExportSpecification = requestResourceSpecification_resourceSpecification_BotExportSpecification;
                requestResourceSpecificationIsNull = false;
            }
            Amazon.LexModelsV2.Model.BotLocaleExportSpecification requestResourceSpecification_resourceSpecification_BotLocaleExportSpecification = null;

            // populate BotLocaleExportSpecification
            var requestResourceSpecification_resourceSpecification_BotLocaleExportSpecificationIsNull = true;

            requestResourceSpecification_resourceSpecification_BotLocaleExportSpecification = new Amazon.LexModelsV2.Model.BotLocaleExportSpecification();
            System.String requestResourceSpecification_resourceSpecification_BotLocaleExportSpecification_botLocaleExportSpecification_BotId = null;
            if (cmdletContext.BotLocaleExportSpecification_BotId != null)
            {
                requestResourceSpecification_resourceSpecification_BotLocaleExportSpecification_botLocaleExportSpecification_BotId = cmdletContext.BotLocaleExportSpecification_BotId;
            }
            if (requestResourceSpecification_resourceSpecification_BotLocaleExportSpecification_botLocaleExportSpecification_BotId != null)
            {
                requestResourceSpecification_resourceSpecification_BotLocaleExportSpecification.BotId = requestResourceSpecification_resourceSpecification_BotLocaleExportSpecification_botLocaleExportSpecification_BotId;
                requestResourceSpecification_resourceSpecification_BotLocaleExportSpecificationIsNull = false;
            }
            System.String requestResourceSpecification_resourceSpecification_BotLocaleExportSpecification_botLocaleExportSpecification_BotVersion = null;
            if (cmdletContext.BotLocaleExportSpecification_BotVersion != null)
            {
                requestResourceSpecification_resourceSpecification_BotLocaleExportSpecification_botLocaleExportSpecification_BotVersion = cmdletContext.BotLocaleExportSpecification_BotVersion;
            }
            if (requestResourceSpecification_resourceSpecification_BotLocaleExportSpecification_botLocaleExportSpecification_BotVersion != null)
            {
                requestResourceSpecification_resourceSpecification_BotLocaleExportSpecification.BotVersion = requestResourceSpecification_resourceSpecification_BotLocaleExportSpecification_botLocaleExportSpecification_BotVersion;
                requestResourceSpecification_resourceSpecification_BotLocaleExportSpecificationIsNull      = false;
            }
            System.String requestResourceSpecification_resourceSpecification_BotLocaleExportSpecification_botLocaleExportSpecification_LocaleId = null;
            if (cmdletContext.BotLocaleExportSpecification_LocaleId != null)
            {
                requestResourceSpecification_resourceSpecification_BotLocaleExportSpecification_botLocaleExportSpecification_LocaleId = cmdletContext.BotLocaleExportSpecification_LocaleId;
            }
            if (requestResourceSpecification_resourceSpecification_BotLocaleExportSpecification_botLocaleExportSpecification_LocaleId != null)
            {
                requestResourceSpecification_resourceSpecification_BotLocaleExportSpecification.LocaleId = requestResourceSpecification_resourceSpecification_BotLocaleExportSpecification_botLocaleExportSpecification_LocaleId;
                requestResourceSpecification_resourceSpecification_BotLocaleExportSpecificationIsNull    = false;
            }
            // determine if requestResourceSpecification_resourceSpecification_BotLocaleExportSpecification should be set to null
            if (requestResourceSpecification_resourceSpecification_BotLocaleExportSpecificationIsNull)
            {
                requestResourceSpecification_resourceSpecification_BotLocaleExportSpecification = null;
            }
            if (requestResourceSpecification_resourceSpecification_BotLocaleExportSpecification != null)
            {
                request.ResourceSpecification.BotLocaleExportSpecification = requestResourceSpecification_resourceSpecification_BotLocaleExportSpecification;
                requestResourceSpecificationIsNull = false;
            }
            // determine if request.ResourceSpecification should be set to null
            if (requestResourceSpecificationIsNull)
            {
                request.ResourceSpecification = 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);
        }