Container for the parameters to the EnableLogging operation. Starts logging information, such as queries and connection attempts, for the specified Amazon Redshift cluster.
Наследование: AmazonRedshiftRequest
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.Redshift.Model.EnableLoggingRequest();

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

            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);
        }
Пример #2
0
 IAsyncResult invokeEnableLogging(EnableLoggingRequest enableLoggingRequest, AsyncCallback callback, object state, bool synchronized)
 {
     IRequest irequest = new EnableLoggingRequestMarshaller().Marshall(enableLoggingRequest);
     var unmarshaller = EnableLoggingResponseUnmarshaller.GetInstance();
     AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller);
     Invoke(result);
     return result;
 }
Пример #3
0
 /// <summary>
 /// Initiates the asynchronous execution of the EnableLogging operation.
 /// <seealso cref="Amazon.Redshift.IAmazonRedshift.EnableLogging"/>
 /// </summary>
 /// 
 /// <param name="enableLoggingRequest">Container for the necessary parameters to execute the EnableLogging operation on AmazonRedshift.</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 EndEnableLogging
 ///         operation.</returns>
 public IAsyncResult BeginEnableLogging(EnableLoggingRequest enableLoggingRequest, AsyncCallback callback, object state)
 {
     return invokeEnableLogging(enableLoggingRequest, callback, state, false);
 }
Пример #4
0
 /// <summary>
 /// <para>Starts logging information, such as queries and connection attempts, for the specified Amazon Redshift cluster.</para>
 /// </summary>
 /// 
 /// <param name="enableLoggingRequest">Container for the necessary parameters to execute the EnableLogging service method on
 ///          AmazonRedshift.</param>
 /// 
 /// <returns>The response from the EnableLogging service method, as returned by AmazonRedshift.</returns>
 /// 
 /// <exception cref="InvalidS3KeyPrefixException"/>
 /// <exception cref="InvalidS3BucketNameException"/>
 /// <exception cref="BucketNotFoundException"/>
 /// <exception cref="ClusterNotFoundException"/>
 /// <exception cref="InsufficientS3BucketPolicyException"/>
 public EnableLoggingResponse EnableLogging(EnableLoggingRequest enableLoggingRequest)
 {
     IAsyncResult asyncResult = invokeEnableLogging(enableLoggingRequest, null, null, true);
     return EndEnableLogging(asyncResult);
 }
Пример #5
0
        /// <summary>
        /// Initiates the asynchronous execution of the EnableLogging operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the EnableLogging operation on AmazonRedshiftClient.</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 EndEnableLogging
        ///         operation.</returns>
        public IAsyncResult BeginEnableLogging(EnableLoggingRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new EnableLoggingRequestMarshaller();
            var unmarshaller = EnableLoggingResponseUnmarshaller.Instance;

            return BeginInvoke<EnableLoggingRequest>(request, marshaller, unmarshaller,
                callback, state);
        }
Пример #6
0
        /// <summary>
        /// Starts logging information, such as queries and connection attempts, for the specified
        /// Amazon Redshift cluster.
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the EnableLogging service method.</param>
        /// 
        /// <returns>The response from the EnableLogging service method, as returned by Redshift.</returns>
        /// <exception cref="Amazon.Redshift.Model.BucketNotFoundException">
        /// Could not find the specified S3 bucket.
        /// </exception>
        /// <exception cref="Amazon.Redshift.Model.ClusterNotFoundException">
        /// The <i>ClusterIdentifier</i> parameter does not refer to an existing cluster.
        /// </exception>
        /// <exception cref="Amazon.Redshift.Model.InsufficientS3BucketPolicyException">
        /// The cluster does not have read bucket or put object permissions on the S3 bucket
        /// specified when enabling logging.
        /// </exception>
        /// <exception cref="Amazon.Redshift.Model.InvalidS3BucketNameException">
        /// The S3 bucket name is invalid. For more information about naming rules, go to <a href="http://docs.aws.amazon.com/AmazonS3/latest/dev/BucketRestrictions.html">Bucket
        /// Restrictions and Limitations</a> in the Amazon Simple Storage Service (S3) Developer
        /// Guide.
        /// </exception>
        /// <exception cref="Amazon.Redshift.Model.InvalidS3KeyPrefixException">
        /// The string specified for the logging S3 key prefix does not comply with the documented
        /// constraints.
        /// </exception>
        public EnableLoggingResponse EnableLogging(EnableLoggingRequest request)
        {
            var marshaller = new EnableLoggingRequestMarshaller();
            var unmarshaller = EnableLoggingResponseUnmarshaller.Instance;

            return Invoke<EnableLoggingRequest,EnableLoggingResponse>(request, marshaller, unmarshaller);
        }
