Exemplo n.º 1
0
        /// <summary>Snippet for SetUrlMapAsync</summary>
        public async Task SetUrlMapAsync()
        {
            // Snippet: SetUrlMapAsync(string, string, UrlMapReference, CallSettings)
            // Additional: SetUrlMapAsync(string, string, UrlMapReference, CancellationToken)
            // Create client
            TargetHttpsProxiesClient targetHttpsProxiesClient = await TargetHttpsProxiesClient.CreateAsync();

            // Initialize request argument(s)
            string          project                 = "";
            string          targetHttpsProxy        = "";
            UrlMapReference urlMapReferenceResource = new UrlMapReference();
            // Make the request
            Operation response = await targetHttpsProxiesClient.SetUrlMapAsync(project, targetHttpsProxy, urlMapReferenceResource);

            // End snippet
        }
        /// <summary>
        /// Changes the URL map for TargetHttpsProxy.
        /// Documentation https://developers.google.com/compute/v1/reference/targetHttpsProxies/setUrlMap
        /// 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="targetHttpsProxy">Name of the TargetHttpsProxy resource whose URL map is to be set.</param>
        /// <param name="body">A valid Compute v1 body.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>OperationResponse</returns>
        public static Operation SetUrlMap(ComputeService service, string project, string targetHttpsProxy, UrlMapReference body, TargetHttpsProxiesSetUrlMapOptionalParms 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);
                }
                if (targetHttpsProxy == null)
                {
                    throw new ArgumentNullException(targetHttpsProxy);
                }

                // Building the initial request.
                var request = service.TargetHttpsProxies.SetUrlMap(body, project, targetHttpsProxy);

                // Applying optional parameters to the request.
                request = (TargetHttpsProxiesResource.SetUrlMapRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request TargetHttpsProxies.SetUrlMap failed.", ex);
            }
        }
        /// <summary>
        /// Changes the URL map for TargetHttpProxy.
        /// Documentation https://developers.google.com/compute/beta/reference/targetHttpProxies/setUrlMap
        /// 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="targetHttpProxy">Name of the TargetHttpProxy to set a URL map for.</param>
        /// <param name="body">A valid compute beta body.</param>
        /// <returns>OperationResponse</returns>
        public static Operation SetUrlMap(computeService service, string project, string targetHttpProxy, UrlMapReference 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);
                }
                if (targetHttpProxy == null)
                {
                    throw new ArgumentNullException(targetHttpProxy);
                }

                // Make the request.
                return(service.TargetHttpProxies.SetUrlMap(body, project, targetHttpProxy).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request TargetHttpProxies.SetUrlMap failed.", ex);
            }
        }