示例#1
0
 /// <summary>Snippet for ListInstances</summary>
 public void ListInstances()
 {
     // Snippet: ListInstances(string, string, string, RegionInstanceGroupsListInstancesRequest, CallSettings)
     // Create client
     RegionInstanceGroupsClient regionInstanceGroupsClient = RegionInstanceGroupsClient.Create();
     // Initialize request argument(s)
     string project       = "";
     string region        = "";
     string instanceGroup = "";
     RegionInstanceGroupsListInstancesRequest regionInstanceGroupsListInstancesRequestResource = new RegionInstanceGroupsListInstancesRequest();
     // Make the request
     RegionInstanceGroupsListInstances response = regionInstanceGroupsClient.ListInstances(project, region, instanceGroup, regionInstanceGroupsListInstancesRequestResource);
     // End snippet
 }
        /// <summary>Snippet for ListInstancesAsync</summary>
        public async Task ListInstancesAsync()
        {
            // Snippet: ListInstancesAsync(string, string, string, RegionInstanceGroupsListInstancesRequest, string, int?, CallSettings)
            // Create client
            RegionInstanceGroupsClient regionInstanceGroupsClient = await RegionInstanceGroupsClient.CreateAsync();

            // Initialize request argument(s)
            string project       = "";
            string region        = "";
            string instanceGroup = "";
            RegionInstanceGroupsListInstancesRequest regionInstanceGroupsListInstancesRequestResource = new RegionInstanceGroupsListInstancesRequest();
            // Make the request
            PagedAsyncEnumerable <RegionInstanceGroupsListInstances, InstanceWithNamedPorts> response = regionInstanceGroupsClient.ListInstancesAsync(project, region, instanceGroup, regionInstanceGroupsListInstancesRequestResource);

            // Iterate over all response items, lazily performing RPCs as required
            await response.ForEachAsync((InstanceWithNamedPorts item) =>
            {
                // Do something with each item
                Console.WriteLine(item);
            });

            // Or iterate over pages (of server-defined size), performing one RPC per page
            await response.AsRawResponses().ForEachAsync((RegionInstanceGroupsListInstances page) =>
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (InstanceWithNamedPorts item in page)
                {
                    // Do something with each item
                    Console.WriteLine(item);
                }
            });

            // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
            int pageSize = 10;
            Page <InstanceWithNamedPorts> singlePage = await response.ReadPageAsync(pageSize);

            // Do something with the page of items
            Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
            foreach (InstanceWithNamedPorts item in singlePage)
            {
                // Do something with each item
                Console.WriteLine(item);
            }
            // Store the pageToken, for when the next page is required.
            string nextPageToken = singlePage.NextPageToken;
            // End snippet
        }
示例#3
0
        /// <summary>Snippet for ListInstancesAsync</summary>
        public async Task ListInstancesAsync()
        {
            // Snippet: ListInstancesAsync(string, string, string, RegionInstanceGroupsListInstancesRequest, CallSettings)
            // Additional: ListInstancesAsync(string, string, string, RegionInstanceGroupsListInstancesRequest, CancellationToken)
            // Create client
            RegionInstanceGroupsClient regionInstanceGroupsClient = await RegionInstanceGroupsClient.CreateAsync();

            // Initialize request argument(s)
            string project       = "";
            string region        = "";
            string instanceGroup = "";
            RegionInstanceGroupsListInstancesRequest regionInstanceGroupsListInstancesRequestResource = new RegionInstanceGroupsListInstancesRequest();
            // Make the request
            RegionInstanceGroupsListInstances response = await regionInstanceGroupsClient.ListInstancesAsync(project, region, instanceGroup, regionInstanceGroupsListInstancesRequestResource);

            // End snippet
        }
        /// <summary>
        /// Lists the instances in the specified instance group and displays information about the named ports. Depending on the specified options, this method can list all instances or only the instances that are running.
        /// Documentation https://developers.google.com/compute/beta/reference/regionInstanceGroups/listInstances
        /// 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">Name of the regional instance group for which we want to list the instances.</param>
        /// <param name="body">A valid compute beta body.</param>
        /// <param name="optional">Optional paramaters.</param>        /// <returns>RegionInstanceGroupsListInstancesResponse</returns>
        public static RegionInstanceGroupsListInstances ListInstances(computeService service, string project, string region, string instanceGroup, RegionInstanceGroupsListInstancesRequest body, RegionInstanceGroupsListInstancesOptionalParms 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.ListInstances(body, project, region, instanceGroup);

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

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request RegionInstanceGroups.ListInstances failed.", ex);
            }
        }
 /// <summary>
 /// Lists the instances in the specified instance group and displays information about the named ports. Depending on the specified options, this method can list all instances or only the instances that are running. The orderBy query parameter is not supported.
 /// </summary>
 /// <param name="project">
 /// Project ID for this request.
 /// </param>
 /// <param name="region">
 /// Name of the region scoping this request.
 /// </param>
 /// <param name="instanceGroup">
 /// Name of the regional instance group for which we want to list the instances.
 /// </param>
 /// <param name="regionInstanceGroupsListInstancesRequestResource">
 /// The body resource for this request
 /// </param>
 /// <param name="cancellationToken">A <see cref="st::CancellationToken"/> to use for this RPC.</param>
 /// <returns>A Task containing the RPC response.</returns>
 public virtual stt::Task <RegionInstanceGroupsListInstances> ListInstancesAsync(string project, string region, string instanceGroup, RegionInstanceGroupsListInstancesRequest regionInstanceGroupsListInstancesRequestResource, st::CancellationToken cancellationToken) =>
 ListInstancesAsync(project, region, instanceGroup, regionInstanceGroupsListInstancesRequestResource, gaxgrpc::CallSettings.FromCancellationToken(cancellationToken));
 /// <summary>
 /// Lists the instances in the specified instance group and displays information about the named ports. Depending on the specified options, this method can list all instances or only the instances that are running. The orderBy query parameter is not supported.
 /// </summary>
 /// <param name="project">
 /// Project ID for this request.
 /// </param>
 /// <param name="region">
 /// Name of the region scoping this request.
 /// </param>
 /// <param name="instanceGroup">
 /// Name of the regional instance group for which we want to list the instances.
 /// </param>
 /// <param name="regionInstanceGroupsListInstancesRequestResource">
 /// The body resource for this request
 /// </param>
 /// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
 /// <returns>A Task containing the RPC response.</returns>
 public virtual stt::Task <RegionInstanceGroupsListInstances> ListInstancesAsync(string project, string region, string instanceGroup, RegionInstanceGroupsListInstancesRequest regionInstanceGroupsListInstancesRequestResource, gaxgrpc::CallSettings callSettings = null) =>
 ListInstancesAsync(new ListInstancesRegionInstanceGroupsRequest
 {
     InstanceGroup = gax::GaxPreconditions.CheckNotNullOrEmpty(instanceGroup, nameof(instanceGroup)),
     Project       = gax::GaxPreconditions.CheckNotNullOrEmpty(project, nameof(project)),
     Region        = gax::GaxPreconditions.CheckNotNullOrEmpty(region, nameof(region)),
     RegionInstanceGroupsListInstancesRequestResource = gax::GaxPreconditions.CheckNotNull(regionInstanceGroupsListInstancesRequestResource, nameof(regionInstanceGroupsListInstancesRequestResource)),
 }, callSettings);
示例#7
0
 /// <summary>
 /// Lists the instances in the specified instance group and displays information about the named ports. Depending on the specified options, this method can list all instances or only the instances that are running. The orderBy query parameter is not supported.
 /// </summary>
 /// <param name="project">
 /// Project ID for this request.
 /// </param>
 /// <param name="region">
 /// Name of the region scoping this request.
 /// </param>
 /// <param name="instanceGroup">
 /// Name of the regional instance group for which we want to list the instances.
 /// </param>
 /// <param name="regionInstanceGroupsListInstancesRequestResource">
 /// The body resource for this request
 /// </param>
 /// <param name="pageToken">
 /// The token returned from the previous request. A value of <c>null</c> or an empty string retrieves the first
 /// page.
 /// </param>
 /// <param name="pageSize">
 /// The size of page to request. The response will not be larger than this, but may be smaller. A value of
 /// <c>null</c> or <c>0</c> uses a server-defined page size.
 /// </param>
 /// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
 /// <returns>A pageable asynchronous sequence of <see cref="InstanceWithNamedPorts"/> resources.</returns>
 public virtual gax::PagedAsyncEnumerable <RegionInstanceGroupsListInstances, InstanceWithNamedPorts> ListInstancesAsync(string project, string region, string instanceGroup, RegionInstanceGroupsListInstancesRequest regionInstanceGroupsListInstancesRequestResource, string pageToken = null, int?pageSize = null, gaxgrpc::CallSettings callSettings = null) =>
 ListInstancesAsync(new ListInstancesRegionInstanceGroupsRequest
 {
     InstanceGroup = gax::GaxPreconditions.CheckNotNullOrEmpty(instanceGroup, nameof(instanceGroup)),
     Project       = gax::GaxPreconditions.CheckNotNullOrEmpty(project, nameof(project)),
     Region        = gax::GaxPreconditions.CheckNotNullOrEmpty(region, nameof(region)),
     RegionInstanceGroupsListInstancesRequestResource = gax::GaxPreconditions.CheckNotNull(regionInstanceGroupsListInstancesRequestResource, nameof(regionInstanceGroupsListInstancesRequestResource)),
     PageToken = pageToken ?? "",
     PageSize  = pageSize ?? 0,
 }, callSettings);