protected override void ProcessRecord()
 {
     AmazonS3 client = base.GetClient();
     Amazon.S3.Model.GetBucketLoggingRequest request = new Amazon.S3.Model.GetBucketLoggingRequest();
     request.BucketName = this._BucketName;
     Amazon.S3.Model.GetBucketLoggingResponse response = client.GetBucketLogging(request);
 }
예제 #2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.S3.Model.GetBucketLoggingRequest();

            if (cmdletContext.BucketName != null)
            {
                request.BucketName = cmdletContext.BucketName;
            }
            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);
        }
예제 #3
0
 IAsyncResult invokeGetBucketLogging(GetBucketLoggingRequest getBucketLoggingRequest, AsyncCallback callback, object state, bool synchronized)
 {
     IRequest irequest = new GetBucketLoggingRequestMarshaller().Marshall(getBucketLoggingRequest);
     var unmarshaller = GetBucketLoggingResponseUnmarshaller.GetInstance();
     AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller);
     Invoke(result);
     return result;
 }
예제 #4
0
 /// <summary>
 /// Initiates the asynchronous execution of the GetBucketLogging operation.
 /// <seealso cref="Amazon.S3.IAmazonS3.GetBucketLogging"/>
 /// </summary>
 /// 
 /// <param name="getBucketLoggingRequest">Container for the necessary parameters to execute the GetBucketLogging operation on AmazonS3.</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 EndGetBucketLogging
 ///         operation.</returns>
 public IAsyncResult BeginGetBucketLogging(GetBucketLoggingRequest getBucketLoggingRequest, AsyncCallback callback, object state)
 {
     return invokeGetBucketLogging(getBucketLoggingRequest, callback, state, false);
 }
예제 #5
0
 /// <summary>
 /// <para>Returns the logging status of a bucket and the permissions users have to view and modify that status. To use GET, you must be the
 /// bucket owner.</para>
 /// </summary>
 /// 
 /// <param name="getBucketLoggingRequest">Container for the necessary parameters to execute the GetBucketLogging service method on
 ///          AmazonS3.</param>
 /// 
 /// <returns>The response from the GetBucketLogging service method, as returned by AmazonS3.</returns>
 /// 
 public GetBucketLoggingResponse GetBucketLogging(GetBucketLoggingRequest getBucketLoggingRequest)
 {
     IAsyncResult asyncResult = invokeGetBucketLogging(getBucketLoggingRequest, null, null, true);
     return EndGetBucketLogging(asyncResult);
 }
예제 #6
0
 /// <summary>
 /// Initiates the asynchronous execution of the GetBucketLogging operation.
 /// </summary>
 /// 
 /// <param name="request">Container for the necessary parameters to execute the GetBucketLogging 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 GetBucketLoggingAsync(GetBucketLoggingRequest request, AmazonServiceCallback<GetBucketLoggingRequest, GetBucketLoggingResponse> callback, AsyncOptions options = null)
 {
     options = options == null?new AsyncOptions():options;
     var marshaller = new GetBucketLoggingRequestMarshaller();
     var unmarshaller = GetBucketLoggingResponseUnmarshaller.Instance;
     Action<AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper = null;
     if(callback !=null )
         callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => { 
             AmazonServiceResult<GetBucketLoggingRequest,GetBucketLoggingResponse> responseObject 
                     = new AmazonServiceResult<GetBucketLoggingRequest,GetBucketLoggingResponse>((GetBucketLoggingRequest)req, (GetBucketLoggingResponse)res, ex , ao.State);    
                 callback(responseObject); 
         };
     BeginInvoke<GetBucketLoggingRequest>(request, marshaller, unmarshaller, options, callbackHelper);
 }
예제 #7
0
 /// <summary>
 /// Returns the logging status of a bucket and the permissions users have to view and
 /// modify that status. To use GET, you must be the bucket owner.
 /// </summary>
 /// <param name="bucketName">A property of GetBucketLoggingRequest used to execute the GetBucketLogging service method.</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>
 /// 
 /// <returns>The response from the GetBucketLogging service method, as returned by S3.</returns>
 public void GetBucketLoggingAsync(string bucketName,  AmazonServiceCallback<GetBucketLoggingRequest, GetBucketLoggingResponse> callback, AsyncOptions options = null)
 {
     var request = new GetBucketLoggingRequest();
     request.BucketName = bucketName;
     GetBucketLoggingAsync(request, callback, options);
 }
