Пример #1
0
 /// <summary>Snippet for SetPrivateIpGoogleAccess</summary>
 public void SetPrivateIpGoogleAccess()
 {
     // Snippet: SetPrivateIpGoogleAccess(string, string, string, SubnetworksSetPrivateIpGoogleAccessRequest, CallSettings)
     // Create client
     SubnetworksClient subnetworksClient = SubnetworksClient.Create();
     // Initialize request argument(s)
     string project    = "";
     string region     = "";
     string subnetwork = "";
     SubnetworksSetPrivateIpGoogleAccessRequest subnetworksSetPrivateIpGoogleAccessRequestResource = new SubnetworksSetPrivateIpGoogleAccessRequest();
     // Make the request
     Operation response = subnetworksClient.SetPrivateIpGoogleAccess(project, region, subnetwork, subnetworksSetPrivateIpGoogleAccessRequestResource);
     // End snippet
 }
Пример #2
0
        /// <summary>Snippet for SetPrivateIpGoogleAccessAsync</summary>
        public async Task SetPrivateIpGoogleAccessAsync()
        {
            // Snippet: SetPrivateIpGoogleAccessAsync(string, string, string, SubnetworksSetPrivateIpGoogleAccessRequest, CallSettings)
            // Additional: SetPrivateIpGoogleAccessAsync(string, string, string, SubnetworksSetPrivateIpGoogleAccessRequest, CancellationToken)
            // Create client
            SubnetworksClient subnetworksClient = await SubnetworksClient.CreateAsync();

            // Initialize request argument(s)
            string project    = "";
            string region     = "";
            string subnetwork = "";
            SubnetworksSetPrivateIpGoogleAccessRequest subnetworksSetPrivateIpGoogleAccessRequestResource = new SubnetworksSetPrivateIpGoogleAccessRequest();
            // Make the request
            Operation response = await subnetworksClient.SetPrivateIpGoogleAccessAsync(project, region, subnetwork, subnetworksSetPrivateIpGoogleAccessRequestResource);

            // End snippet
        }
        /// <summary>
        /// Set whether VMs in this subnet can access Google services without assigning external IP addresses through Cloudpath.
        /// Documentation https://developers.google.com/compute/alpha/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 alpha body.</param>
        /// <returns>OperationResponse</returns>
        public static Operation SetPrivateIpGoogleAccess(computeService service, string project, string region, string subnetwork, SubnetworksSetPrivateIpGoogleAccessRequest 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 (region == null)
                {
                    throw new ArgumentNullException(region);
                }
                if (subnetwork == null)
                {
                    throw new ArgumentNullException(subnetwork);
                }

                // Make the request.
                return(service.Subnetworks.SetPrivateIpGoogleAccess(body, project, region, subnetwork).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Subnetworks.SetPrivateIpGoogleAccess failed.", ex);
            }
        }
        /// <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/v1/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 v1 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);
            }
        }