Пример #7
0
        /// <summary>
        /// <para>Starts logging information, such as queries and connection attempts, for the specified Amazon Redshift cluster.</para>
        /// </summary>
        /// 
        /// <param name="enableLoggingRequest">Container for the necessary parameters to execute the EnableLogging service method on
        /// AmazonRedshift.</param>
        /// 
        /// <returns>The response from the EnableLogging service method, as returned by AmazonRedshift.</returns>
        /// 
        /// <exception cref="T:Amazon.Redshift.Model.InvalidS3KeyPrefixException" />
        /// <exception cref="T:Amazon.Redshift.Model.InvalidS3BucketNameException" />
        /// <exception cref="T:Amazon.Redshift.Model.BucketNotFoundException" />
        /// <exception cref="T:Amazon.Redshift.Model.ClusterNotFoundException" />
        /// <exception cref="T:Amazon.Redshift.Model.InsufficientS3BucketPolicyException" />
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
		public Task<EnableLoggingResponse> EnableLoggingAsync(EnableLoggingRequest enableLoggingRequest, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new EnableLoggingRequestMarshaller();
            var unmarshaller = EnableLoggingResponseUnmarshaller.GetInstance();
            return Invoke<IRequest, EnableLoggingRequest, EnableLoggingResponse>(enableLoggingRequest, marshaller, unmarshaller, signer, cancellationToken);
        }
Пример #8
0
		internal EnableLoggingResponse EnableLogging(EnableLoggingRequest request)
        {
            var task = EnableLoggingAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                ExceptionDispatchInfo.Capture(e.InnerException).Throw();
                return null;
            }
        }
        /// <summary>
        /// <para>Starts logging information, such as queries and connection attempts, for the specified Amazon Redshift cluster.</para>
        /// </summary>
        /// 
        /// <param name="enableLoggingRequest">Container for the necessary parameters to execute the EnableLogging service method on
        /// AmazonRedshift.</param>
        /// 
        /// <returns>The response from the EnableLogging service method, as returned by AmazonRedshift.</returns>
        /// 
        /// <exception cref="T:Amazon.Redshift.Model.InvalidS3KeyPrefixException" />
        /// <exception cref="T:Amazon.Redshift.Model.InvalidS3BucketNameException" />
        /// <exception cref="T:Amazon.Redshift.Model.BucketNotFoundException" />
        /// <exception cref="T:Amazon.Redshift.Model.ClusterNotFoundException" />
        /// <exception cref="T:Amazon.Redshift.Model.InsufficientS3BucketPolicyException" />
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
		public async Task<EnableLoggingResponse> EnableLoggingAsync(EnableLoggingRequest enableLoggingRequest, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new EnableLoggingRequestMarshaller();
            var unmarshaller = EnableLoggingResponseUnmarshaller.GetInstance();
            var response = await Invoke<IRequest, EnableLoggingRequest, EnableLoggingResponse>(enableLoggingRequest, marshaller, unmarshaller, signer, cancellationToken)
                .ConfigureAwait(continueOnCapturedContext: false);
            return response;
        }
Пример #10
0
		internal EnableLoggingResponse EnableLogging(EnableLoggingRequest request)
        {
            var task = EnableLoggingAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                throw e.InnerException;
            }
        }
Пример #11
0
        /// <summary>
        /// Initiates the asynchronous execution of the EnableLogging operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the EnableLogging 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<EnableLoggingResponse> EnableLoggingAsync(EnableLoggingRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new EnableLoggingRequestMarshaller();
            var unmarshaller = EnableLoggingResponseUnmarshaller.Instance;

            return InvokeAsync<EnableLoggingRequest,EnableLoggingResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }
        IAsyncResult invokeEnableLogging(EnableLoggingRequest request, AsyncCallback callback, object state, bool synchronized)
        {
            var marshaller = new EnableLoggingRequestMarshaller();
            var unmarshaller = EnableLoggingResponseUnmarshaller.Instance;

            return Invoke(request, callback, state, synchronized, marshaller, unmarshaller, signer);
        }
 private Amazon.Redshift.Model.EnableLoggingResponse CallAWSServiceOperation(IAmazonRedshift client, Amazon.Redshift.Model.EnableLoggingRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Redshift", "EnableLogging");
     try
     {
         #if DESKTOP
         return(client.EnableLogging(request));
         #elif CORECLR
         return(client.EnableLoggingAsync(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;
     }
 }