Ejemplo n.º 1
0
        internal virtual DeleteWebhookResponse DeleteWebhook(DeleteWebhookRequest request)
        {
            var marshaller   = new DeleteWebhookRequestMarshaller();
            var unmarshaller = DeleteWebhookResponseUnmarshaller.Instance;

            return(Invoke <DeleteWebhookRequest, DeleteWebhookResponse>(request, marshaller, unmarshaller));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initiates the asynchronous execution of the DeleteWebhook operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the DeleteWebhook 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/codebuild-2016-10-06/DeleteWebhook">REST API Reference for DeleteWebhook Operation</seealso>
        public virtual Task <DeleteWebhookResponse> DeleteWebhookAsync(DeleteWebhookRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = new DeleteWebhookRequestMarshaller();
            var unmarshaller = DeleteWebhookResponseUnmarshaller.Instance;

            return(InvokeAsync <DeleteWebhookRequest, DeleteWebhookResponse>(request, marshaller,
                                                                             unmarshaller, cancellationToken));
        }
        /// <summary>
        /// Initiates the asynchronous execution of the DeleteWebhook operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the DeleteWebhook 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/codebuild-2016-10-06/DeleteWebhook">REST API Reference for DeleteWebhook Operation</seealso>
        public virtual Task <DeleteWebhookResponse> DeleteWebhookAsync(DeleteWebhookRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = DeleteWebhookRequestMarshaller.Instance;
            options.ResponseUnmarshaller = DeleteWebhookResponseUnmarshaller.Instance;

            return(InvokeAsync <DeleteWebhookResponse>(request, options, cancellationToken));
        }
        internal virtual DeleteWebhookResponse DeleteWebhook(DeleteWebhookRequest request)
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = DeleteWebhookRequestMarshaller.Instance;
            options.ResponseUnmarshaller = DeleteWebhookResponseUnmarshaller.Instance;

            return(Invoke <DeleteWebhookResponse>(request, options));
        }
Ejemplo n.º 5
0
        public void Should_Not_Serialize_MethodName_When_Not_Parameterless_Webhook_Responses()
        {
            DeleteWebhookRequest deleteWebhookRequest = new DeleteWebhookRequest
            {
                IsWebhookResponse = false
            };

            HttpContent content = deleteWebhookRequest.ToHttpContent();

            Assert.Null(content);
        }
Ejemplo n.º 6
0
        public void Should_Build_HttpContent_In_Parameterless_Webhook_Response()
        {
            DeleteWebhookRequest deleteWebhookRequest = new DeleteWebhookRequest
            {
                IsWebhookResponse = true
            };

            HttpContent content = deleteWebhookRequest.ToHttpContent();

            Assert.NotNull(content);
        }
Ejemplo n.º 7
0
        public void Should_Serialize_Empty_Object_When_Not_Parameterless_Webhook_Response()
        {
            DeleteWebhookRequest deleteWebhookRequest = new DeleteWebhookRequest
            {
                IsWebhookResponse = false
            };

            string request = JsonConvert.SerializeObject(deleteWebhookRequest);

            Assert.Equal("{}", request);
        }
Ejemplo n.º 8
0
        public void Should_Serialize_MethodName_In_Parameterless_Webhook_Responses()
        {
            DeleteWebhookRequest deleteWebhookRequest = new DeleteWebhookRequest
            {
                IsWebhookResponse = true
            };

            string request = JsonConvert.SerializeObject(deleteWebhookRequest);

            Assert.Equal(@"{""method"":""deleteWebhook""}", request);
        }
Ejemplo n.º 9
0
        public void Should_Serialize_Empty_Object_When_Not_Parameterless_Webhook_Response()
        {
            DeleteWebhookRequest deleteWebhookRequest = new DeleteWebhookRequest
            {
                IsWebhookResponse = false
            };

            string request = JsonSerializer.Serialize(deleteWebhookRequest, new JsonSerializerOptions(JsonSerializerDefaults.Web));

            Assert.Equal("{}", request);
        }
Ejemplo n.º 10
0
        public void Should_Serialize_MethodName_In_Parameterless_Webhook_Responses()
        {
            DeleteWebhookRequest deleteWebhookRequest = new DeleteWebhookRequest
            {
                IsWebhookResponse = true
            };

            string request = JsonSerializer.Serialize(deleteWebhookRequest, new JsonSerializerOptions(JsonSerializerDefaults.Web));

            Assert.Equal(@"{""method"":""deleteWebhook""}", request);
        }
