예제 #1
0
 private Amazon.Macie2.Model.PutClassificationExportConfigurationResponse CallAWSServiceOperation(IAmazonMacie2 client, Amazon.Macie2.Model.PutClassificationExportConfigurationRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Macie 2", "PutClassificationExportConfiguration");
     try
     {
         #if DESKTOP
         return(client.PutClassificationExportConfiguration(request));
         #elif CORECLR
         return(client.PutClassificationExportConfigurationAsync(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;
     }
 }
예제 #2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.Macie2.Model.PutClassificationExportConfigurationRequest();


            // populate Configuration
            var requestConfigurationIsNull = true;

            request.Configuration = new Amazon.Macie2.Model.ClassificationExportConfiguration();
            Amazon.Macie2.Model.S3Destination requestConfiguration_configuration_S3Destination = null;

            // populate S3Destination
            var requestConfiguration_configuration_S3DestinationIsNull = true;

            requestConfiguration_configuration_S3Destination = new Amazon.Macie2.Model.S3Destination();
            System.String requestConfiguration_configuration_S3Destination_s3Destination_BucketName = null;
            if (cmdletContext.S3Destination_BucketName != null)
            {
                requestConfiguration_configuration_S3Destination_s3Destination_BucketName = cmdletContext.S3Destination_BucketName;
            }
            if (requestConfiguration_configuration_S3Destination_s3Destination_BucketName != null)
            {
                requestConfiguration_configuration_S3Destination.BucketName = requestConfiguration_configuration_S3Destination_s3Destination_BucketName;
                requestConfiguration_configuration_S3DestinationIsNull      = false;
            }
            System.String requestConfiguration_configuration_S3Destination_s3Destination_KeyPrefix = null;
            if (cmdletContext.S3Destination_KeyPrefix != null)
            {
                requestConfiguration_configuration_S3Destination_s3Destination_KeyPrefix = cmdletContext.S3Destination_KeyPrefix;
            }
            if (requestConfiguration_configuration_S3Destination_s3Destination_KeyPrefix != null)
            {
                requestConfiguration_configuration_S3Destination.KeyPrefix = requestConfiguration_configuration_S3Destination_s3Destination_KeyPrefix;
                requestConfiguration_configuration_S3DestinationIsNull     = false;
            }
            System.String requestConfiguration_configuration_S3Destination_s3Destination_KmsKeyArn = null;
            if (cmdletContext.S3Destination_KmsKeyArn != null)
            {
                requestConfiguration_configuration_S3Destination_s3Destination_KmsKeyArn = cmdletContext.S3Destination_KmsKeyArn;
            }
            if (requestConfiguration_configuration_S3Destination_s3Destination_KmsKeyArn != null)
            {
                requestConfiguration_configuration_S3Destination.KmsKeyArn = requestConfiguration_configuration_S3Destination_s3Destination_KmsKeyArn;
                requestConfiguration_configuration_S3DestinationIsNull     = false;
            }
            // determine if requestConfiguration_configuration_S3Destination should be set to null
            if (requestConfiguration_configuration_S3DestinationIsNull)
            {
                requestConfiguration_configuration_S3Destination = null;
            }
            if (requestConfiguration_configuration_S3Destination != null)
            {
                request.Configuration.S3Destination = requestConfiguration_configuration_S3Destination;
                requestConfigurationIsNull          = false;
            }
            // determine if request.Configuration should be set to null
            if (requestConfigurationIsNull)
            {
                request.Configuration = 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);
        }