private Amazon.IoTSiteWise.Model.PutStorageConfigurationResponse CallAWSServiceOperation(IAmazonIoTSiteWise client, Amazon.IoTSiteWise.Model.PutStorageConfigurationRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS IoT SiteWise", "PutStorageConfiguration");
     try
     {
         #if DESKTOP
         return(client.PutStorageConfiguration(request));
         #elif CORECLR
         return(client.PutStorageConfigurationAsync(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.IoTSiteWise.Model.PutStorageConfigurationRequest();

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

            // populate MultiLayerStorage
            var requestMultiLayerStorageIsNull = true;

            request.MultiLayerStorage = new Amazon.IoTSiteWise.Model.MultiLayerStorage();
            Amazon.IoTSiteWise.Model.CustomerManagedS3Storage requestMultiLayerStorage_multiLayerStorage_CustomerManagedS3Storage = null;

            // populate CustomerManagedS3Storage
            var requestMultiLayerStorage_multiLayerStorage_CustomerManagedS3StorageIsNull = true;

            requestMultiLayerStorage_multiLayerStorage_CustomerManagedS3Storage = new Amazon.IoTSiteWise.Model.CustomerManagedS3Storage();
            System.String requestMultiLayerStorage_multiLayerStorage_CustomerManagedS3Storage_customerManagedS3Storage_RoleArn = null;
            if (cmdletContext.CustomerManagedS3Storage_RoleArn != null)
            {
                requestMultiLayerStorage_multiLayerStorage_CustomerManagedS3Storage_customerManagedS3Storage_RoleArn = cmdletContext.CustomerManagedS3Storage_RoleArn;
            }
            if (requestMultiLayerStorage_multiLayerStorage_CustomerManagedS3Storage_customerManagedS3Storage_RoleArn != null)
            {
                requestMultiLayerStorage_multiLayerStorage_CustomerManagedS3Storage.RoleArn = requestMultiLayerStorage_multiLayerStorage_CustomerManagedS3Storage_customerManagedS3Storage_RoleArn;
                requestMultiLayerStorage_multiLayerStorage_CustomerManagedS3StorageIsNull   = false;
            }
            System.String requestMultiLayerStorage_multiLayerStorage_CustomerManagedS3Storage_customerManagedS3Storage_S3ResourceArn = null;
            if (cmdletContext.CustomerManagedS3Storage_S3ResourceArn != null)
            {
                requestMultiLayerStorage_multiLayerStorage_CustomerManagedS3Storage_customerManagedS3Storage_S3ResourceArn = cmdletContext.CustomerManagedS3Storage_S3ResourceArn;
            }
            if (requestMultiLayerStorage_multiLayerStorage_CustomerManagedS3Storage_customerManagedS3Storage_S3ResourceArn != null)
            {
                requestMultiLayerStorage_multiLayerStorage_CustomerManagedS3Storage.S3ResourceArn = requestMultiLayerStorage_multiLayerStorage_CustomerManagedS3Storage_customerManagedS3Storage_S3ResourceArn;
                requestMultiLayerStorage_multiLayerStorage_CustomerManagedS3StorageIsNull         = false;
            }
            // determine if requestMultiLayerStorage_multiLayerStorage_CustomerManagedS3Storage should be set to null
            if (requestMultiLayerStorage_multiLayerStorage_CustomerManagedS3StorageIsNull)
            {
                requestMultiLayerStorage_multiLayerStorage_CustomerManagedS3Storage = null;
            }
            if (requestMultiLayerStorage_multiLayerStorage_CustomerManagedS3Storage != null)
            {
                request.MultiLayerStorage.CustomerManagedS3Storage = requestMultiLayerStorage_multiLayerStorage_CustomerManagedS3Storage;
                requestMultiLayerStorageIsNull = false;
            }
            // determine if request.MultiLayerStorage should be set to null
            if (requestMultiLayerStorageIsNull)
            {
                request.MultiLayerStorage = null;
            }

            // populate RetentionPeriod
            var requestRetentionPeriodIsNull = true;

            request.RetentionPeriod = new Amazon.IoTSiteWise.Model.RetentionPeriod();
            System.Int32?requestRetentionPeriod_retentionPeriod_NumberOfDay = null;
            if (cmdletContext.RetentionPeriod_NumberOfDay != null)
            {
                requestRetentionPeriod_retentionPeriod_NumberOfDay = cmdletContext.RetentionPeriod_NumberOfDay.Value;
            }
            if (requestRetentionPeriod_retentionPeriod_NumberOfDay != null)
            {
                request.RetentionPeriod.NumberOfDays = requestRetentionPeriod_retentionPeriod_NumberOfDay.Value;
                requestRetentionPeriodIsNull         = false;
            }
            System.Boolean?requestRetentionPeriod_retentionPeriod_Unlimited = null;
            if (cmdletContext.RetentionPeriod_Unlimited != null)
            {
                requestRetentionPeriod_retentionPeriod_Unlimited = cmdletContext.RetentionPeriod_Unlimited.Value;
            }
            if (requestRetentionPeriod_retentionPeriod_Unlimited != null)
            {
                request.RetentionPeriod.Unlimited = requestRetentionPeriod_retentionPeriod_Unlimited.Value;
                requestRetentionPeriodIsNull      = false;
            }
            // determine if request.RetentionPeriod should be set to null
            if (requestRetentionPeriodIsNull)
            {
                request.RetentionPeriod = null;
            }
            if (cmdletContext.StorageType != null)
            {
                request.StorageType = cmdletContext.StorageType;
            }

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