private Amazon.StorageGateway.Model.AssociateFileSystemResponse CallAWSServiceOperation(IAmazonStorageGateway client, Amazon.StorageGateway.Model.AssociateFileSystemRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Storage Gateway", "AssociateFileSystem");
     try
     {
         #if DESKTOP
         return(client.AssociateFileSystem(request));
         #elif CORECLR
         return(client.AssociateFileSystemAsync(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.StorageGateway.Model.AssociateFileSystemRequest();

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

            // populate CacheAttributes
            var requestCacheAttributesIsNull = true;

            request.CacheAttributes = new Amazon.StorageGateway.Model.CacheAttributes();
            System.Int32?requestCacheAttributes_cacheAttributes_CacheStaleTimeoutInSecond = null;
            if (cmdletContext.CacheAttributes_CacheStaleTimeoutInSecond != null)
            {
                requestCacheAttributes_cacheAttributes_CacheStaleTimeoutInSecond = cmdletContext.CacheAttributes_CacheStaleTimeoutInSecond.Value;
            }
            if (requestCacheAttributes_cacheAttributes_CacheStaleTimeoutInSecond != null)
            {
                request.CacheAttributes.CacheStaleTimeoutInSeconds = requestCacheAttributes_cacheAttributes_CacheStaleTimeoutInSecond.Value;
                requestCacheAttributesIsNull = false;
            }
            // determine if request.CacheAttributes should be set to null
            if (requestCacheAttributesIsNull)
            {
                request.CacheAttributes = null;
            }
            if (cmdletContext.ClientToken != null)
            {
                request.ClientToken = cmdletContext.ClientToken;
            }

            // populate EndpointNetworkConfiguration
            var requestEndpointNetworkConfigurationIsNull = true;

            request.EndpointNetworkConfiguration = new Amazon.StorageGateway.Model.EndpointNetworkConfiguration();
            List <System.String> requestEndpointNetworkConfiguration_endpointNetworkConfiguration_IpAddress = null;

            if (cmdletContext.EndpointNetworkConfiguration_IpAddress != null)
            {
                requestEndpointNetworkConfiguration_endpointNetworkConfiguration_IpAddress = cmdletContext.EndpointNetworkConfiguration_IpAddress;
            }
            if (requestEndpointNetworkConfiguration_endpointNetworkConfiguration_IpAddress != null)
            {
                request.EndpointNetworkConfiguration.IpAddresses = requestEndpointNetworkConfiguration_endpointNetworkConfiguration_IpAddress;
                requestEndpointNetworkConfigurationIsNull        = false;
            }
            // determine if request.EndpointNetworkConfiguration should be set to null
            if (requestEndpointNetworkConfigurationIsNull)
            {
                request.EndpointNetworkConfiguration = null;
            }
            if (cmdletContext.GatewayARN != null)
            {
                request.GatewayARN = cmdletContext.GatewayARN;
            }
            if (cmdletContext.LocationARN != null)
            {
                request.LocationARN = cmdletContext.LocationARN;
            }
            if (cmdletContext.Password != null)
            {
                request.Password = cmdletContext.Password;
            }
            if (cmdletContext.Tag != null)
            {
                request.Tags = cmdletContext.Tag;
            }
            if (cmdletContext.UserName != null)
            {
                request.UserName = cmdletContext.UserName;
            }

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