コード例 #1
0
        /// <summary>
        /// Adds a list of instances to the specified instance group. All of the instances in the instance group must be in the same network/subnetwork. Read  Adding instances for more information.
        /// Documentation https://developers.google.com/compute/beta/reference/instanceGroups/addInstances
        /// 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="zone">The name of the zone where the instance group is located.</param>
        /// <param name="instanceGroup">The name of the instance group where you are adding instances.</param>
        /// <param name="body">A valid Compute beta body.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>OperationResponse</returns>
        public static Operation AddInstances(ComputeService service, string project, string zone, string instanceGroup, InstanceGroupsAddInstancesRequest body, InstanceGroupsAddInstancesOptionalParms 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 (zone == null)
                {
                    throw new ArgumentNullException(zone);
                }
                if (instanceGroup == null)
                {
                    throw new ArgumentNullException(instanceGroup);
                }

                // Building the initial request.
                var request = service.InstanceGroups.AddInstances(body, project, zone, instanceGroup);

                // Applying optional parameters to the request.
                request = (InstanceGroupsResource.AddInstancesRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request InstanceGroups.AddInstances failed.", ex);
            }
        }
コード例 #2
0
        /// <summary>
        /// Changes target URL for forwarding rule. The new target should be of the same type as the old target.
        /// Documentation https://developers.google.com/compute/beta/reference/forwardingRules/setTarget
        /// 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="region">Name of the region scoping this request.</param>
        /// <param name="forwardingRule">Name of the ForwardingRule resource in which target is to be set.</param>
        /// <param name="body">A valid Compute beta body.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>OperationResponse</returns>
        public static Operation SetTarget(ComputeService service, string project, string region, string forwardingRule, TargetReference body, ForwardingRulesSetTargetOptionalParms 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 (region == null)
                {
                    throw new ArgumentNullException(region);
                }
                if (forwardingRule == null)
                {
                    throw new ArgumentNullException(forwardingRule);
                }

                // Building the initial request.
                var request = service.ForwardingRules.SetTarget(body, project, region, forwardingRule);

                // Applying optional parameters to the request.
                request = (ForwardingRulesResource.SetTargetRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request ForwardingRules.SetTarget failed.", ex);
            }
        }
コード例 #3
0
        /// <summary>
        /// Adds health check URLs to a target pool.
        /// Documentation https://developers.google.com/compute/beta/reference/targetPools/addHealthCheck
        /// 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="region">Name of the region scoping this request.</param>
        /// <param name="targetPool">Name of the target pool to add a health check to.</param>
        /// <param name="body">A valid Compute beta body.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>OperationResponse</returns>
        public static Operation AddHealthCheck(ComputeService service, string project, string region, string targetPool, TargetPoolsAddHealthCheckRequest body, TargetPoolsAddHealthCheckOptionalParms 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 (region == null)
                {
                    throw new ArgumentNullException(region);
                }
                if (targetPool == null)
                {
                    throw new ArgumentNullException(targetPool);
                }

                // Building the initial request.
                var request = service.TargetPools.AddHealthCheck(body, project, region, targetPool);

                // Applying optional parameters to the request.
                request = (TargetPoolsResource.AddHealthCheckRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request TargetPools.AddHealthCheck failed.", ex);
            }
        }
コード例 #4
0
        /// <summary>
        /// Set whether VMs in this subnet can access Google services without assigning external IP addresses through Private Google Access.
        /// Documentation https://developers.google.com/compute/beta/reference/subnetworks/setPrivateIpGoogleAccess
        /// 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="region">Name of the region scoping this request.</param>
        /// <param name="subnetwork">Name of the Subnetwork resource.</param>
        /// <param name="body">A valid Compute beta body.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>OperationResponse</returns>
        public static Operation SetPrivateIpGoogleAccess(ComputeService service, string project, string region, string subnetwork, SubnetworksSetPrivateIpGoogleAccessRequest body, SubnetworksSetPrivateIpGoogleAccessOptionalParms 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 (region == null)
                {
                    throw new ArgumentNullException(region);
                }
                if (subnetwork == null)
                {
                    throw new ArgumentNullException(subnetwork);
                }

                // Building the initial request.
                var request = service.Subnetworks.SetPrivateIpGoogleAccess(body, project, region, subnetwork);

                // Applying optional parameters to the request.
                request = (SubnetworksResource.SetPrivateIpGoogleAccessRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Subnetworks.SetPrivateIpGoogleAccess failed.", ex);
            }
        }
コード例 #5
0
        /// <summary>
        /// Sets the named ports for the specified regional instance group.
        /// Documentation https://developers.google.com/compute/beta/reference/regionInstanceGroups/setNamedPorts
        /// 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="region">Name of the region scoping this request.</param>
        /// <param name="instanceGroup">The name of the regional instance group where the named ports are updated.</param>
        /// <param name="body">A valid Compute beta body.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>OperationResponse</returns>
        public static Operation SetNamedPorts(ComputeService service, string project, string region, string instanceGroup, RegionInstanceGroupsSetNamedPortsRequest body, RegionInstanceGroupsSetNamedPortsOptionalParms 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 (region == null)
                {
                    throw new ArgumentNullException(region);
                }
                if (instanceGroup == null)
                {
                    throw new ArgumentNullException(instanceGroup);
                }

                // Building the initial request.
                var request = service.RegionInstanceGroups.SetNamedPorts(body, project, region, instanceGroup);

                // Applying optional parameters to the request.
                request = (RegionInstanceGroupsResource.SetNamedPortsRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request RegionInstanceGroups.SetNamedPorts failed.", ex);
            }
        }
コード例 #6
0
        /// <summary>
        /// Updates the specified regional BackendService resource with the data included in the request. There are several restrictions and guidelines to keep in mind when updating a backend service. Read  Restrictions and Guidelines for more information.
        /// Documentation https://developers.google.com/compute/beta/reference/regionBackendServices/update
        /// 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="region">Name of the region scoping this request.</param>
        /// <param name="backendService">Name of the BackendService resource to update.</param>
        /// <param name="body">A valid Compute beta body.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>OperationResponse</returns>
        public static Operation Update(ComputeService service, string project, string region, string backendService, BackendService body, RegionBackendServicesUpdateOptionalParms 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 (region == null)
                {
                    throw new ArgumentNullException(region);
                }
                if (backendService == null)
                {
                    throw new ArgumentNullException(backendService);
                }

                // Building the initial request.
                var request = service.RegionBackendServices.Update(body, project, region, backendService);

                // Applying optional parameters to the request.
                request = (RegionBackendServicesResource.UpdateRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request RegionBackendServices.Update failed.", ex);
            }
        }
コード例 #7
0
        /// <summary>
        /// Patches the specified Router resource with the data included in the request. This method supports PATCH semantics and uses JSON merge patch format and processing rules.
        /// Documentation https://developers.google.com/compute/beta/reference/routers/patch
        /// 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="region">Name of the region for this request.</param>
        /// <param name="router">Name of the Router resource to patch.</param>
        /// <param name="body">A valid Compute beta body.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>OperationResponse</returns>
        public static Operation Patch(ComputeService service, string project, string region, string router, Router body, RoutersPatchOptionalParms 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 (region == null)
                {
                    throw new ArgumentNullException(region);
                }
                if (router == null)
                {
                    throw new ArgumentNullException(router);
                }

                // Building the initial request.
                var request = service.Routers.Patch(body, project, region, router);

                // Applying optional parameters to the request.
                request = (RoutersResource.PatchRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Routers.Patch failed.", ex);
            }
        }
コード例 #8
0
        /// <summary>
        /// Sets the labels on a disk. To learn more about labels, read the Labeling Resources documentation.
        /// Documentation https://developers.google.com/compute/beta/reference/disks/setLabels
        /// 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="zone">The name of the zone for this request.</param>
        /// <param name="resource">Name of the resource for this request.</param>
        /// <param name="body">A valid Compute beta body.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>OperationResponse</returns>
        public static Operation SetLabels(ComputeService service, string project, string zone, string resource, ZoneSetLabelsRequest body, DisksSetLabelsOptionalParms 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 (zone == null)
                {
                    throw new ArgumentNullException(zone);
                }
                if (resource == null)
                {
                    throw new ArgumentNullException(resource);
                }

                // Building the initial request.
                var request = service.Disks.SetLabels(body, project, zone, resource);

                // Applying optional parameters to the request.
                request = (DisksResource.SetLabelsRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Disks.SetLabels failed.", ex);
            }
        }
コード例 #9
0
        /// <summary>
        /// Sets the deprecation status of an image.If an empty request body is given, clears the deprecation status instead.
        /// Documentation https://developers.google.com/compute/beta/reference/images/deprecate
        /// 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="image">Image name.</param>
        /// <param name="body">A valid Compute beta body.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>OperationResponse</returns>
        public static Operation Deprecate(ComputeService service, string project, string image, DeprecationStatus body, ImagesDeprecateOptionalParms 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 (image == null)
                {
                    throw new ArgumentNullException(image);
                }

                // Building the initial request.
                var request = service.Images.Deprecate(body, project, image);

                // Applying optional parameters to the request.
                request = (ImagesResource.DeprecateRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Images.Deprecate failed.", ex);
            }
        }
コード例 #10
0
        /// <summary>
        /// Updates a HttpHealthCheck resource in the specified project using the data included in the request.
        /// Documentation https://developers.google.com/compute/beta/reference/httpHealthChecks/update
        /// 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="httpHealthCheck">Name of the HttpHealthCheck resource to update.</param>
        /// <param name="body">A valid Compute beta body.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>OperationResponse</returns>
        public static Operation Update(ComputeService service, string project, string httpHealthCheck, HttpHealthCheck body, HttpHealthChecksUpdateOptionalParms 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 (httpHealthCheck == null)
                {
                    throw new ArgumentNullException(httpHealthCheck);
                }

                // Building the initial request.
                var request = service.HttpHealthChecks.Update(body, project, httpHealthCheck);

                // Applying optional parameters to the request.
                request = (HttpHealthChecksResource.UpdateRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request HttpHealthChecks.Update failed.", ex);
            }
        }
コード例 #11
0
        /// <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>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>OperationResponse</returns>
        public static Operation SetUrlMap(ComputeService service, string project, string targetHttpProxy, UrlMapReference body, TargetHttpProxiesSetUrlMapOptionalParms 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 (targetHttpProxy == null)
                {
                    throw new ArgumentNullException(targetHttpProxy);
                }

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

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

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request TargetHttpProxies.SetUrlMap failed.", ex);
            }
        }
コード例 #12
0
        /// <summary>
        /// Deletes the specified persistent disk. Deleting a disk removes its data permanently and is irreversible. However, deleting a disk does not delete any snapshots previously made from the disk. You must separately delete snapshots.
        /// Documentation https://developers.google.com/compute/beta/reference/disks/delete
        /// 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="zone">The name of the zone for this request.</param>
        /// <param name="disk">Name of the persistent disk to delete.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>OperationResponse</returns>
        public static Operation Delete(ComputeService service, string project, string zone, string disk, DisksDeleteOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (project == null)
                {
                    throw new ArgumentNullException(project);
                }
                if (zone == null)
                {
                    throw new ArgumentNullException(zone);
                }
                if (disk == null)
                {
                    throw new ArgumentNullException(disk);
                }

                // Building the initial request.
                var request = service.Disks.Delete(project, zone, disk);

                // Applying optional parameters to the request.
                request = (DisksResource.DeleteRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Disks.Delete failed.", ex);
            }
        }
コード例 #13
0
        /// <summary>
        /// Sets the security policy for the specified backend service.
        /// Documentation https://developers.google.com/compute/beta/reference/backendServices/setSecurityPolicy
        /// 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="backendService">Name of the BackendService resource to which the security policy should be set. The name should conform to RFC1035.</param>
        /// <param name="body">A valid Compute beta body.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>OperationResponse</returns>
        public static Operation SetSecurityPolicy(ComputeService service, string project, string backendService, SecurityPolicyReference body, BackendServicesSetSecurityPolicyOptionalParms 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 (backendService == null)
                {
                    throw new ArgumentNullException(backendService);
                }

                // Building the initial request.
                var request = service.BackendServices.SetSecurityPolicy(body, project, backendService);

                // Applying optional parameters to the request.
                request = (BackendServicesResource.SetSecurityPolicyRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request BackendServices.SetSecurityPolicy failed.", ex);
            }
        }
コード例 #14
0
        /// <summary>
        /// Creates an address resource in the specified project using the data included in the request.
        /// Documentation https://developers.google.com/compute/beta/reference/addresses/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="region">Name of the region for this request.</param>
        /// <param name="body">A valid Compute beta body.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>OperationResponse</returns>
        public static Operation Insert(ComputeService service, string project, string region, Address body, AddressesInsertOptionalParms 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 (region == null)
                {
                    throw new ArgumentNullException(region);
                }

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

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

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Addresses.Insert failed.", ex);
            }
        }
コード例 #15
0
        /// <summary>
        /// Adds a peering to the specified network.
        /// Documentation https://developers.google.com/compute/beta/reference/networks/addPeering
        /// 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="network">Name of the network resource to add peering to.</param>
        /// <param name="body">A valid Compute beta body.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>OperationResponse</returns>
        public static Operation AddPeering(ComputeService service, string project, string network, NetworksAddPeeringRequest body, NetworksAddPeeringOptionalParms 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 (network == null)
                {
                    throw new ArgumentNullException(network);
                }

                // Building the initial request.
                var request = service.Networks.AddPeering(body, project, network);

                // Applying optional parameters to the request.
                request = (NetworksResource.AddPeeringRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Networks.AddPeering failed.", ex);
            }
        }
コード例 #16
0
        /// <summary>
        /// Initiates a cache invalidation operation, invalidating the specified path, scoped to the specified UrlMap.
        /// Documentation https://developers.google.com/compute/beta/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 beta 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);
            }
        }
コード例 #17
0
        /// <summary>
        /// Deletes the specified VpnTunnel resource.
        /// Documentation https://developers.google.com/compute/beta/reference/vpnTunnels/delete
        /// 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="region">Name of the region for this request.</param>
        /// <param name="vpnTunnel">Name of the VpnTunnel resource to delete.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>OperationResponse</returns>
        public static Operation Delete(ComputeService service, string project, string region, string vpnTunnel, VpnTunnelsDeleteOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (project == null)
                {
                    throw new ArgumentNullException(project);
                }
                if (region == null)
                {
                    throw new ArgumentNullException(region);
                }
                if (vpnTunnel == null)
                {
                    throw new ArgumentNullException(vpnTunnel);
                }

                // Building the initial request.
                var request = service.VpnTunnels.Delete(project, region, vpnTunnel);

                // Applying optional parameters to the request.
                request = (VpnTunnelsResource.DeleteRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request VpnTunnels.Delete failed.", ex);
            }
        }