Example #1
0
        /// <summary>
        /// Adds target(s) to a rule. Targets are the resources that can be invoked when a rule
        /// is triggered. For example, AWS Lambda functions, Amazon Kinesis streams, and built-in
        /// targets. Updates the target(s) if they are already associated with the role. In other
        /// words, if there is already a target with the given target ID, then the target associated
        /// with that ID is updated.
        ///
        ///
        /// <para>
        /// In order to be able to make API calls against the resources you own, Amazon CloudWatch
        /// Events needs the appropriate permissions. For AWS Lambda and Amazon SNS resources,
        /// CloudWatch Events relies on resource-based policies. For Amazon Kinesis streams, CloudWatch
        /// Events relies on IAM roles. For more information, see <a href="http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/EventsTargetPermissions.html">Permissions
        /// for Sending Events to Targets</a> in the <b><i>Amazon CloudWatch Developer Guide</i></b>.
        /// </para>
        ///
        /// <para>
        /// <b>Input</b> and <b>InputPath</b> are mutually-exclusive and optional parameters of
        /// a target. When a rule is triggered due to a matched event, if for a target:
        /// </para>
        ///  <ul> <li>Neither <b>Input</b> nor <b>InputPath</b> is specified, then the entire
        /// event is passed to the target in JSON form.</li> <li><b>InputPath</b> is specified
        /// in the form of JSONPath (e.g. <b>$.detail</b>), then only the part of the event specified
        /// in the path is passed to the target (e.g. only the detail part of the event is passed).
        /// </li> <li><b>Input</b> is specified in the form of a valid JSON, then the matched
        /// event is overridden with this constant.</li> </ul>
        /// <para>
        ///  <b>Note:</b> When you add targets to a rule, when the associated rule triggers, new
        /// or updated targets might not be immediately invoked. Please allow a short period of
        /// time for changes to take effect.
        /// </para>
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the PutTargets service method.</param>
        ///
        /// <returns>The response from the PutTargets service method, as returned by CloudWatchEvents.</returns>
        /// <exception cref="Amazon.CloudWatchEvents.Model.ConcurrentModificationException">
        /// This exception occurs if there is concurrent modification on rule or target.
        /// </exception>
        /// <exception cref="Amazon.CloudWatchEvents.Model.InternalException">
        /// This exception occurs due to unexpected causes.
        /// </exception>
        /// <exception cref="Amazon.CloudWatchEvents.Model.LimitExceededException">
        /// This exception occurs if you try to create more rules or add more targets to a rule
        /// than allowed by default.
        /// </exception>
        /// <exception cref="Amazon.CloudWatchEvents.Model.ResourceNotFoundException">
        /// The rule does not exist.
        /// </exception>
        public PutTargetsResponse PutTargets(PutTargetsRequest request)
        {
            var marshaller   = new PutTargetsRequestMarshaller();
            var unmarshaller = PutTargetsResponseUnmarshaller.Instance;

            return(Invoke <PutTargetsRequest, PutTargetsResponse>(request, marshaller, unmarshaller));
        }
        public void PutTargetsMarshallTest()
        {
            var request    = InstantiateClassGenerator.Execute <PutTargetsRequest>();
            var marshaller = new PutTargetsRequestMarshaller();

            var internalRequest = marshaller.Marshall(request);
            var jsonRequest     = UTF8Encoding.UTF8.GetString(internalRequest.Content);

            Comparer.CompareObjectToJson <PutTargetsRequest>(request, jsonRequest);

            var webResponse = new WebResponseData
            {
                Headers =
                {
                    { "x-amzn-RequestId", Guid.NewGuid().ToString() },
                    { "x-amz-crc32",      "0"                       }
                }
            };
            var jsonResponse = new JsonSampleGenerator(service_model, service_model.FindOperation("PutTargets").ResponseStructure).Execute();

            webResponse.Headers.Add("Content-Length", UTF8Encoding.UTF8.GetBytes(jsonResponse).Length.ToString());
            UnmarshallerContext context = new JsonUnmarshallerContext(Utils.CreateStreamFromString(jsonResponse), false, webResponse);
            var response = PutTargetsResponseUnmarshaller.Instance.Unmarshall(context)
                           as PutTargetsResponse;

            InstantiateClassGenerator.ValidateObjectFullyInstantiated(response);
        }