예제 #8
0
 /// <summary>
 /// Returns the logging status of a bucket and the permissions users have to view and
 /// modify that status. To use GET, you must be the bucket owner.
 /// </summary>
 /// <param name="bucketName">A property of GetBucketLoggingRequest used to execute the GetBucketLogging service method.</param>
 /// <param name="cancellationToken">
 ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
 /// </param>
 /// 
 /// <returns>The response from the GetBucketLogging service method, as returned by S3.</returns>
 public Task<GetBucketLoggingResponse> GetBucketLoggingAsync(string bucketName, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
 {
     var request = new GetBucketLoggingRequest();
     request.BucketName = bucketName;
     return GetBucketLoggingAsync(request, cancellationToken);
 }
        public void BucketE_GetBucketLoggingTest()
        {
            bool expectedValue = true;
            bool actualValue = false;
            bool hasCallbackArrived = false;

            S3ResponseEventHandler<object, ResponseEventArgs> handler = null;
            handler = delegate(object sender, ResponseEventArgs args)
            {
                IS3Response result = args.Response;
                //Unhook from event.
                _client.OnS3Response -= handler;
                GetBucketLoggingResponse response = result as GetBucketLoggingResponse;
                if (null != response)
                    actualValue = response.IsRequestSuccessful;
                hasCallbackArrived = true;
            };

            GetBucketLoggingRequest request = new GetBucketLoggingRequest() { BucketName = _bucketNameForBucketAPIs };

            _client.OnS3Response += handler;
            _client.GetBucketLogging(request);

            EnqueueConditional(() => hasCallbackArrived);
            EnqueueCallback(() => Assert.IsTrue(expectedValue == actualValue,
                string.Format("Expected Value = {0}, Actual Value = {1}", expectedValue, actualValue)));
            EnqueueTestComplete();
        }
예제 #10
0
        /// <summary>
        /// Initiates the asynchronous execution of the GetBucketLogging operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the GetBucketLogging 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 EndGetBucketLogging
        ///         operation.</returns>
        public IAsyncResult BeginGetBucketLogging(GetBucketLoggingRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new GetBucketLoggingRequestMarshaller();
            var unmarshaller = GetBucketLoggingResponseUnmarshaller.Instance;

            return BeginInvoke<GetBucketLoggingRequest>(request, marshaller, unmarshaller,
                callback, state);
        }
예제 #11
0
        /// <summary>
        /// Initiates the asynchronous execution of the GetBucketLogging operation.
        /// <seealso cref="Amazon.S3.IAmazonS3.GetBucketLogging"/>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the GetBucketLogging 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<GetBucketLoggingResponse> GetBucketLoggingAsync(GetBucketLoggingRequest request, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new GetBucketLoggingRequestMarshaller();
            var unmarshaller = GetBucketLoggingResponseUnmarshaller.GetInstance();
            return Invoke<IRequest, GetBucketLoggingRequest, GetBucketLoggingResponse>(request, marshaller, unmarshaller, signer, cancellationToken);
        }
예제 #12
0
        /// <summary>
        /// <para>Returns the logging status of a bucket and the permissions users have to view and modify that status. To use GET, you must be the
        /// bucket owner.</para>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the GetBucketLogging service method on
        /// AmazonS3.</param>
        /// 
        /// <returns>The response from the GetBucketLogging service method, as returned by AmazonS3.</returns>
		public GetBucketLoggingResponse GetBucketLogging(GetBucketLoggingRequest request)
        {
            var task = GetBucketLoggingAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                throw e.InnerException;
            }
        }
예제 #13
0
        /// <summary>
        /// <para>Returns the logging status of a bucket and the permissions users have to view and modify that status. To use GET, you must be the
        /// bucket owner.</para>
        /// </summary>
        /// 
        /// <param name="getBucketLoggingRequest">Container for the necessary parameters to execute the GetBucketLogging service method on
        /// AmazonS3.</param>
        /// 
        /// <returns>The response from the GetBucketLogging service method, as returned by AmazonS3.</returns>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
		public async Task<GetBucketLoggingResponse> GetBucketLoggingAsync(GetBucketLoggingRequest getBucketLoggingRequest, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new GetBucketLoggingRequestMarshaller();
            var unmarshaller = GetBucketLoggingResponseUnmarshaller.GetInstance();
            var response = await Invoke<IRequest, GetBucketLoggingRequest, GetBucketLoggingResponse>(getBucketLoggingRequest, marshaller, unmarshaller, signer, cancellationToken)
                .ConfigureAwait(continueOnCapturedContext: false);
            return response;
        }
예제 #14
0
        /// <summary>
        /// <para>Returns the logging status of a bucket and the permissions users have to view and modify that status. To use GET, you must be the
        /// bucket owner.</para>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the GetBucketLogging service method on
        /// AmazonS3.</param>
        /// 
        /// <returns>The response from the GetBucketLogging service method, as returned by AmazonS3.</returns>
		public GetBucketLoggingResponse GetBucketLogging(GetBucketLoggingRequest request)
        {
            var task = GetBucketLoggingAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                ExceptionDispatchInfo.Capture(e.InnerException).Throw();
                return null;
            }
        }
예제 #15
0
 private Amazon.S3.Model.GetBucketLoggingResponse CallAWSServiceOperation(IAmazonS3 client, Amazon.S3.Model.GetBucketLoggingRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Simple Storage Service (S3)", "GetBucketLogging");
     try
     {
         #if DESKTOP
         return(client.GetBucketLogging(request));
         #elif CORECLR
         return(client.GetBucketLoggingAsync(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;
     }
 }
예제 #16
0
        internal GetBucketLoggingResponse GetBucketLogging(GetBucketLoggingRequest request)
        {
            var marshaller = new GetBucketLoggingRequestMarshaller();
            var unmarshaller = GetBucketLoggingResponseUnmarshaller.Instance;

            return Invoke<GetBucketLoggingRequest,GetBucketLoggingResponse>(request, marshaller, unmarshaller);
        }
예제 #17
0
        /// <summary>
        /// Initiates the asynchronous execution of the GetBucketLogging operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the GetBucketLogging 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<GetBucketLoggingResponse> GetBucketLoggingAsync(GetBucketLoggingRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new GetBucketLoggingRequestMarshaller();
            var unmarshaller = GetBucketLoggingResponseUnmarshaller.Instance;

            return InvokeAsync<GetBucketLoggingRequest,GetBucketLoggingResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }
예제 #18
0
 /// <summary>
 /// Returns the logging status of a bucket and the permissions users have to view and
 /// modify that status. To use GET, you must be the bucket owner.
 /// </summary>
 /// <param name="bucketName">A property of GetBucketLoggingRequest used to execute the GetBucketLogging service method.</param>
 /// 
 /// <returns>The response from the GetBucketLogging service method, as returned by S3.</returns>
 public GetBucketLoggingResponse GetBucketLogging(string bucketName)
 {
     var request = new GetBucketLoggingRequest();
     request.BucketName = bucketName;
     return GetBucketLogging(request);
 }