Example #1
0
 /// <summary>Snippet for EnableXpnResource</summary>
 public void EnableXpnResource()
 {
     // Snippet: EnableXpnResource(string, ProjectsEnableXpnResourceRequest, CallSettings)
     // Create client
     ProjectsClient projectsClient = ProjectsClient.Create();
     // Initialize request argument(s)
     string project = "";
     ProjectsEnableXpnResourceRequest projectsEnableXpnResourceRequestResource = new ProjectsEnableXpnResourceRequest();
     // Make the request
     Operation response = projectsClient.EnableXpnResource(project, projectsEnableXpnResourceRequestResource);
     // End snippet
 }
Example #2
0
        /// <summary>Snippet for EnableXpnResourceAsync</summary>
        public async Task EnableXpnResourceAsync()
        {
            // Snippet: EnableXpnResourceAsync(string, ProjectsEnableXpnResourceRequest, CallSettings)
            // Additional: EnableXpnResourceAsync(string, ProjectsEnableXpnResourceRequest, CancellationToken)
            // Create client
            ProjectsClient projectsClient = await ProjectsClient.CreateAsync();

            // Initialize request argument(s)
            string project = "";
            ProjectsEnableXpnResourceRequest projectsEnableXpnResourceRequestResource = new ProjectsEnableXpnResourceRequest();
            // Make the request
            Operation response = await projectsClient.EnableXpnResourceAsync(project, projectsEnableXpnResourceRequestResource);

            // End snippet
        }
        /// <summary>
        /// Enable service resource (a.k.a service project) for a host project, so that subnets in the host project can be used by instances in the service project.
        /// Documentation https://developers.google.com/compute/v1/reference/projects/enableXpnResource
        /// 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 EnableXpnResource(ComputeService service, string project, ProjectsEnableXpnResourceRequest body, ProjectsEnableXpnResourceOptionalParms 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.Projects.EnableXpnResource(body, project);

                // Applying optional parameters to the request.
                request = (ProjectsResource.EnableXpnResourceRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Projects.EnableXpnResource failed.", ex);
            }
        }
        /// <summary>
        /// Enable XPN resource (a.k.a service project or service folder in the future) for a host project, so that subnetworks in the host project can be used by instances in the service project or folder.
        /// Documentation https://developers.google.com/compute/alpha/reference/projects/enableXpnResource
        /// 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 EnableXpnResource(computeService service, string project, ProjectsEnableXpnResourceRequest 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.Projects.EnableXpnResource(body, project).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Projects.EnableXpnResource failed.", ex);
            }
        }