Example #3
0
        /// <summary>
        /// Initiates the asynchronous execution of the PutTargets operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the PutTargets 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 <PutTargetsResponse> PutTargetsAsync(PutTargetsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = new PutTargetsRequestMarshaller();
            var unmarshaller = PutTargetsResponseUnmarshaller.Instance;

            return(InvokeAsync <PutTargetsRequest, PutTargetsResponse>(request, marshaller,
                                                                       unmarshaller, cancellationToken));
        }
        /// <summary>
        /// Initiates the asynchronous execution of the PutTargets operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the PutTargets operation on AmazonCloudWatchEventsClient.</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 EndPutTargets
        ///         operation.</returns>
        public IAsyncResult BeginPutTargets(PutTargetsRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new PutTargetsRequestMarshaller();
            var unmarshaller = PutTargetsResponseUnmarshaller.Instance;

            return BeginInvoke<PutTargetsRequest>(request, marshaller, unmarshaller,
                callback, state);
        }
        /// <summary>
        /// Adds target(s) to a rule. Targets are the resources that can be invoked when a rule
        /// is triggered. For example, AWS Lambda functions, Amazon Kinesis streams, and built-in
        /// targets. Updates the target(s) if they are already associated with the role. In other
        /// words, if there is already a target with the given target ID, then the target associated
        /// with that ID is updated.
        /// 
        ///  
        /// <para>
        /// In order to be able to make API calls against the resources you own, Amazon CloudWatch
        /// Events needs the appropriate permissions. For AWS Lambda and Amazon SNS resources,
        /// CloudWatch Events relies on resource-based policies. For Amazon Kinesis streams, CloudWatch
        /// Events relies on IAM roles. For more information, see <a href="http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/EventsTargetPermissions.html">Permissions
        /// for Sending Events to Targets</a> in the <b><i>Amazon CloudWatch Developer Guide</i></b>.
        /// </para>
        ///  
        /// <para>
        /// <b>Input</b> and <b>InputPath</b> are mutually-exclusive and optional parameters of
        /// a target. When a rule is triggered due to a matched event, if for a target:
        /// </para>
        ///  <ul> <li>Neither <b>Input</b> nor <b>InputPath</b> is specified, then the entire
        /// event is passed to the target in JSON form.</li> <li><b>InputPath</b> is specified
        /// in the form of JSONPath (e.g. <b>$.detail</b>), then only the part of the event specified
        /// in the path is passed to the target (e.g. only the detail part of the event is passed).
        /// </li> <li><b>Input</b> is specified in the form of a valid JSON, then the matched
        /// event is overridden with this constant.</li> </ul> 
        /// <para>
        ///  <b>Note:</b> When you add targets to a rule, when the associated rule triggers, new
        /// or updated targets might not be immediately invoked. Please allow a short period of
        /// time for changes to take effect. 
        /// </para>
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the PutTargets service method.</param>
        /// 
        /// <returns>The response from the PutTargets service method, as returned by CloudWatchEvents.</returns>
        /// <exception cref="Amazon.CloudWatchEvents.Model.ConcurrentModificationException">
        /// This exception occurs if there is concurrent modification on rule or target.
        /// </exception>
        /// <exception cref="Amazon.CloudWatchEvents.Model.InternalException">
        /// This exception occurs due to unexpected causes.
        /// </exception>
        /// <exception cref="Amazon.CloudWatchEvents.Model.LimitExceededException">
        /// This exception occurs if you try to create more rules or add more targets to a rule
        /// than allowed by default.
        /// </exception>
        /// <exception cref="Amazon.CloudWatchEvents.Model.ResourceNotFoundException">
        /// The rule does not exist.
        /// </exception>
        public PutTargetsResponse PutTargets(PutTargetsRequest request)
        {
            var marshaller = new PutTargetsRequestMarshaller();
            var unmarshaller = PutTargetsResponseUnmarshaller.Instance;

            return Invoke<PutTargetsRequest,PutTargetsResponse>(request, marshaller, unmarshaller);
        }
        public void PutTargetsMarshallTest()
        {
            var request = InstantiateClassGenerator.Execute<PutTargetsRequest>();
            var marshaller = new PutTargetsRequestMarshaller();

            var internalRequest = marshaller.Marshall(request);
            var jsonRequest = UTF8Encoding.UTF8.GetString(internalRequest.Content);
            Comparer.CompareObjectToJson<PutTargetsRequest>(request,jsonRequest);

            var webResponse = new WebResponseData
            {
                Headers = {
                    {"x-amzn-RequestId", Guid.NewGuid().ToString()},
                    {"x-amz-crc32","0"}
                }
            };
            var jsonResponse = new JsonSampleGenerator(service_model, service_model.FindOperation("PutTargets").ResponseStructure).Execute();
            webResponse.Headers.Add("Content-Length", UTF8Encoding.UTF8.GetBytes(jsonResponse).Length.ToString());
            UnmarshallerContext context = new JsonUnmarshallerContext(Utils.CreateStreamFromString(jsonResponse), false, webResponse);
            var response = PutTargetsResponseUnmarshaller.Instance.Unmarshall(context)
                as PutTargetsResponse;
            InstantiateClassGenerator.ValidateObjectFullyInstantiated(response);
        }
        /// <summary>
        /// Initiates the asynchronous execution of the PutTargets operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the PutTargets 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<PutTargetsResponse> PutTargetsAsync(PutTargetsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new PutTargetsRequestMarshaller();
            var unmarshaller = PutTargetsResponseUnmarshaller.Instance;

            return InvokeAsync<PutTargetsRequest,PutTargetsResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }