# Compute Engine v1 API - Class AdviceClient (3.28.0)

3.28.0 (latest) 3.27.0 3.26.0 3.25.0 3.24.0 3.23.0 3.22.0 3.21.0 3.20.0 3.19.0 3.18.0 3.17.0 3.16.0 3.15.0 3.14.0 3.13.0 3.12.0 3.11.0 3.10.0 3.9.0 3.8.0 3.7.0 3.6.0 3.5.0 3.4.0 3.3.0 3.2.0 3.1.0 3.0.0 2.17.0 2.16.0 2.15.0 2.14.0 2.13.0 2.12.0 2.11.0 2.10.0 2.9.0 2.8.0 2.7.0 2.6.0 2.5.0 2.4.0 2.3.0 2.2.0 2.1.0 2.0.0 1.4.0 1.3.0 1.2.0 1.1.0 1.0.0

    public abstract class AdviceClient

Reference documentation and code samples for the Compute Engine v1 API class AdviceClient.

Advice client wrapper, for convenient use.

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> AdviceClient

## Inherited Members

[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) [object.MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone) [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Derived Types

[AdviceClientImpl](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Compute.V1/latest/Google.Cloud.Compute.V1.AdviceClientImpl)

## Namespace

[Google.Cloud.Compute.V1](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Compute.V1/latest/Google.Cloud.Compute.V1)

## Assembly

Google.Cloud.Compute.V1.dll

## Remarks

The Advice API.

## Properties

### DefaultEndpoint

    public static string DefaultEndpoint { get; }

The default endpoint for the Advice service, which is a host of "compute.googleapis.com" and a port of 443.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.string` |   |

### DefaultScopes

    public static IReadOnlyList<string> DefaultScopes { get; }

The default Advice scopes.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.collections.generic.ireadonlylist-1https://learn.microsoft.com/dotnet/api/system.string` |   |

**Remarks** The default Advice scopes are:

- <https://www.googleapis.com/auth/compute>
- <https://www.googleapis.com/auth/cloud-platform>

### GrpcClient

    public virtual Advice.AdviceClient GrpcClient { get; }

The underlying gRPC Advice client

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Compute.V1/latest/Google.Cloud.Compute.V1.Advicehttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Compute.V1/latest/Google.Cloud.Compute.V1.Advice.AdviceClient` |   |

### ServiceMetadata

    public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.ServiceMetadata.html` |   |

## Methods

### CalendarMode(CalendarModeAdviceRpcRequest, CallSettings)

    public virtual CalendarModeAdviceResponse CalendarMode(CalendarModeAdviceRpcRequest request, CallSettings callSettings = null)

Advise how, where and when to create the requested amount of instances
with specified accelerators, within the specified time and location limits.
The method recommends creating future reservations for the requested
resources.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Compute.V1/latest/Google.Cloud.Compute.V1.CalendarModeAdviceRpcRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Compute.V1/latest/Google.Cloud.Compute.V1.CalendarModeAdviceResponse` | The RPC response. |

**Example**

    // Create client
    AdviceClient adviceClient = AdviceClient.Create();
    // Initialize request argument(s)
    CalendarModeAdviceRpcRequest request = new CalendarModeAdviceRpcRequest
    {
        Region = "",
        CalendarModeAdviceRequestResource = new CalendarModeAdviceRequest(),
        Project = "",
    };
    // Make the request
    CalendarModeAdviceResponse response = adviceClient.CalendarMode(request);

### CalendarMode(string, string, CalendarModeAdviceRequest, CallSettings)

    public virtual CalendarModeAdviceResponse CalendarMode(string project, string region, CalendarModeAdviceRequest calendarModeAdviceRequestResource, CallSettings callSettings = null)

Advise how, where and when to create the requested amount of instances
with specified accelerators, within the specified time and location limits.
The method recommends creating future reservations for the requested
resources.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `project` | `https://learn.microsoft.com/dotnet/api/system.string` Project ID for this request. |
| `region` | `https://learn.microsoft.com/dotnet/api/system.string` Name of the region for this request. |
| `calendarModeAdviceRequestResource` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Compute.V1/latest/Google.Cloud.Compute.V1.CalendarModeAdviceRequest` The body resource for this request |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Compute.V1/latest/Google.Cloud.Compute.V1.CalendarModeAdviceResponse` | The RPC response. |

**Example**

    // Create client
    AdviceClient adviceClient = AdviceClient.Create();
    // Initialize request argument(s)
    string project = "";
    string region = "";
    CalendarModeAdviceRequest calendarModeAdviceRequestResource = new CalendarModeAdviceRequest();
    // Make the request
    CalendarModeAdviceResponse response = adviceClient.CalendarMode(project, region, calendarModeAdviceRequestResource);

### CalendarModeAsync(CalendarModeAdviceRpcRequest, CallSettings)

    public virtual Task<CalendarModeAdviceResponse> CalendarModeAsync(CalendarModeAdviceRpcRequest request, CallSettings callSettings = null)

Advise how, where and when to create the requested amount of instances
with specified accelerators, within the specified time and location limits.
The method recommends creating future reservations for the requested
resources.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Compute.V1/latest/Google.Cloud.Compute.V1.CalendarModeAdviceRpcRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Compute.V1/latest/Google.Cloud.Compute.V1.CalendarModeAdviceResponse` | A Task containing the RPC response. |

**Example**

    // Create client
    AdviceClient adviceClient = await AdviceClient.CreateAsync();
    // Initialize request argument(s)
    CalendarModeAdviceRpcRequest request = new CalendarModeAdviceRpcRequest
    {
        Region = "",
        CalendarModeAdviceRequestResource = new CalendarModeAdviceRequest(),
        Project = "",
    };
    // Make the request
    CalendarModeAdviceResponse response = await adviceClient.CalendarModeAsync(request);

### CalendarModeAsync(CalendarModeAdviceRpcRequest, CancellationToken)

    public virtual Task<CalendarModeAdviceResponse> CalendarModeAsync(CalendarModeAdviceRpcRequest request, CancellationToken cancellationToken)

Advise how, where and when to create the requested amount of instances
with specified accelerators, within the specified time and location limits.
The method recommends creating future reservations for the requested
resources.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Compute.V1/latest/Google.Cloud.Compute.V1.CalendarModeAdviceRpcRequest` The request object containing all of the parameters for the API call. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Compute.V1/latest/Google.Cloud.Compute.V1.CalendarModeAdviceResponse` | A Task containing the RPC response. |

**Example**

    // Create client
    AdviceClient adviceClient = await AdviceClient.CreateAsync();
    // Initialize request argument(s)
    CalendarModeAdviceRpcRequest request = new CalendarModeAdviceRpcRequest
    {
        Region = "",
        CalendarModeAdviceRequestResource = new CalendarModeAdviceRequest(),
        Project = "",
    };
    // Make the request
    CalendarModeAdviceResponse response = await adviceClient.CalendarModeAsync(request);

### CalendarModeAsync(string, string, CalendarModeAdviceRequest, CallSettings)

    public virtual Task<CalendarModeAdviceResponse> CalendarModeAsync(string project, string region, CalendarModeAdviceRequest calendarModeAdviceRequestResource, CallSettings callSettings = null)

Advise how, where and when to create the requested amount of instances
with specified accelerators, within the specified time and location limits.
The method recommends creating future reservations for the requested
resources.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `project` | `https://learn.microsoft.com/dotnet/api/system.string` Project ID for this request. |
| `region` | `https://learn.microsoft.com/dotnet/api/system.string` Name of the region for this request. |
| `calendarModeAdviceRequestResource` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Compute.V1/latest/Google.Cloud.Compute.V1.CalendarModeAdviceRequest` The body resource for this request |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Compute.V1/latest/Google.Cloud.Compute.V1.CalendarModeAdviceResponse` | A Task containing the RPC response. |

**Example**

    // Create client
    AdviceClient adviceClient = await AdviceClient.CreateAsync();
    // Initialize request argument(s)
    string project = "";
    string region = "";
    CalendarModeAdviceRequest calendarModeAdviceRequestResource = new CalendarModeAdviceRequest();
    // Make the request
    CalendarModeAdviceResponse response = await adviceClient.CalendarModeAsync(project, region, calendarModeAdviceRequestResource);

### CalendarModeAsync(string, string, CalendarModeAdviceRequest, CancellationToken)

    public virtual Task<CalendarModeAdviceResponse> CalendarModeAsync(string project, string region, CalendarModeAdviceRequest calendarModeAdviceRequestResource, CancellationToken cancellationToken)

Advise how, where and when to create the requested amount of instances
with specified accelerators, within the specified time and location limits.
The method recommends creating future reservations for the requested
resources.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `project` | `https://learn.microsoft.com/dotnet/api/system.string` Project ID for this request. |
| `region` | `https://learn.microsoft.com/dotnet/api/system.string` Name of the region for this request. |
| `calendarModeAdviceRequestResource` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Compute.V1/latest/Google.Cloud.Compute.V1.CalendarModeAdviceRequest` The body resource for this request |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Compute.V1/latest/Google.Cloud.Compute.V1.CalendarModeAdviceResponse` | A Task containing the RPC response. |

**Example**

    // Create client
    AdviceClient adviceClient = await AdviceClient.CreateAsync();
    // Initialize request argument(s)
    string project = "";
    string region = "";
    CalendarModeAdviceRequest calendarModeAdviceRequestResource = new CalendarModeAdviceRequest();
    // Make the request
    CalendarModeAdviceResponse response = await adviceClient.CalendarModeAsync(project, region, calendarModeAdviceRequestResource);

### Create()

    public static AdviceClient Create()

Synchronously creates a [AdviceClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Compute.V1/latest/Google.Cloud.Compute.V1.AdviceClient) using the default credentials, endpoint and settings. To
specify custom credentials or other settings, use [AdviceClientBuilder](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Compute.V1/latest/Google.Cloud.Compute.V1.AdviceClientBuilder).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Compute.V1/latest/Google.Cloud.Compute.V1.AdviceClient` | The created [AdviceClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Compute.V1/latest/Google.Cloud.Compute.V1.AdviceClient). |

### CreateAsync(CancellationToken)

    public static Task<AdviceClient> CreateAsync(CancellationToken cancellationToken = default)

Asynchronously creates a [AdviceClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Compute.V1/latest/Google.Cloud.Compute.V1.AdviceClient) using the default credentials, endpoint and settings. To
specify custom credentials or other settings, use [AdviceClientBuilder](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Compute.V1/latest/Google.Cloud.Compute.V1.AdviceClientBuilder).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` The [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use while creating the client. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Compute.V1/latest/Google.Cloud.Compute.V1.AdviceClient` | The task representing the created [AdviceClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Compute.V1/latest/Google.Cloud.Compute.V1.AdviceClient). |

### ShutdownDefaultChannelsAsync()

    public static Task ShutdownDefaultChannelsAsync()

Shuts down any channels automatically created by [Create()](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Compute.V1/latest/Google.Cloud.Compute.V1.AdviceClient#Google_Cloud_Compute_V1_AdviceClient_Create) and
[CreateAsync(CancellationToken)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Compute.V1/latest/Google.Cloud.Compute.V1.AdviceClient#Google_Cloud_Compute_V1_AdviceClient_CreateAsync_System_Threading_CancellationToken_). Channels which weren't automatically created are not
affected.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task` | A task representing the asynchronous shutdown operation. |

**Remarks** After calling this method, further calls to [Create()](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Compute.V1/latest/Google.Cloud.Compute.V1.AdviceClient#Google_Cloud_Compute_V1_AdviceClient_Create) and
[CreateAsync(CancellationToken)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Compute.V1/latest/Google.Cloud.Compute.V1.AdviceClient#Google_Cloud_Compute_V1_AdviceClient_CreateAsync_System_Threading_CancellationToken_) will create new channels, which could in turn be shut down
by another call to this method.