Beispiel #1
0
        internal virtual DisableRuleResponse DisableRule(DisableRuleRequest request)
        {
            var marshaller   = DisableRuleRequestMarshaller.Instance;
            var unmarshaller = DisableRuleResponseUnmarshaller.Instance;

            return(Invoke <DisableRuleRequest, DisableRuleResponse>(request, marshaller, unmarshaller));
        }
Beispiel #2
0
        public async Task <IActionResult> OnPostEnableAsync(bool enable)
        {
            LogPageRequest(nameof(OnPostEnableAsync));

            List <Task> tasks = new List <Task>();

            tasks.Add(UpdatePhoneNumberAsync());
            tasks.Add(UpdateMessageAsync());
            await Task.WhenAll(tasks);

            if (enable)
            {
                EnableRuleRequest request = new EnableRuleRequest
                {
                    Name = SendEventRuleName,
                };
                await _cloudWatchEvents.EnableRuleAsync(request);
            }
            else
            {
                DisableRuleRequest request = new DisableRuleRequest
                {
                    Name = SendEventRuleName,
                };
                await _cloudWatchEvents.DisableRuleAsync(request);
            }

            LogPageResponse(nameof(OnPostEnableAsync));

            if (ModelState.IsValid)
            {
                return(RedirectToPage());
            }
            return(Page());
        }
Beispiel #3
0
        /// <summary>
        /// Disables a rule. A disabled rule won't match any events, and won't self-trigger if
        /// it has a schedule expression.
        ///
        ///
        /// <para>
        ///  <b>Note:</b> When you disable a rule, incoming events might still continue to match
        /// to the disabled rule. 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 DisableRule service method.</param>
        ///
        /// <returns>The response from the DisableRule 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.ResourceNotFoundException">
        /// The rule does not exist.
        /// </exception>
        public DisableRuleResponse DisableRule(DisableRuleRequest request)
        {
            var marshaller   = new DisableRuleRequestMarshaller();
            var unmarshaller = DisableRuleResponseUnmarshaller.Instance;

            return(Invoke <DisableRuleRequest, DisableRuleResponse>(request, marshaller, unmarshaller));
        }
Beispiel #4
0
        /// <summary>
        /// Initiates the asynchronous execution of the DisableRule operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the DisableRule 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 <DisableRuleResponse> DisableRuleAsync(DisableRuleRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = new DisableRuleRequestMarshaller();
            var unmarshaller = DisableRuleResponseUnmarshaller.Instance;

            return(InvokeAsync <DisableRuleRequest, DisableRuleResponse>(request, marshaller,
                                                                         unmarshaller, cancellationToken));
        }
        /// <summary>
        /// Initiates the asynchronous execution of the DisableRule operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the DisableRule 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>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/events-2015-10-07/DisableRule">REST API Reference for DisableRule Operation</seealso>
        public virtual Task <DisableRuleResponse> DisableRuleAsync(DisableRuleRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = DisableRuleRequestMarshaller.Instance;
            options.ResponseUnmarshaller = DisableRuleResponseUnmarshaller.Instance;

            return(InvokeAsync <DisableRuleResponse>(request, options, cancellationToken));
        }
        internal virtual DisableRuleResponse DisableRule(DisableRuleRequest request)
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = DisableRuleRequestMarshaller.Instance;
            options.ResponseUnmarshaller = DisableRuleResponseUnmarshaller.Instance;

            return(Invoke <DisableRuleResponse>(request, options));
        }
        public async Task DisableRuleAsync()
        {
            var request = new DisableRuleRequest()
            {
                DomainId = Domain.Id, RuleId = Rule.Id
            };
            var response = await mailinatorClient.RulesClient.DisableRuleAsync(request);

            Assert.IsTrue(response?.Status == "ok");
        }
Beispiel #8
0
        /// <summary>
        /// This endpoint allows you to disable an existing Rule
        /// </summary>
        /// <param name="request">DisableRuleRequest object.</param>
        /// <returns></returns>
        public async Task <DisableRuleResponse> DisableRuleAsync(DisableRuleRequest request)
        {
            var requestObject = httpClient.GetRequest(endpointUrl + "/{domain_id}/rules/{ruleId}/disable", Method.PUT);

            requestObject.AddUrlSegment("domain_id", request.DomainId);
            requestObject.AddUrlSegment("ruleId", request.RuleId);

            var response = await httpClient.ExecuteAsync <DisableRuleResponse>(requestObject);

            return(response);
        }
Beispiel #9
0
        public async Task <APIGatewayProxyResponse> ReceiveSmsAsync(APIGatewayProxyRequest proxyRequest, ILambdaContext context)
        {
            Dictionary <string, string> payload = QueryHelpers.ParseQuery(proxyRequest.Body)
                                                  .ToDictionary(pair => pair.Key, pair => pair.Value.FirstOrDefault());

            LogJson(new
            {
                Event     = "Request",
                RequestId = context.AwsRequestId,
                Headers   = proxyRequest.Headers,
                Body      = proxyRequest.Body,
                Message   = payload["Body"],
                Payload   = payload,
            });

            DisableRuleRequest request = new DisableRuleRequest
            {
                Name = SendEventRuleId,
            };
            await CweClient.DisableRuleAsync(request);

            MessagingResponse response = new MessagingResponse();
            Message           message  = new Message(body: "Waker Upper stopped!");

            response.Append(message);
            string responseBody = response.ToString();

            LogJson(new
            {
                Event     = "Response",
                RequestId = context.AwsRequestId,
                Body      = responseBody,
            });

            return(new APIGatewayProxyResponse
            {
                StatusCode = (int)System.Net.HttpStatusCode.OK,
                Headers = new Dictionary <string, string>
                {
                    { "Content-Type", "application/xml" },
                },
                Body = responseBody,
            });
        }