Container for the parameters to the PutBucketAnalyticsConfiguration operation.

Sets an analytics configuration for the bucket (specified by the analytics configuration ID).

Inheritance: Amazon.Runtime.AmazonWebServiceRequest
 private Amazon.S3.Model.PutBucketAnalyticsConfigurationResponse CallAWSServiceOperation(IAmazonS3 client, Amazon.S3.Model.PutBucketAnalyticsConfigurationRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Simple Storage Service (S3)", "PutBucketAnalyticsConfiguration");
     try
     {
         #if DESKTOP
         return(client.PutBucketAnalyticsConfiguration(request));
         #elif CORECLR
         return(client.PutBucketAnalyticsConfigurationAsync(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;
     }
 }
Example #2
0
 /// <summary>
 /// Initiates the asynchronous execution of the PutBucketAnalyticsConfiguration operation.
 /// This API is supported only when AWSConfigs.HttpClient is set to AWSConfigs.HttpClientOption.UnityWebRequest, the default value for this configuration option is AWSConfigs.HttpClientOption.UnityWWW
 /// </summary>
 /// 
 /// <param name="request">Container for the necessary parameters to execute the PutBucketAnalyticsConfiguration operation on AmazonS3Client.</param>
 /// <param name="callback">An Action delegate that is invoked when the operation completes.</param>
 /// <param name="options">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
 ///          procedure using the AsyncState property.</param>
 public void PutBucketAnalyticsConfigurationAsync(PutBucketAnalyticsConfigurationRequest request, AmazonServiceCallback<PutBucketAnalyticsConfigurationRequest, PutBucketAnalyticsConfigurationResponse> callback, AsyncOptions options = null)
 {
     if (AWSConfigs.HttpClient == AWSConfigs.HttpClientOption.UnityWWW)
     {
         throw new InvalidOperationException("PutBucketAnalyticsConfiguration is only allowed with AWSConfigs.HttpClientOption.UnityWebRequest API option");
     }
     options = options == null?new AsyncOptions():options;
     var marshaller = new PutBucketAnalyticsConfigurationRequestMarshaller();
     var unmarshaller = PutBucketAnalyticsConfigurationResponseUnmarshaller.Instance;
     Action<AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper = null;
     if(callback !=null )
         callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => { 
             AmazonServiceResult<PutBucketAnalyticsConfigurationRequest,PutBucketAnalyticsConfigurationResponse> responseObject 
                     = new AmazonServiceResult<PutBucketAnalyticsConfigurationRequest,PutBucketAnalyticsConfigurationResponse>((PutBucketAnalyticsConfigurationRequest)req, (PutBucketAnalyticsConfigurationResponse)res, ex , ao.State);    
                 callback(responseObject); 
         };
     BeginInvoke<PutBucketAnalyticsConfigurationRequest>(request, marshaller, unmarshaller, options, callbackHelper);
 }
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.S3.Model.PutBucketAnalyticsConfigurationRequest();

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

            // populate AnalyticsConfiguration
            var requestAnalyticsConfigurationIsNull = true;

            request.AnalyticsConfiguration = new Amazon.S3.Model.AnalyticsConfiguration();
            System.String requestAnalyticsConfiguration_analyticsConfiguration_AnalyticsId = null;
            if (cmdletContext.AnalyticsConfiguration_AnalyticsId != null)
            {
                requestAnalyticsConfiguration_analyticsConfiguration_AnalyticsId = cmdletContext.AnalyticsConfiguration_AnalyticsId;
            }
            if (requestAnalyticsConfiguration_analyticsConfiguration_AnalyticsId != null)
            {
                request.AnalyticsConfiguration.AnalyticsId = requestAnalyticsConfiguration_analyticsConfiguration_AnalyticsId;
                requestAnalyticsConfigurationIsNull        = false;
            }
            Amazon.S3.Model.AnalyticsFilter requestAnalyticsConfiguration_analyticsConfiguration_AnalyticsFilter = null;

            // populate AnalyticsFilter
            var requestAnalyticsConfiguration_analyticsConfiguration_AnalyticsFilterIsNull = true;

            requestAnalyticsConfiguration_analyticsConfiguration_AnalyticsFilter = new Amazon.S3.Model.AnalyticsFilter();
            Amazon.S3.Model.AnalyticsFilterPredicate requestAnalyticsConfiguration_analyticsConfiguration_AnalyticsFilter_analyticsFilter_AnalyticsFilterPredicate = null;
            if (cmdletContext.AnalyticsFilter_AnalyticsFilterPredicate != null)
            {
                requestAnalyticsConfiguration_analyticsConfiguration_AnalyticsFilter_analyticsFilter_AnalyticsFilterPredicate = cmdletContext.AnalyticsFilter_AnalyticsFilterPredicate;
            }
            if (requestAnalyticsConfiguration_analyticsConfiguration_AnalyticsFilter_analyticsFilter_AnalyticsFilterPredicate != null)
            {
                requestAnalyticsConfiguration_analyticsConfiguration_AnalyticsFilter.AnalyticsFilterPredicate = requestAnalyticsConfiguration_analyticsConfiguration_AnalyticsFilter_analyticsFilter_AnalyticsFilterPredicate;
                requestAnalyticsConfiguration_analyticsConfiguration_AnalyticsFilterIsNull = false;
            }
            // determine if requestAnalyticsConfiguration_analyticsConfiguration_AnalyticsFilter should be set to null
            if (requestAnalyticsConfiguration_analyticsConfiguration_AnalyticsFilterIsNull)
            {
                requestAnalyticsConfiguration_analyticsConfiguration_AnalyticsFilter = null;
            }
            if (requestAnalyticsConfiguration_analyticsConfiguration_AnalyticsFilter != null)
            {
                request.AnalyticsConfiguration.AnalyticsFilter = requestAnalyticsConfiguration_analyticsConfiguration_AnalyticsFilter;
                requestAnalyticsConfigurationIsNull            = false;
            }
            Amazon.S3.Model.StorageClassAnalysis requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis = null;

            // populate StorageClassAnalysis
            var requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysisIsNull = true;

            requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis = new Amazon.S3.Model.StorageClassAnalysis();
            Amazon.S3.Model.StorageClassAnalysisDataExport requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis_analyticsConfiguration_StorageClassAnalysis_DataExport = null;

            // populate DataExport
            var requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis_analyticsConfiguration_StorageClassAnalysis_DataExportIsNull = true;

            requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis_analyticsConfiguration_StorageClassAnalysis_DataExport = new Amazon.S3.Model.StorageClassAnalysisDataExport();
            Amazon.S3.StorageClassAnalysisSchemaVersion requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis_analyticsConfiguration_StorageClassAnalysis_DataExport_dataExport_OutputSchemaVersion = null;
            if (cmdletContext.DataExport_OutputSchemaVersion != null)
            {
                requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis_analyticsConfiguration_StorageClassAnalysis_DataExport_dataExport_OutputSchemaVersion = cmdletContext.DataExport_OutputSchemaVersion;
            }
            if (requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis_analyticsConfiguration_StorageClassAnalysis_DataExport_dataExport_OutputSchemaVersion != null)
            {
                requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis_analyticsConfiguration_StorageClassAnalysis_DataExport.OutputSchemaVersion = requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis_analyticsConfiguration_StorageClassAnalysis_DataExport_dataExport_OutputSchemaVersion;
                requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis_analyticsConfiguration_StorageClassAnalysis_DataExportIsNull = false;
            }
            Amazon.S3.Model.AnalyticsExportDestination requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis_analyticsConfiguration_StorageClassAnalysis_DataExport_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination = null;

            // populate Destination
            var requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis_analyticsConfiguration_StorageClassAnalysis_DataExport_analyticsConfiguration_StorageClassAnalysis_DataExport_DestinationIsNull = true;

            requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis_analyticsConfiguration_StorageClassAnalysis_DataExport_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination = new Amazon.S3.Model.AnalyticsExportDestination();
            Amazon.S3.Model.AnalyticsS3BucketDestination requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis_analyticsConfiguration_StorageClassAnalysis_DataExport_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_S3BucketDestination = null;

            // populate S3BucketDestination
            var requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis_analyticsConfiguration_StorageClassAnalysis_DataExport_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_S3BucketDestinationIsNull = true;

            requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis_analyticsConfiguration_StorageClassAnalysis_DataExport_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_S3BucketDestination = new Amazon.S3.Model.AnalyticsS3BucketDestination();
            System.String requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis_analyticsConfiguration_StorageClassAnalysis_DataExport_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_S3BucketDestination_s3BucketDestination_Format = null;
            if (cmdletContext.S3BucketDestination_Format != null)
            {
                requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis_analyticsConfiguration_StorageClassAnalysis_DataExport_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_S3BucketDestination_s3BucketDestination_Format = cmdletContext.S3BucketDestination_Format;
            }
            if (requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis_analyticsConfiguration_StorageClassAnalysis_DataExport_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_S3BucketDestination_s3BucketDestination_Format != null)
            {
                requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis_analyticsConfiguration_StorageClassAnalysis_DataExport_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_S3BucketDestination.Format = requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis_analyticsConfiguration_StorageClassAnalysis_DataExport_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_S3BucketDestination_s3BucketDestination_Format;
                requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis_analyticsConfiguration_StorageClassAnalysis_DataExport_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_S3BucketDestinationIsNull  = false;
            }
            System.String requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis_analyticsConfiguration_StorageClassAnalysis_DataExport_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_S3BucketDestination_s3BucketDestination_BucketAccountId = null;
            if (cmdletContext.S3BucketDestination_BucketAccountId != null)
            {
                requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis_analyticsConfiguration_StorageClassAnalysis_DataExport_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_S3BucketDestination_s3BucketDestination_BucketAccountId = cmdletContext.S3BucketDestination_BucketAccountId;
            }
            if (requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis_analyticsConfiguration_StorageClassAnalysis_DataExport_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_S3BucketDestination_s3BucketDestination_BucketAccountId != null)
            {
                requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis_analyticsConfiguration_StorageClassAnalysis_DataExport_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_S3BucketDestination.BucketAccountId = requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis_analyticsConfiguration_StorageClassAnalysis_DataExport_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_S3BucketDestination_s3BucketDestination_BucketAccountId;
                requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis_analyticsConfiguration_StorageClassAnalysis_DataExport_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_S3BucketDestinationIsNull           = false;
            }
            System.String requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis_analyticsConfiguration_StorageClassAnalysis_DataExport_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_S3BucketDestination_s3BucketDestination_BucketName = null;
            if (cmdletContext.S3BucketDestination_BucketName != null)
            {
                requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis_analyticsConfiguration_StorageClassAnalysis_DataExport_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_S3BucketDestination_s3BucketDestination_BucketName = cmdletContext.S3BucketDestination_BucketName;
            }
            if (requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis_analyticsConfiguration_StorageClassAnalysis_DataExport_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_S3BucketDestination_s3BucketDestination_BucketName != null)
            {
                requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis_analyticsConfiguration_StorageClassAnalysis_DataExport_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_S3BucketDestination.BucketName = requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis_analyticsConfiguration_StorageClassAnalysis_DataExport_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_S3BucketDestination_s3BucketDestination_BucketName;
                requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis_analyticsConfiguration_StorageClassAnalysis_DataExport_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_S3BucketDestinationIsNull      = false;
            }
            System.String requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis_analyticsConfiguration_StorageClassAnalysis_DataExport_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_S3BucketDestination_s3BucketDestination_Prefix = null;
            if (cmdletContext.S3BucketDestination_Prefix != null)
            {
                requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis_analyticsConfiguration_StorageClassAnalysis_DataExport_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_S3BucketDestination_s3BucketDestination_Prefix = cmdletContext.S3BucketDestination_Prefix;
            }
            if (requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis_analyticsConfiguration_StorageClassAnalysis_DataExport_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_S3BucketDestination_s3BucketDestination_Prefix != null)
            {
                requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis_analyticsConfiguration_StorageClassAnalysis_DataExport_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_S3BucketDestination.Prefix = requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis_analyticsConfiguration_StorageClassAnalysis_DataExport_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_S3BucketDestination_s3BucketDestination_Prefix;
                requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis_analyticsConfiguration_StorageClassAnalysis_DataExport_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_S3BucketDestinationIsNull  = false;
            }
            // determine if requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis_analyticsConfiguration_StorageClassAnalysis_DataExport_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_S3BucketDestination should be set to null
            if (requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis_analyticsConfiguration_StorageClassAnalysis_DataExport_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_S3BucketDestinationIsNull)
            {
                requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis_analyticsConfiguration_StorageClassAnalysis_DataExport_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_S3BucketDestination = null;
            }
            if (requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis_analyticsConfiguration_StorageClassAnalysis_DataExport_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_S3BucketDestination != null)
            {
                requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis_analyticsConfiguration_StorageClassAnalysis_DataExport_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination.S3BucketDestination = requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis_analyticsConfiguration_StorageClassAnalysis_DataExport_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination_S3BucketDestination;
                requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis_analyticsConfiguration_StorageClassAnalysis_DataExport_analyticsConfiguration_StorageClassAnalysis_DataExport_DestinationIsNull = false;
            }
            // determine if requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis_analyticsConfiguration_StorageClassAnalysis_DataExport_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination should be set to null
            if (requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis_analyticsConfiguration_StorageClassAnalysis_DataExport_analyticsConfiguration_StorageClassAnalysis_DataExport_DestinationIsNull)
            {
                requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis_analyticsConfiguration_StorageClassAnalysis_DataExport_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination = null;
            }
            if (requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis_analyticsConfiguration_StorageClassAnalysis_DataExport_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination != null)
            {
                requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis_analyticsConfiguration_StorageClassAnalysis_DataExport.Destination = requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis_analyticsConfiguration_StorageClassAnalysis_DataExport_analyticsConfiguration_StorageClassAnalysis_DataExport_Destination;
                requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis_analyticsConfiguration_StorageClassAnalysis_DataExportIsNull       = false;
            }
            // determine if requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis_analyticsConfiguration_StorageClassAnalysis_DataExport should be set to null
            if (requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis_analyticsConfiguration_StorageClassAnalysis_DataExportIsNull)
            {
                requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis_analyticsConfiguration_StorageClassAnalysis_DataExport = null;
            }
            if (requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis_analyticsConfiguration_StorageClassAnalysis_DataExport != null)
            {
                requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis.DataExport = requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis_analyticsConfiguration_StorageClassAnalysis_DataExport;
                requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysisIsNull      = false;
            }
            // determine if requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis should be set to null
            if (requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysisIsNull)
            {
                requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis = null;
            }
            if (requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis != null)
            {
                request.AnalyticsConfiguration.StorageClassAnalysis = requestAnalyticsConfiguration_analyticsConfiguration_StorageClassAnalysis;
                requestAnalyticsConfigurationIsNull = false;
            }
            // determine if request.AnalyticsConfiguration should be set to null
            if (requestAnalyticsConfigurationIsNull)
            {
                request.AnalyticsConfiguration = null;
            }
            if (cmdletContext.ExpectedBucketOwner != null)
            {
                request.ExpectedBucketOwner = cmdletContext.ExpectedBucketOwner;
            }

            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);
        }
Example #4
0
        /// <summary>
        /// Initiates the asynchronous execution of the PutBucketAnalyticsConfiguration operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the PutBucketAnalyticsConfiguration operation on AmazonS3Client.</param>
        /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
        /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
        ///          procedure using the AsyncState property.</param>
        /// 
        /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndPutBucketAnalyticsConfiguration
        ///         operation.</returns>
        public IAsyncResult BeginPutBucketAnalyticsConfiguration(PutBucketAnalyticsConfigurationRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new PutBucketAnalyticsConfigurationRequestMarshaller();
            var unmarshaller = PutBucketAnalyticsConfigurationResponseUnmarshaller.Instance;

            return BeginInvoke<PutBucketAnalyticsConfigurationRequest>(request, marshaller, unmarshaller,
                callback, state);
        }
Example #5
0
        /// <summary>
        /// Sets an analytics configuration for the bucket (specified by the analytics configuration
        /// ID).
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the PutBucketAnalyticsConfiguration service method.</param>
        /// 
        /// <returns>The response from the PutBucketAnalyticsConfiguration service method, as returned by S3.</returns>
        public PutBucketAnalyticsConfigurationResponse PutBucketAnalyticsConfiguration(PutBucketAnalyticsConfigurationRequest request)
        {
            var marshaller = new PutBucketAnalyticsConfigurationRequestMarshaller();
            var unmarshaller = PutBucketAnalyticsConfigurationResponseUnmarshaller.Instance;

            return Invoke<PutBucketAnalyticsConfigurationRequest,PutBucketAnalyticsConfigurationResponse>(request, marshaller, unmarshaller);
        }
