Exemplo n.º 1
0
        /// <summary>
        /// Creates a TargetSslProxy resource in the specified project using the data included in the request.
        /// Documentation https://developers.google.com/compute/v1/reference/targetSslProxies/insert
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated Compute service.</param>
        /// <param name="project">Project ID for this request.</param>
        /// <param name="body">A valid Compute v1 body.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>OperationResponse</returns>
        public static Operation Insert(ComputeService service, string project, TargetSslProxy body, TargetSslProxiesInsertOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (project == null)
                {
                    throw new ArgumentNullException(project);
                }

                // Building the initial request.
                var request = service.TargetSslProxies.Insert(body, project);

                // Applying optional parameters to the request.
                request = (TargetSslProxiesResource.InsertRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request TargetSslProxies.Insert failed.", ex);
            }
        }
        /// <summary>
        /// Creates a TargetSslProxy resource in the specified project using the data included in the request.
        /// Documentation https://developers.google.com/compute/alpha/reference/targetSslProxies/insert
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated compute service.</param>
        /// <param name="project">Project ID for this request.</param>
        /// <param name="body">A valid compute alpha body.</param>
        /// <returns>OperationResponse</returns>
        public static Operation Insert(computeService service, string project, TargetSslProxy body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (project == null)
                {
                    throw new ArgumentNullException(project);
                }

                // Make the request.
                return(service.TargetSslProxies.Insert(body, project).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request TargetSslProxies.Insert failed.", ex);
            }
        }
        public void GetRequestObject()
        {
            moq::Mock <TargetSslProxies.TargetSslProxiesClient> mockGrpcClient = new moq::Mock <TargetSslProxies.TargetSslProxiesClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClientForGlobalOperations()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            GetTargetSslProxyRequest request = new GetTargetSslProxyRequest
            {
                Project        = "projectaa6ff846",
                TargetSslProxy = "target_ssl_proxy8c6691c6",
            };
            TargetSslProxy expectedResponse = new TargetSslProxy
            {
                Id   = 11672635353343658936UL,
                Kind = "kindf7aa39d9",
                Name = "name1c9368b0",
                CreationTimestamp = "creation_timestamp235e59a1",
                ProxyHeader       = "proxy_headercff40018",
                SslPolicy         = "ssl_policybf005a65",
                SslCertificates   =
                {
                    "ssl_certificates50ceaff5",
                },
                Service     = "serviced3f0abaa",
                Description = "description2cf9da67",
                SelfLink    = "self_link7e87f12d",
            };

            mockGrpcClient.Setup(x => x.Get(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            TargetSslProxiesClient client   = new TargetSslProxiesClientImpl(mockGrpcClient.Object, null);
            TargetSslProxy         response = client.Get(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
 /// <summary>Snippet for Insert</summary>
 public void Insert()
 {
     // Snippet: Insert(string, TargetSslProxy, CallSettings)
     // Create client
     TargetSslProxiesClient targetSslProxiesClient = TargetSslProxiesClient.Create();
     // Initialize request argument(s)
     string         project = "";
     TargetSslProxy targetSslProxyResource = new TargetSslProxy();
     // Make the request
     Operation response = targetSslProxiesClient.Insert(project, targetSslProxyResource);
     // End snippet
 }
 /// <summary>Snippet for Get</summary>
 public void Get()
 {
     // Snippet: Get(string, string, CallSettings)
     // Create client
     TargetSslProxiesClient targetSslProxiesClient = TargetSslProxiesClient.Create();
     // Initialize request argument(s)
     string project        = "";
     string targetSslProxy = "";
     // Make the request
     TargetSslProxy response = targetSslProxiesClient.Get(project, targetSslProxy);
     // End snippet
 }
 /// <summary>Snippet for Get</summary>
 public void GetRequestObject()
 {
     // Snippet: Get(GetTargetSslProxyRequest, CallSettings)
     // Create client
     TargetSslProxiesClient targetSslProxiesClient = TargetSslProxiesClient.Create();
     // Initialize request argument(s)
     GetTargetSslProxyRequest request = new GetTargetSslProxyRequest
     {
         Project        = "",
         TargetSslProxy = "",
     };
     // Make the request
     TargetSslProxy response = targetSslProxiesClient.Get(request);
     // End snippet
 }
        /// <summary>Snippet for InsertAsync</summary>
        public async Task InsertAsync()
        {
            // Snippet: InsertAsync(string, TargetSslProxy, CallSettings)
            // Additional: InsertAsync(string, TargetSslProxy, CancellationToken)
            // Create client
            TargetSslProxiesClient targetSslProxiesClient = await TargetSslProxiesClient.CreateAsync();

            // Initialize request argument(s)
            string         project = "";
            TargetSslProxy targetSslProxyResource = new TargetSslProxy();
            // Make the request
            Operation response = await targetSslProxiesClient.InsertAsync(project, targetSslProxyResource);

            // End snippet
        }
        /// <summary>Snippet for GetAsync</summary>
        public async Task GetAsync()
        {
            // Snippet: GetAsync(string, string, CallSettings)
            // Additional: GetAsync(string, string, CancellationToken)
            // Create client
            TargetSslProxiesClient targetSslProxiesClient = await TargetSslProxiesClient.CreateAsync();

            // Initialize request argument(s)
            string project        = "";
            string targetSslProxy = "";
            // Make the request
            TargetSslProxy response = await targetSslProxiesClient.GetAsync(project, targetSslProxy);

            // End snippet
        }
        /// <summary>Snippet for GetAsync</summary>
        public async Task GetRequestObjectAsync()
        {
            // Snippet: GetAsync(GetTargetSslProxyRequest, CallSettings)
            // Additional: GetAsync(GetTargetSslProxyRequest, CancellationToken)
            // Create client
            TargetSslProxiesClient targetSslProxiesClient = await TargetSslProxiesClient.CreateAsync();

            // Initialize request argument(s)
            GetTargetSslProxyRequest request = new GetTargetSslProxyRequest
            {
                Project        = "",
                TargetSslProxy = "",
            };
            // Make the request
            TargetSslProxy response = await targetSslProxiesClient.GetAsync(request);

            // End snippet
        }
        public async stt::Task GetRequestObjectAsync()
        {
            moq::Mock <TargetSslProxies.TargetSslProxiesClient> mockGrpcClient = new moq::Mock <TargetSslProxies.TargetSslProxiesClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClientForGlobalOperations()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            GetTargetSslProxyRequest request = new GetTargetSslProxyRequest
            {
                Project        = "projectaa6ff846",
                TargetSslProxy = "target_ssl_proxy8c6691c6",
            };
            TargetSslProxy expectedResponse = new TargetSslProxy
            {
                Id   = 11672635353343658936UL,
                Kind = "kindf7aa39d9",
                Name = "name1c9368b0",
                CreationTimestamp = "creation_timestamp235e59a1",
                ProxyHeader       = TargetSslProxy.Types.ProxyHeader.UndefinedProxyHeader,
                SslPolicy         = "ssl_policybf005a65",
                SslCertificates   =
                {
                    "ssl_certificates50ceaff5",
                },
                Service     = "serviced3f0abaa",
                Description = "description2cf9da67",
                SelfLink    = "self_link7e87f12d",
            };

            mockGrpcClient.Setup(x => x.GetAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <TargetSslProxy>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            TargetSslProxiesClient client = new TargetSslProxiesClientImpl(mockGrpcClient.Object, null);
            TargetSslProxy         responseCallSettings = await client.GetAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            TargetSslProxy responseCancellationToken = await client.GetAsync(request, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }