/// <summary>Snippet for InvalidateCache</summary>
 public void InvalidateCache()
 {
     // Snippet: InvalidateCache(string, string, CacheInvalidationRule, CallSettings)
     // Create client
     UrlMapsClient urlMapsClient = UrlMapsClient.Create();
     // Initialize request argument(s)
     string project = "";
     string urlMap  = "";
     CacheInvalidationRule cacheInvalidationRuleResource = new CacheInvalidationRule();
     // Make the request
     Operation response = urlMapsClient.InvalidateCache(project, urlMap, cacheInvalidationRuleResource);
     // End snippet
 }
        /// <summary>Snippet for InvalidateCacheAsync</summary>
        public async Task InvalidateCacheAsync()
        {
            // Snippet: InvalidateCacheAsync(string, string, CacheInvalidationRule, CallSettings)
            // Additional: InvalidateCacheAsync(string, string, CacheInvalidationRule, CancellationToken)
            // Create client
            UrlMapsClient urlMapsClient = await UrlMapsClient.CreateAsync();

            // Initialize request argument(s)
            string project = "";
            string urlMap  = "";
            CacheInvalidationRule cacheInvalidationRuleResource = new CacheInvalidationRule();
            // Make the request
            Operation response = await urlMapsClient.InvalidateCacheAsync(project, urlMap, cacheInvalidationRuleResource);

            // End snippet
        }
예제 #3
0
        /// <summary>
        /// Initiates a cache invalidation operation, invalidating the specified path, scoped to the specified UrlMap.
        /// Documentation https://developers.google.com/compute/alpha/reference/urlMaps/invalidateCache
        /// 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="urlMap">Name of the UrlMap scoping this request.</param>
        /// <param name="body">A valid Compute alpha body.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>OperationResponse</returns>
        public static Operation InvalidateCache(ComputeService service, string project, string urlMap, CacheInvalidationRule body, UrlMapsInvalidateCacheOptionalParms 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 (urlMap == null)
                {
                    throw new ArgumentNullException(urlMap);
                }

                // Building the initial request.
                var request = service.UrlMaps.InvalidateCache(body, project, urlMap);

                // Applying optional parameters to the request.
                request = (UrlMapsResource.InvalidateCacheRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request UrlMaps.InvalidateCache failed.", ex);
            }
        }
        /// <summary>
        /// Initiates a cache invalidation operation, invalidating the specified path, scoped to the specified UrlMap.
        /// Documentation https://developers.google.com/compute/v1/reference/urlMaps/invalidateCache
        /// 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="urlMap">Name of the UrlMap scoping this request.</param>
        /// <param name="body">A valid compute v1 body.</param>
        /// <returns>OperationResponse</returns>
        public static Operation InvalidateCache(computeService service, string project, string urlMap, CacheInvalidationRule 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 (urlMap == null)
                {
                    throw new ArgumentNullException(urlMap);
                }

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