private Amazon.AmplifyBackend.Model.CreateBackendStorageResponse CallAWSServiceOperation(IAmazonAmplifyBackend client, Amazon.AmplifyBackend.Model.CreateBackendStorageRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amplify Backend", "CreateBackendStorage");
     try
     {
         #if DESKTOP
         return(client.CreateBackendStorage(request));
         #elif CORECLR
         return(client.CreateBackendStorageAsync(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.AmplifyBackend.Model.CreateBackendStorageRequest();

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

            // populate ResourceConfig
            var requestResourceConfigIsNull = true;

            request.ResourceConfig = new Amazon.AmplifyBackend.Model.CreateBackendStorageResourceConfig();
            System.String requestResourceConfig_resourceConfig_BucketName = null;
            if (cmdletContext.ResourceConfig_BucketName != null)
            {
                requestResourceConfig_resourceConfig_BucketName = cmdletContext.ResourceConfig_BucketName;
            }
            if (requestResourceConfig_resourceConfig_BucketName != null)
            {
                request.ResourceConfig.BucketName = requestResourceConfig_resourceConfig_BucketName;
                requestResourceConfigIsNull       = false;
            }
            Amazon.AmplifyBackend.ServiceName requestResourceConfig_resourceConfig_ServiceName = null;
            if (cmdletContext.ResourceConfig_ServiceName != null)
            {
                requestResourceConfig_resourceConfig_ServiceName = cmdletContext.ResourceConfig_ServiceName;
            }
            if (requestResourceConfig_resourceConfig_ServiceName != null)
            {
                request.ResourceConfig.ServiceName = requestResourceConfig_resourceConfig_ServiceName;
                requestResourceConfigIsNull        = false;
            }
            Amazon.AmplifyBackend.Model.BackendStoragePermissions requestResourceConfig_resourceConfig_Permissions = null;

            // populate Permissions
            var requestResourceConfig_resourceConfig_PermissionsIsNull = true;

            requestResourceConfig_resourceConfig_Permissions = new Amazon.AmplifyBackend.Model.BackendStoragePermissions();
            List <System.String> requestResourceConfig_resourceConfig_Permissions_permissions_Authenticated = null;

            if (cmdletContext.Permissions_Authenticated != null)
            {
                requestResourceConfig_resourceConfig_Permissions_permissions_Authenticated = cmdletContext.Permissions_Authenticated;
            }
            if (requestResourceConfig_resourceConfig_Permissions_permissions_Authenticated != null)
            {
                requestResourceConfig_resourceConfig_Permissions.Authenticated = requestResourceConfig_resourceConfig_Permissions_permissions_Authenticated;
                requestResourceConfig_resourceConfig_PermissionsIsNull         = false;
            }
            List <System.String> requestResourceConfig_resourceConfig_Permissions_permissions_UnAuthenticated = null;

            if (cmdletContext.Permissions_UnAuthenticated != null)
            {
                requestResourceConfig_resourceConfig_Permissions_permissions_UnAuthenticated = cmdletContext.Permissions_UnAuthenticated;
            }
            if (requestResourceConfig_resourceConfig_Permissions_permissions_UnAuthenticated != null)
            {
                requestResourceConfig_resourceConfig_Permissions.UnAuthenticated = requestResourceConfig_resourceConfig_Permissions_permissions_UnAuthenticated;
                requestResourceConfig_resourceConfig_PermissionsIsNull           = false;
            }
            // determine if requestResourceConfig_resourceConfig_Permissions should be set to null
            if (requestResourceConfig_resourceConfig_PermissionsIsNull)
            {
                requestResourceConfig_resourceConfig_Permissions = null;
            }
            if (requestResourceConfig_resourceConfig_Permissions != null)
            {
                request.ResourceConfig.Permissions = requestResourceConfig_resourceConfig_Permissions;
                requestResourceConfigIsNull        = false;
            }
            // determine if request.ResourceConfig should be set to null
            if (requestResourceConfigIsNull)
            {
                request.ResourceConfig = null;
            }
            if (cmdletContext.ResourceName != null)
            {
                request.ResourceName = cmdletContext.ResourceName;
            }

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