Beispiel #1
0
 /// <summary>Snippet for DetachNetworkEndpoints</summary>
 public void DetachNetworkEndpoints()
 {
     // Snippet: DetachNetworkEndpoints(string, string, string, NetworkEndpointGroupsDetachEndpointsRequest, CallSettings)
     // Create client
     NetworkEndpointGroupsClient networkEndpointGroupsClient = NetworkEndpointGroupsClient.Create();
     // Initialize request argument(s)
     string project = "";
     string zone    = "";
     string networkEndpointGroup = "";
     NetworkEndpointGroupsDetachEndpointsRequest networkEndpointGroupsDetachEndpointsRequestResource = new NetworkEndpointGroupsDetachEndpointsRequest();
     // Make the request
     Operation response = networkEndpointGroupsClient.DetachNetworkEndpoints(project, zone, networkEndpointGroup, networkEndpointGroupsDetachEndpointsRequestResource);
     // End snippet
 }
Beispiel #2
0
        /// <summary>Snippet for DetachNetworkEndpointsAsync</summary>
        public async Task DetachNetworkEndpointsAsync()
        {
            // Snippet: DetachNetworkEndpointsAsync(string, string, string, NetworkEndpointGroupsDetachEndpointsRequest, CallSettings)
            // Additional: DetachNetworkEndpointsAsync(string, string, string, NetworkEndpointGroupsDetachEndpointsRequest, CancellationToken)
            // Create client
            NetworkEndpointGroupsClient networkEndpointGroupsClient = await NetworkEndpointGroupsClient.CreateAsync();

            // Initialize request argument(s)
            string project = "";
            string zone    = "";
            string networkEndpointGroup = "";
            NetworkEndpointGroupsDetachEndpointsRequest networkEndpointGroupsDetachEndpointsRequestResource = new NetworkEndpointGroupsDetachEndpointsRequest();
            // Make the request
            Operation response = await networkEndpointGroupsClient.DetachNetworkEndpointsAsync(project, zone, networkEndpointGroup, networkEndpointGroupsDetachEndpointsRequestResource);

            // End snippet
        }
        /// <summary>
        /// Detach a list of network endpoints from the specified network endpoint group.
        /// Documentation https://developers.google.com/compute/alpha/reference/networkEndpointGroups/detachNetworkEndpoints
        /// 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 network endpoint group is located. It should comply with RFC1035.</param>
        /// <param name="networkEndpointGroup">The name of the network endpoint group where you are removing network endpoints. It should comply with RFC1035.</param>
        /// <param name="body">A valid Compute alpha body.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>OperationResponse</returns>
        public static Operation DetachNetworkEndpoints(ComputeService service, string project, string zone, string networkEndpointGroup, NetworkEndpointGroupsDetachEndpointsRequest body, NetworkEndpointGroupsDetachNetworkEndpointsOptionalParms 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 (networkEndpointGroup == null)
                {
                    throw new ArgumentNullException(networkEndpointGroup);
                }

                // Building the initial request.
                var request = service.NetworkEndpointGroups.DetachNetworkEndpoints(body, project, zone, networkEndpointGroup);

                // Applying optional parameters to the request.
                request = (NetworkEndpointGroupsResource.DetachNetworkEndpointsRequest)SampleHelpers.ApplyOptionalParms(request, optional);

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