Ejemplo n.º 11
0
        public async Task Should_Build_StringContent_With_MethodName_In_Parameterless_Webhook_ResponseAsync()
        {
            DeleteWebhookRequest deleteWebhookRequest = new DeleteWebhookRequest
            {
                IsWebhookResponse = true
            };

            HttpContent content = deleteWebhookRequest.ToHttpContent();

            Assert.IsType <StringContent>(content);
            StringContent stringContent = (StringContent)content;
            string        body          = await stringContent.ReadAsStringAsync();

            Assert.Equal(@"{""method"":""deleteWebhook""}", body);
        }
        /// <summary>Snippet for DeleteWebhook</summary>
        public void DeleteWebhookRequestObject()
        {
            // Snippet: DeleteWebhook(DeleteWebhookRequest, CallSettings)
            // Create client
            WebhooksClient webhooksClient = WebhooksClient.Create();
            // Initialize request argument(s)
            DeleteWebhookRequest request = new DeleteWebhookRequest
            {
                WebhookName = WebhookName.FromProjectLocationAgentWebhook("[PROJECT]", "[LOCATION]", "[AGENT]", "[WEBHOOK]"),
                Force       = false,
            };

            // Make the request
            webhooksClient.DeleteWebhook(request);
            // End snippet
        }
        public void DeleteWebhookResourceNames()
        {
            moq::Mock <Webhooks.WebhooksClient> mockGrpcClient = new moq::Mock <Webhooks.WebhooksClient>(moq::MockBehavior.Strict);
            DeleteWebhookRequest request = new DeleteWebhookRequest
            {
                WebhookName = WebhookName.FromProjectLocationAgentWebhook("[PROJECT]", "[LOCATION]", "[AGENT]", "[WEBHOOK]"),
            };
            wkt::Empty expectedResponse = new wkt::Empty {
            };

            mockGrpcClient.Setup(x => x.DeleteWebhook(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            WebhooksClient client = new WebhooksClientImpl(mockGrpcClient.Object, null);

            client.DeleteWebhook(request.WebhookName);
            mockGrpcClient.VerifyAll();
        }
Ejemplo n.º 14
0
        public async void TestDelete()
        {
            String accessToken       = this.RandomString();
            String webhookId         = this.RandomString();
            DeleteWebhookRequest req = new DeleteWebhookRequest();

            req.WebhookId = webhookId;
            MockAPI <Webhooks> mock = this.MockFor <Webhooks>(
                HttpMethod.Post,
                "/api/v1/webhooks.delete",
                m => m.WithContent(req.ToString()).Respond("application/json", "{}")
                );
            APIResponse <dynamic> res = await mock.Instance.Delete(accessToken, webhookId, null);

            mock.Handler.VerifyNoOutstandingExpectation();
            Assert.Equal(System.Net.HttpStatusCode.OK, res.Status);
        }
        /// <summary>Snippet for DeleteWebhookAsync</summary>
        public async Task DeleteWebhookRequestObjectAsync()
        {
            // Snippet: DeleteWebhookAsync(DeleteWebhookRequest, CallSettings)
            // Additional: DeleteWebhookAsync(DeleteWebhookRequest, CancellationToken)
            // Create client
            WebhooksClient webhooksClient = await WebhooksClient.CreateAsync();

            // Initialize request argument(s)
            DeleteWebhookRequest request = new DeleteWebhookRequest
            {
                WebhookName = WebhookName.FromProjectLocationAgentWebhook("[PROJECT]", "[LOCATION]", "[AGENT]", "[WEBHOOK]"),
                Force       = false,
            };
            // Make the request
            await webhooksClient.DeleteWebhookAsync(request);

            // End snippet
        }
        public async stt::Task DeleteWebhookResourceNamesAsync()
        {
            moq::Mock <Webhooks.WebhooksClient> mockGrpcClient = new moq::Mock <Webhooks.WebhooksClient>(moq::MockBehavior.Strict);
            DeleteWebhookRequest request = new DeleteWebhookRequest
            {
                WebhookName = WebhookName.FromProjectLocationAgentWebhook("[PROJECT]", "[LOCATION]", "[AGENT]", "[WEBHOOK]"),
            };
            wkt::Empty expectedResponse = new wkt::Empty {
            };

            mockGrpcClient.Setup(x => x.DeleteWebhookAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <wkt::Empty>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            WebhooksClient client = new WebhooksClientImpl(mockGrpcClient.Object, null);
            await client.DeleteWebhookAsync(request.WebhookName, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            await client.DeleteWebhookAsync(request.WebhookName, st::CancellationToken.None);

            mockGrpcClient.VerifyAll();
        }