Container for the parameters to the TestMetricFilter operation. Tests the filter pattern of a metric filter against a sample of log event messages. You can use this operation to validate the correctness of a metric filter pattern.
Inheritance: AmazonCloudWatchLogsRequest
コード例 #1
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.CloudWatchLogs.Model.TestMetricFilterRequest();

            if (cmdletContext.FilterPattern != null)
            {
                request.FilterPattern = cmdletContext.FilterPattern;
            }
            if (cmdletContext.LogEventMessage != null)
            {
                request.LogEventMessages = cmdletContext.LogEventMessage;
            }

            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
        /// <summary>
        /// Initiates the asynchronous execution of the TestMetricFilter operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the TestMetricFilter 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<TestMetricFilterResponse> TestMetricFilterAsync(TestMetricFilterRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new TestMetricFilterRequestMarshaller();
            var unmarshaller = TestMetricFilterResponseUnmarshaller.Instance;

            return InvokeAsync<TestMetricFilterRequest,TestMetricFilterResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }
コード例 #3
0
        /// <summary>
        /// Tests the filter pattern of a metric filter against a sample of log event messages.
        /// You can use this operation to validate the correctness of a metric filter pattern.
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the TestMetricFilter service method.</param>
        /// 
        /// <returns>The response from the TestMetricFilter service method, as returned by CloudWatchLogs.</returns>
        /// <exception cref="Amazon.CloudWatchLogs.Model.InvalidParameterException">
        /// Returned if a parameter of the request is incorrectly specified.
        /// </exception>
        /// <exception cref="Amazon.CloudWatchLogs.Model.ServiceUnavailableException">
        /// Returned if the service cannot complete the request.
        /// </exception>
        public TestMetricFilterResponse TestMetricFilter(TestMetricFilterRequest request)
        {
            var marshaller = new TestMetricFilterRequestMarshaller();
            var unmarshaller = TestMetricFilterResponseUnmarshaller.Instance;

            return Invoke<TestMetricFilterRequest,TestMetricFilterResponse>(request, marshaller, unmarshaller);
        }
コード例 #4
0
        /// <summary>
        /// Initiates the asynchronous execution of the TestMetricFilter operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the TestMetricFilter operation on AmazonCloudWatchLogsClient.</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 EndTestMetricFilter
        ///         operation.</returns>
        public IAsyncResult BeginTestMetricFilter(TestMetricFilterRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new TestMetricFilterRequestMarshaller();
            var unmarshaller = TestMetricFilterResponseUnmarshaller.Instance;

            return BeginInvoke<TestMetricFilterRequest>(request, marshaller, unmarshaller,
                callback, state);
        }
コード例 #5
0
        IAsyncResult invokeTestMetricFilter(TestMetricFilterRequest request, AsyncCallback callback, object state, bool synchronized)
        {
            var marshaller = new TestMetricFilterRequestMarshaller();
            var unmarshaller = TestMetricFilterResponseUnmarshaller.Instance;

            return Invoke(request, callback, state, synchronized, marshaller, unmarshaller, signer);
        }
コード例 #6
0
 /// <summary>
 /// Initiates the asynchronous execution of the TestMetricFilter operation.
 /// <seealso cref="Amazon.CloudWatchLogs.IAmazonCloudWatchLogs"/>
 /// </summary>
 /// 
 /// <param name="request">Container for the necessary parameters to execute the TestMetricFilter operation on AmazonCloudWatchLogsClient.</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 EndTestMetricFilter
 ///         operation.</returns>
 public IAsyncResult BeginTestMetricFilter(TestMetricFilterRequest request, AsyncCallback callback, object state)
 {
     return invokeTestMetricFilter(request, callback, state, false);
 }
コード例 #7
0
 /// <summary>
 /// Tests the filter pattern of a metric filter against a sample of log event messages.
 /// You can use this operation to validate the correctness of a metric filter pattern.
 /// </summary>
 /// <param name="request">Container for the necessary parameters to execute the TestMetricFilter service method.</param>
 /// 
 /// <returns>The response from the TestMetricFilter service method, as returned by CloudWatchLogs.</returns>
 /// <exception cref="InvalidParameterException">
 /// Returned if a parameter of the request is incorrectly specified.
 /// </exception>
 /// <exception cref="ServiceUnavailableException">
 /// Returned if the service cannot complete the request.
 /// </exception>
 public TestMetricFilterResponse TestMetricFilter(TestMetricFilterRequest request)
 {
     IAsyncResult asyncResult = invokeTestMetricFilter(request, null, null, true);
     return EndTestMetricFilter(asyncResult);
 }
コード例 #8
0
 /// <summary>
 /// Tests the filter pattern of a metric filter against a sample of log event messages.
 /// You can use this operation to validate the correctness of a metric filter pattern.
 /// </summary>
 /// <param name="request">Container for the necessary parameters to execute the TestMetricFilter service method.</param>
 /// 
 /// <returns>The response from the TestMetricFilter service method, as returned by CloudWatchLogs.</returns>
 /// <exception cref="InvalidParameterException">
 /// Returned if a parameter of the request is incorrectly specified.
 /// </exception>
 /// <exception cref="ServiceUnavailableException">
 /// Returned if the service cannot complete the request.
 /// </exception>
 public TestMetricFilterResponse TestMetricFilter(TestMetricFilterRequest request)
 {
     var task = TestMetricFilterAsync(request);
     try
     {
         return task.Result;
     }
     catch(AggregateException e)
     {
         ExceptionDispatchInfo.Capture(e.InnerException).Throw();
         return null;
     }
 }
コード例 #9
0
 private Amazon.CloudWatchLogs.Model.TestMetricFilterResponse CallAWSServiceOperation(IAmazonCloudWatchLogs client, Amazon.CloudWatchLogs.Model.TestMetricFilterRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon CloudWatch Logs", "TestMetricFilter");
     try
     {
         #if DESKTOP
         return(client.TestMetricFilter(request));
         #elif CORECLR
         return(client.TestMetricFilterAsync(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;
     }
 }