Container for the parameters to the GetBucketAnalyticsConfiguration operation.

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

Inheritance: Amazon.Runtime.AmazonWebServiceRequest
Example #1
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.S3.Model.GetBucketAnalyticsConfigurationRequest();

            if (cmdletContext.BucketName != null)
            {
                request.BucketName = cmdletContext.BucketName;
            }
            if (cmdletContext.AnalyticsId != null)
            {
                request.AnalyticsId = cmdletContext.AnalyticsId;
            }
            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 #2
0
 /// <summary>
 /// Initiates the asynchronous execution of the GetBucketAnalyticsConfiguration operation.
 /// </summary>
 /// 
 /// <param name="request">Container for the necessary parameters to execute the GetBucketAnalyticsConfiguration 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 GetBucketAnalyticsConfigurationAsync(GetBucketAnalyticsConfigurationRequest request, AmazonServiceCallback<GetBucketAnalyticsConfigurationRequest, GetBucketAnalyticsConfigurationResponse> callback, AsyncOptions options = null)
 {
     options = options == null?new AsyncOptions():options;
     var marshaller = new GetBucketAnalyticsConfigurationRequestMarshaller();
     var unmarshaller = GetBucketAnalyticsConfigurationResponseUnmarshaller.Instance;
     Action<AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper = null;
     if(callback !=null )
         callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => { 
             AmazonServiceResult<GetBucketAnalyticsConfigurationRequest,GetBucketAnalyticsConfigurationResponse> responseObject 
                     = new AmazonServiceResult<GetBucketAnalyticsConfigurationRequest,GetBucketAnalyticsConfigurationResponse>((GetBucketAnalyticsConfigurationRequest)req, (GetBucketAnalyticsConfigurationResponse)res, ex , ao.State);    
                 callback(responseObject); 
         };
     BeginInvoke<GetBucketAnalyticsConfigurationRequest>(request, marshaller, unmarshaller, options, callbackHelper);
 }
Example #3
0
 private Amazon.S3.Model.GetBucketAnalyticsConfigurationResponse CallAWSServiceOperation(IAmazonS3 client, Amazon.S3.Model.GetBucketAnalyticsConfigurationRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Simple Storage Service (S3)", "GetBucketAnalyticsConfiguration");
     try
     {
         #if DESKTOP
         return(client.GetBucketAnalyticsConfiguration(request));
         #elif CORECLR
         return(client.GetBucketAnalyticsConfigurationAsync(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 #4
0
        /// <summary>
        /// Initiates the asynchronous execution of the GetBucketAnalyticsConfiguration operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the GetBucketAnalyticsConfiguration 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 EndGetBucketAnalyticsConfiguration
        ///         operation.</returns>
        public IAsyncResult BeginGetBucketAnalyticsConfiguration(GetBucketAnalyticsConfigurationRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new GetBucketAnalyticsConfigurationRequestMarshaller();
            var unmarshaller = GetBucketAnalyticsConfigurationResponseUnmarshaller.Instance;

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

            return Invoke<GetBucketAnalyticsConfigurationRequest,GetBucketAnalyticsConfigurationResponse>(request, marshaller, unmarshaller);
        }
Example #6
0
        /// <summary>
        /// Initiates the asynchronous execution of the GetBucketAnalyticsConfiguration operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the GetBucketAnalyticsConfiguration 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<GetBucketAnalyticsConfigurationResponse> GetBucketAnalyticsConfigurationAsync(GetBucketAnalyticsConfigurationRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new GetBucketAnalyticsConfigurationRequestMarshaller();
            var unmarshaller = GetBucketAnalyticsConfigurationResponseUnmarshaller.Instance;

            return InvokeAsync<GetBucketAnalyticsConfigurationRequest,GetBucketAnalyticsConfigurationResponse>(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();
        }