Exemple #1
0
 private Amazon.S3.Model.PutBucketIntelligentTieringConfigurationResponse CallAWSServiceOperation(IAmazonS3 client, Amazon.S3.Model.PutBucketIntelligentTieringConfigurationRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Simple Storage Service (S3)", "PutBucketIntelligentTieringConfiguration");
     try
     {
         #if DESKTOP
         return(client.PutBucketIntelligentTieringConfiguration(request));
         #elif CORECLR
         return(client.PutBucketIntelligentTieringConfigurationAsync(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;
     }
 }
Exemple #2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.S3.Model.PutBucketIntelligentTieringConfigurationRequest();

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

            // populate IntelligentTieringConfiguration
            var requestIntelligentTieringConfigurationIsNull = true;

            request.IntelligentTieringConfiguration = new Amazon.S3.Model.IntelligentTieringConfiguration();
            System.String requestIntelligentTieringConfiguration_intelligentTieringConfiguration_IntelligentTieringId = null;
            if (cmdletContext.IntelligentTieringConfiguration_IntelligentTieringId != null)
            {
                requestIntelligentTieringConfiguration_intelligentTieringConfiguration_IntelligentTieringId = cmdletContext.IntelligentTieringConfiguration_IntelligentTieringId;
            }
            if (requestIntelligentTieringConfiguration_intelligentTieringConfiguration_IntelligentTieringId != null)
            {
                request.IntelligentTieringConfiguration.IntelligentTieringId = requestIntelligentTieringConfiguration_intelligentTieringConfiguration_IntelligentTieringId;
                requestIntelligentTieringConfigurationIsNull = false;
            }
            Amazon.S3.IntelligentTieringStatus requestIntelligentTieringConfiguration_intelligentTieringConfiguration_Status = null;
            if (cmdletContext.IntelligentTieringConfiguration_Status != null)
            {
                requestIntelligentTieringConfiguration_intelligentTieringConfiguration_Status = cmdletContext.IntelligentTieringConfiguration_Status;
            }
            if (requestIntelligentTieringConfiguration_intelligentTieringConfiguration_Status != null)
            {
                request.IntelligentTieringConfiguration.Status = requestIntelligentTieringConfiguration_intelligentTieringConfiguration_Status;
                requestIntelligentTieringConfigurationIsNull   = false;
            }
            List <Amazon.S3.Model.Tiering> requestIntelligentTieringConfiguration_intelligentTieringConfiguration_Tiering = null;

            if (cmdletContext.IntelligentTieringConfiguration_Tiering != null)
            {
                requestIntelligentTieringConfiguration_intelligentTieringConfiguration_Tiering = cmdletContext.IntelligentTieringConfiguration_Tiering;
            }
            if (requestIntelligentTieringConfiguration_intelligentTieringConfiguration_Tiering != null)
            {
                request.IntelligentTieringConfiguration.Tierings = requestIntelligentTieringConfiguration_intelligentTieringConfiguration_Tiering;
                requestIntelligentTieringConfigurationIsNull     = false;
            }
            Amazon.S3.Model.IntelligentTieringFilter requestIntelligentTieringConfiguration_intelligentTieringConfiguration_IntelligentTieringFilter = null;

            // populate IntelligentTieringFilter
            var requestIntelligentTieringConfiguration_intelligentTieringConfiguration_IntelligentTieringFilterIsNull = true;

            requestIntelligentTieringConfiguration_intelligentTieringConfiguration_IntelligentTieringFilter = new Amazon.S3.Model.IntelligentTieringFilter();
            Amazon.S3.Model.IntelligentTieringFilterPredicate requestIntelligentTieringConfiguration_intelligentTieringConfiguration_IntelligentTieringFilter_intelligentTieringFilter_IntelligentTieringFilterPredicate = null;
            if (cmdletContext.IntelligentTieringFilter_IntelligentTieringFilterPredicate != null)
            {
                requestIntelligentTieringConfiguration_intelligentTieringConfiguration_IntelligentTieringFilter_intelligentTieringFilter_IntelligentTieringFilterPredicate = cmdletContext.IntelligentTieringFilter_IntelligentTieringFilterPredicate;
            }
            if (requestIntelligentTieringConfiguration_intelligentTieringConfiguration_IntelligentTieringFilter_intelligentTieringFilter_IntelligentTieringFilterPredicate != null)
            {
                requestIntelligentTieringConfiguration_intelligentTieringConfiguration_IntelligentTieringFilter.IntelligentTieringFilterPredicate = requestIntelligentTieringConfiguration_intelligentTieringConfiguration_IntelligentTieringFilter_intelligentTieringFilter_IntelligentTieringFilterPredicate;
                requestIntelligentTieringConfiguration_intelligentTieringConfiguration_IntelligentTieringFilterIsNull = false;
            }
            // determine if requestIntelligentTieringConfiguration_intelligentTieringConfiguration_IntelligentTieringFilter should be set to null
            if (requestIntelligentTieringConfiguration_intelligentTieringConfiguration_IntelligentTieringFilterIsNull)
            {
                requestIntelligentTieringConfiguration_intelligentTieringConfiguration_IntelligentTieringFilter = null;
            }
            if (requestIntelligentTieringConfiguration_intelligentTieringConfiguration_IntelligentTieringFilter != null)
            {
                request.IntelligentTieringConfiguration.IntelligentTieringFilter = requestIntelligentTieringConfiguration_intelligentTieringConfiguration_IntelligentTieringFilter;
                requestIntelligentTieringConfigurationIsNull = false;
            }
            // determine if request.IntelligentTieringConfiguration should be set to null
            if (requestIntelligentTieringConfigurationIsNull)
            {
                request.IntelligentTieringConfiguration = 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);
        }