Example #6
0
        /// <summary>
        /// Initiates the asynchronous execution of the PutBucketAnalyticsConfiguration operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the PutBucketAnalyticsConfiguration operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        public Task<PutBucketAnalyticsConfigurationResponse> PutBucketAnalyticsConfigurationAsync(PutBucketAnalyticsConfigurationRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new PutBucketAnalyticsConfigurationRequestMarshaller();
            var unmarshaller = PutBucketAnalyticsConfigurationResponseUnmarshaller.Instance;

            return InvokeAsync<PutBucketAnalyticsConfigurationRequest,PutBucketAnalyticsConfigurationResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }
        public void BucketAnalyticsConfigurationsAndFilterTest()
        {
            Tag tag = new Tag()
            {
                Key = "tagK",
                Value = "tagV"
            };
            List<AnalyticsFilterPredicate> list = new List<AnalyticsFilterPredicate>();
            list.Add(new AnalyticsPrefixPredicate("string"));
            list.Add(new AnalyticsTagPredicate(tag));
            PutBucketAnalyticsConfigurationRequest putBucketAnalyticsConfigurationRequest = new PutBucketAnalyticsConfigurationRequest()
            {
                BucketName = bucketName,
                AnalyticsId = "configId",
                AnalyticsConfiguration = new AnalyticsConfiguration()
                {
                    AnalyticsFilter = new AnalyticsFilter()
                    {
                        AnalyticsFilterPredicate = new AnalyticsAndOperator(list)
                    },
                    AnalyticsId = "configId",
                    StorageClassAnalysis = new StorageClassAnalysis()
                    {
                        DataExport = new StorageClassAnalysisDataExport()
                        {
                            OutputSchemaVersion = StorageClassAnalysisSchemaVersion.V_1,
                            Destination = new AnalyticsExportDestination()
                            {
                                S3BucketDestination = new AnalyticsS3BucketDestination()
                                {
                                    Format = AnalyticsS3ExportFileFormat.CSV,
                                    BucketAccountId = "599169622985",
                                    Prefix = "string",
                                    BucketName = "arn:aws:s3:::" + bucketName
                                }
                            }
                        }
                    }
                }
            };
            var putBucketAnalyticsConfigurationResponse = Client.PutBucketAnalyticsConfiguration(putBucketAnalyticsConfigurationRequest);

            GetBucketAnalyticsConfigurationRequest getBucketAnalyticsConfigurationRequest = new GetBucketAnalyticsConfigurationRequest()
            {
                BucketName = bucketName,
                AnalyticsId = "configId"
            };

            var getBucketAnalyticsConfigurationResponse = Client.GetBucketAnalyticsConfiguration(getBucketAnalyticsConfigurationRequest);
            var getAnalyticsConfiguration = getBucketAnalyticsConfigurationResponse.AnalyticsConfiguration;
            var putAnalyticsConfiguration = putBucketAnalyticsConfigurationRequest.AnalyticsConfiguration;

            foreach (var predicate in ((AnalyticsNAryOperator)getAnalyticsConfiguration.AnalyticsFilter.AnalyticsFilterPredicate).Operands)
            {
                if (predicate is AnalyticsPrefixPredicate)
                {
                    Assert.AreEqual(((AnalyticsPrefixPredicate)predicate).Prefix, "string");
                }
                else
                {
                    Assert.AreEqual(((AnalyticsTagPredicate)predicate).Tag.Key, "tagK");
                    Assert.AreEqual(((AnalyticsTagPredicate)predicate).Tag.Value, "tagV");
                }
            }

            GetBucketAnalyticsValidation(getAnalyticsConfiguration, putAnalyticsConfiguration);

            ListBucketAnalytics();

            DeleteAnalyticsBucketAndValidate();


        }
        public void BucketAnalyticsConfigurationsPrefixFilterTest()
        {
            PutBucketAnalyticsConfigurationRequest putBucketAnalyticsConfigurationRequest = new PutBucketAnalyticsConfigurationRequest()
            {
                BucketName = bucketName,
                AnalyticsId = "configId",
                AnalyticsConfiguration = new AnalyticsConfiguration()
                {
                    AnalyticsFilter = new AnalyticsFilter()
                    {
                        AnalyticsFilterPredicate = new AnalyticsPrefixPredicate("string")
                    },
                    AnalyticsId = "configId",
                    StorageClassAnalysis = new StorageClassAnalysis()
                    {
                        DataExport = new StorageClassAnalysisDataExport()
                        {
                            OutputSchemaVersion = StorageClassAnalysisSchemaVersion.V_1,
                            Destination = new AnalyticsExportDestination()
                            {
                                S3BucketDestination = new AnalyticsS3BucketDestination()
                                {
                                    Format = AnalyticsS3ExportFileFormat.CSV,
                                    BucketAccountId = "599169622985",
                                    Prefix = "string",
                                    BucketName = "arn:aws:s3:::" + bucketName
                                }
                            }
                        }
                    }
                }
            };
            var putBucketAnalyticsConfigurationResponse = Client.PutBucketAnalyticsConfiguration(putBucketAnalyticsConfigurationRequest);

            GetBucketAnalyticsConfigurationRequest getBucketAnalyticsConfigurationRequest = new GetBucketAnalyticsConfigurationRequest()
            {
                BucketName = bucketName,
                AnalyticsId = "configId"
            };

            var getBucketAnalyticsConfigurationResponse = Client.GetBucketAnalyticsConfiguration(getBucketAnalyticsConfigurationRequest);
            var getAnalyticsConfiguration = getBucketAnalyticsConfigurationResponse.AnalyticsConfiguration;
            var putAnalyticsConfiguration = putBucketAnalyticsConfigurationRequest.AnalyticsConfiguration;

            Assert.AreEqual(((AnalyticsPrefixPredicate)getAnalyticsConfiguration.AnalyticsFilter.AnalyticsFilterPredicate).Prefix, "string");

            GetBucketAnalyticsValidation(getAnalyticsConfiguration, putAnalyticsConfiguration);


            ListBucketAnalytics();
            
            DeleteAnalyticsBucketAndValidate();
        }