Ejemplo n.º 1
0
 /// <summary>Snippet for AttachNetworkEndpoints</summary>
 public void AttachNetworkEndpoints()
 {
     // Snippet: AttachNetworkEndpoints(string, string, string, NetworkEndpointGroupsAttachEndpointsRequest, CallSettings)
     // Create client
     NetworkEndpointGroupsClient networkEndpointGroupsClient = NetworkEndpointGroupsClient.Create();
     // Initialize request argument(s)
     string project = "";
     string zone    = "";
     string networkEndpointGroup = "";
     NetworkEndpointGroupsAttachEndpointsRequest networkEndpointGroupsAttachEndpointsRequestResource = new NetworkEndpointGroupsAttachEndpointsRequest();
     // Make the request
     Operation response = networkEndpointGroupsClient.AttachNetworkEndpoints(project, zone, networkEndpointGroup, networkEndpointGroupsAttachEndpointsRequestResource);
     // End snippet
 }
Ejemplo n.º 2
0
        /// <summary>Snippet for AttachNetworkEndpointsAsync</summary>
        public async Task AttachNetworkEndpointsAsync()
        {
            // Snippet: AttachNetworkEndpointsAsync(string, string, string, NetworkEndpointGroupsAttachEndpointsRequest, CallSettings)
            // Additional: AttachNetworkEndpointsAsync(string, string, string, NetworkEndpointGroupsAttachEndpointsRequest, CancellationToken)
            // Create client
            NetworkEndpointGroupsClient networkEndpointGroupsClient = await NetworkEndpointGroupsClient.CreateAsync();

            // Initialize request argument(s)
            string project = "";
            string zone    = "";
            string networkEndpointGroup = "";
            NetworkEndpointGroupsAttachEndpointsRequest networkEndpointGroupsAttachEndpointsRequestResource = new NetworkEndpointGroupsAttachEndpointsRequest();
            // Make the request
            Operation response = await networkEndpointGroupsClient.AttachNetworkEndpointsAsync(project, zone, networkEndpointGroup, networkEndpointGroupsAttachEndpointsRequestResource);

            // End snippet
        }
        /// <summary>
        /// Attach a list of network endpoints to the specified network endpoint group.
        /// Documentation https://developers.google.com/compute/alpha/reference/networkEndpointGroups/attachNetworkEndpoints
        /// 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 attaching network endpoints to. 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 AttachNetworkEndpoints(ComputeService service, string project, string zone, string networkEndpointGroup, NetworkEndpointGroupsAttachEndpointsRequest body, NetworkEndpointGroupsAttachNetworkEndpointsOptionalParms 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.AttachNetworkEndpoints(body, project, zone, networkEndpointGroup);

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

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