Capacity Planner v1beta API - Class UsageServiceClient (1.0.0-beta01)

public abstract class UsageServiceClient

Reference documentation and code samples for the Capacity Planner v1beta API class UsageServiceClient.

UsageService client wrapper, for convenient use.

Inheritance

object > UsageServiceClient

Derived Types

Namespace

Google.Cloud.CapacityPlanner.V1Beta

Assembly

Google.Cloud.CapacityPlanner.V1Beta.dll

Remarks

Provides access to historical and forecasted usage data.

Properties

DefaultEndpoint

public static string DefaultEndpoint { get; }

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

Property Value
Type Description
string

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default UsageService scopes.

Property Value
Type Description
IReadOnlyListstring
Remarks

ExportForecastsOperationsClient

public virtual OperationsClient ExportForecastsOperationsClient { get; }

The long-running operations client for ExportForecasts.

Property Value
Type Description
OperationsClient

ExportReservationsUsageOperationsClient

public virtual OperationsClient ExportReservationsUsageOperationsClient { get; }

The long-running operations client for ExportReservationsUsage.

Property Value
Type Description
OperationsClient

ExportUsageHistoriesOperationsClient

public virtual OperationsClient ExportUsageHistoriesOperationsClient { get; }

The long-running operations client for ExportUsageHistories.

Property Value
Type Description
OperationsClient

GrpcClient

public virtual UsageService.UsageServiceClient GrpcClient { get; }

The underlying gRPC UsageService client

Property Value
Type Description
UsageServiceUsageServiceClient

ServiceMetadata

public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

Property Value
Type Description
ServiceMetadata

Methods

Create()

public static UsageServiceClient Create()

Synchronously creates a UsageServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use UsageServiceClientBuilder.

Returns
Type Description
UsageServiceClient

The created UsageServiceClient.

CreateAsync(CancellationToken)

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

Asynchronously creates a UsageServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use UsageServiceClientBuilder.

Parameter
Name Description
cancellationToken CancellationToken

The CancellationToken to use while creating the client.

Returns
Type Description
TaskUsageServiceClient

The task representing the created UsageServiceClient.

ExportForecasts(ExportForecastsRequest, CallSettings)

public virtual Operation<ExportForecastsResponse, OperationMetadata> ExportForecasts(ExportForecastsRequest request, CallSettings callSettings = null)

Exports forecasted usage data requested by user into either an existing Cloud Storage bucket or a BigQuery table.

Parameters
Name Description
request ExportForecastsRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationExportForecastsResponseOperationMetadata

The RPC response.

Example
// Create client
UsageServiceClient usageServiceClient = UsageServiceClient.Create();
// Initialize request argument(s)
ExportForecastsRequest request = new ExportForecastsRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    MachineFamily = "",
    DiskType = "",
    ResourceType = "",
    PredictionInterval = Forecast.Types.PredictionInterval.Unspecified,
    AggregationMethod = UsageHistory.Types.AggregationMethod.Unspecified,
    StartDate = new Date(),
    EndDate = new Date(),
    OutputConfig = new OutputConfig(),
    GpuType = "",
    TpuType = "",
    MachineShape = new MachineShape(),
};
// Make the request
Operation<ExportForecastsResponse, OperationMetadata> response = usageServiceClient.ExportForecasts(request);

// Poll until the returned long-running operation is complete
Operation<ExportForecastsResponse, OperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
ExportForecastsResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<ExportForecastsResponse, OperationMetadata> retrievedResponse = usageServiceClient.PollOnceExportForecasts(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    ExportForecastsResponse retrievedResult = retrievedResponse.Result;
}

ExportForecastsAsync(ExportForecastsRequest, CallSettings)

public virtual Task<Operation<ExportForecastsResponse, OperationMetadata>> ExportForecastsAsync(ExportForecastsRequest request, CallSettings callSettings = null)

Exports forecasted usage data requested by user into either an existing Cloud Storage bucket or a BigQuery table.

Parameters
Name Description
request ExportForecastsRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationExportForecastsResponseOperationMetadata

A Task containing the RPC response.

Example
// Create client
UsageServiceClient usageServiceClient = await UsageServiceClient.CreateAsync();
// Initialize request argument(s)
ExportForecastsRequest request = new ExportForecastsRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    MachineFamily = "",
    DiskType = "",
    ResourceType = "",
    PredictionInterval = Forecast.Types.PredictionInterval.Unspecified,
    AggregationMethod = UsageHistory.Types.AggregationMethod.Unspecified,
    StartDate = new Date(),
    EndDate = new Date(),
    OutputConfig = new OutputConfig(),
    GpuType = "",
    TpuType = "",
    MachineShape = new MachineShape(),
};
// Make the request
Operation<ExportForecastsResponse, OperationMetadata> response = await usageServiceClient.ExportForecastsAsync(request);

// Poll until the returned long-running operation is complete
Operation<ExportForecastsResponse, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
ExportForecastsResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<ExportForecastsResponse, OperationMetadata> retrievedResponse = await usageServiceClient.PollOnceExportForecastsAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    ExportForecastsResponse retrievedResult = retrievedResponse.Result;
}

ExportForecastsAsync(ExportForecastsRequest, CancellationToken)

public virtual Task<Operation<ExportForecastsResponse, OperationMetadata>> ExportForecastsAsync(ExportForecastsRequest request, CancellationToken cancellationToken)

Exports forecasted usage data requested by user into either an existing Cloud Storage bucket or a BigQuery table.

Parameters
Name Description
request ExportForecastsRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskOperationExportForecastsResponseOperationMetadata

A Task containing the RPC response.

Example
// Create client
UsageServiceClient usageServiceClient = await UsageServiceClient.CreateAsync();
// Initialize request argument(s)
ExportForecastsRequest request = new ExportForecastsRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    MachineFamily = "",
    DiskType = "",
    ResourceType = "",
    PredictionInterval = Forecast.Types.PredictionInterval.Unspecified,
    AggregationMethod = UsageHistory.Types.AggregationMethod.Unspecified,
    StartDate = new Date(),
    EndDate = new Date(),
    OutputConfig = new OutputConfig(),
    GpuType = "",
    TpuType = "",
    MachineShape = new MachineShape(),
};
// Make the request
Operation<ExportForecastsResponse, OperationMetadata> response = await usageServiceClient.ExportForecastsAsync(request);

// Poll until the returned long-running operation is complete
Operation<ExportForecastsResponse, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
ExportForecastsResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<ExportForecastsResponse, OperationMetadata> retrievedResponse = await usageServiceClient.PollOnceExportForecastsAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    ExportForecastsResponse retrievedResult = retrievedResponse.Result;
}

ExportReservationsUsage(ExportReservationsUsageRequest, CallSettings)

public virtual Operation<ExportReservationsUsageResponse, OperationMetadata> ExportReservationsUsage(ExportReservationsUsageRequest request, CallSettings callSettings = null)

Exports reservations usage data requested by user into either an existing Cloud Storage bucket or a new/existing BigQuery table.

Parameters
Name Description
request ExportReservationsUsageRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationExportReservationsUsageResponseOperationMetadata

The RPC response.

Example
// Create client
UsageServiceClient usageServiceClient = UsageServiceClient.Create();
// Initialize request argument(s)
ExportReservationsUsageRequest request = new ExportReservationsUsageRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    MachineFamily = "",
    CloudResourceType = "",
    UsageAggregationMethod = UsageHistory.Types.AggregationMethod.Unspecified,
    ShareType = ExportReservationsUsageRequest.Types.ShareType.Unspecified,
    StartDate = new Date(),
    EndDate = new Date(),
    OutputConfig = new OutputConfig(),
    LocationLevel = TimeSeries.Types.LocationType.Unspecified,
};
// Make the request
Operation<ExportReservationsUsageResponse, OperationMetadata> response = usageServiceClient.ExportReservationsUsage(request);

// Poll until the returned long-running operation is complete
Operation<ExportReservationsUsageResponse, OperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
ExportReservationsUsageResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<ExportReservationsUsageResponse, OperationMetadata> retrievedResponse = usageServiceClient.PollOnceExportReservationsUsage(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    ExportReservationsUsageResponse retrievedResult = retrievedResponse.Result;
}

ExportReservationsUsageAsync(ExportReservationsUsageRequest, CallSettings)

public virtual Task<Operation<ExportReservationsUsageResponse, OperationMetadata>> ExportReservationsUsageAsync(ExportReservationsUsageRequest request, CallSettings callSettings = null)

Exports reservations usage data requested by user into either an existing Cloud Storage bucket or a new/existing BigQuery table.

Parameters
Name Description
request ExportReservationsUsageRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationExportReservationsUsageResponseOperationMetadata

A Task containing the RPC response.

Example
// Create client
UsageServiceClient usageServiceClient = await UsageServiceClient.CreateAsync();
// Initialize request argument(s)
ExportReservationsUsageRequest request = new ExportReservationsUsageRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    MachineFamily = "",
    CloudResourceType = "",
    UsageAggregationMethod = UsageHistory.Types.AggregationMethod.Unspecified,
    ShareType = ExportReservationsUsageRequest.Types.ShareType.Unspecified,
    StartDate = new Date(),
    EndDate = new Date(),
    OutputConfig = new OutputConfig(),
    LocationLevel = TimeSeries.Types.LocationType.Unspecified,
};
// Make the request
Operation<ExportReservationsUsageResponse, OperationMetadata> response = await usageServiceClient.ExportReservationsUsageAsync(request);

// Poll until the returned long-running operation is complete
Operation<ExportReservationsUsageResponse, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
ExportReservationsUsageResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<ExportReservationsUsageResponse, OperationMetadata> retrievedResponse = await usageServiceClient.PollOnceExportReservationsUsageAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    ExportReservationsUsageResponse retrievedResult = retrievedResponse.Result;
}

ExportReservationsUsageAsync(ExportReservationsUsageRequest, CancellationToken)

public virtual Task<Operation<ExportReservationsUsageResponse, OperationMetadata>> ExportReservationsUsageAsync(ExportReservationsUsageRequest request, CancellationToken cancellationToken)

Exports reservations usage data requested by user into either an existing Cloud Storage bucket or a new/existing BigQuery table.

Parameters
Name Description
request ExportReservationsUsageRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskOperationExportReservationsUsageResponseOperationMetadata

A Task containing the RPC response.

Example
// Create client
UsageServiceClient usageServiceClient = await UsageServiceClient.CreateAsync();
// Initialize request argument(s)
ExportReservationsUsageRequest request = new ExportReservationsUsageRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    MachineFamily = "",
    CloudResourceType = "",
    UsageAggregationMethod = UsageHistory.Types.AggregationMethod.Unspecified,
    ShareType = ExportReservationsUsageRequest.Types.ShareType.Unspecified,
    StartDate = new Date(),
    EndDate = new Date(),
    OutputConfig = new OutputConfig(),
    LocationLevel = TimeSeries.Types.LocationType.Unspecified,
};
// Make the request
Operation<ExportReservationsUsageResponse, OperationMetadata> response = await usageServiceClient.ExportReservationsUsageAsync(request);

// Poll until the returned long-running operation is complete
Operation<ExportReservationsUsageResponse, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
ExportReservationsUsageResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<ExportReservationsUsageResponse, OperationMetadata> retrievedResponse = await usageServiceClient.PollOnceExportReservationsUsageAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    ExportReservationsUsageResponse retrievedResult = retrievedResponse.Result;
}

ExportUsageHistories(ExportUsageHistoriesRequest, CallSettings)

public virtual Operation<ExportUsageHistoriesResponse, OperationMetadata> ExportUsageHistories(ExportUsageHistoriesRequest request, CallSettings callSettings = null)

Exports historical usage data requested by user into either an existing Cloud Storage bucket or a BigQuery table.

Parameters
Name Description
request ExportUsageHistoriesRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationExportUsageHistoriesResponseOperationMetadata

The RPC response.

Example
// Create client
UsageServiceClient usageServiceClient = UsageServiceClient.Create();
// Initialize request argument(s)
ExportUsageHistoriesRequest request = new ExportUsageHistoriesRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    MachineFamily = "",
    DiskType = "",
    ResourceType = "",
    UsageAggregationMethod = UsageHistory.Types.AggregationMethod.Unspecified,
    StartDate = new Date(),
    EndDate = new Date(),
    OutputConfig = new OutputConfig(),
    GpuType = "",
    TpuType = "",
    IsSpot = false,
    MachineShape = new MachineShape(),
};
// Make the request
Operation<ExportUsageHistoriesResponse, OperationMetadata> response = usageServiceClient.ExportUsageHistories(request);

// Poll until the returned long-running operation is complete
Operation<ExportUsageHistoriesResponse, OperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
ExportUsageHistoriesResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<ExportUsageHistoriesResponse, OperationMetadata> retrievedResponse = usageServiceClient.PollOnceExportUsageHistories(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    ExportUsageHistoriesResponse retrievedResult = retrievedResponse.Result;
}

ExportUsageHistoriesAsync(ExportUsageHistoriesRequest, CallSettings)

public virtual Task<Operation<ExportUsageHistoriesResponse, OperationMetadata>> ExportUsageHistoriesAsync(ExportUsageHistoriesRequest request, CallSettings callSettings = null)

Exports historical usage data requested by user into either an existing Cloud Storage bucket or a BigQuery table.

Parameters
Name Description
request ExportUsageHistoriesRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationExportUsageHistoriesResponseOperationMetadata

A Task containing the RPC response.

Example
// Create client
UsageServiceClient usageServiceClient = await UsageServiceClient.CreateAsync();
// Initialize request argument(s)
ExportUsageHistoriesRequest request = new ExportUsageHistoriesRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    MachineFamily = "",
    DiskType = "",
    ResourceType = "",
    UsageAggregationMethod = UsageHistory.Types.AggregationMethod.Unspecified,
    StartDate = new Date(),
    EndDate = new Date(),
    OutputConfig = new OutputConfig(),
    GpuType = "",
    TpuType = "",
    IsSpot = false,
    MachineShape = new MachineShape(),
};
// Make the request
Operation<ExportUsageHistoriesResponse, OperationMetadata> response = await usageServiceClient.ExportUsageHistoriesAsync(request);

// Poll until the returned long-running operation is complete
Operation<ExportUsageHistoriesResponse, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
ExportUsageHistoriesResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<ExportUsageHistoriesResponse, OperationMetadata> retrievedResponse = await usageServiceClient.PollOnceExportUsageHistoriesAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    ExportUsageHistoriesResponse retrievedResult = retrievedResponse.Result;
}

ExportUsageHistoriesAsync(ExportUsageHistoriesRequest, CancellationToken)

public virtual Task<Operation<ExportUsageHistoriesResponse, OperationMetadata>> ExportUsageHistoriesAsync(ExportUsageHistoriesRequest request, CancellationToken cancellationToken)

Exports historical usage data requested by user into either an existing Cloud Storage bucket or a BigQuery table.

Parameters
Name Description
request ExportUsageHistoriesRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskOperationExportUsageHistoriesResponseOperationMetadata

A Task containing the RPC response.

Example
// Create client
UsageServiceClient usageServiceClient = await UsageServiceClient.CreateAsync();
// Initialize request argument(s)
ExportUsageHistoriesRequest request = new ExportUsageHistoriesRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    MachineFamily = "",
    DiskType = "",
    ResourceType = "",
    UsageAggregationMethod = UsageHistory.Types.AggregationMethod.Unspecified,
    StartDate = new Date(),
    EndDate = new Date(),
    OutputConfig = new OutputConfig(),
    GpuType = "",
    TpuType = "",
    IsSpot = false,
    MachineShape = new MachineShape(),
};
// Make the request
Operation<ExportUsageHistoriesResponse, OperationMetadata> response = await usageServiceClient.ExportUsageHistoriesAsync(request);

// Poll until the returned long-running operation is complete
Operation<ExportUsageHistoriesResponse, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
ExportUsageHistoriesResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<ExportUsageHistoriesResponse, OperationMetadata> retrievedResponse = await usageServiceClient.PollOnceExportUsageHistoriesAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    ExportUsageHistoriesResponse retrievedResult = retrievedResponse.Result;
}

PollOnceExportForecasts(string, CallSettings)

public virtual Operation<ExportForecastsResponse, OperationMetadata> PollOnceExportForecasts(string operationName, CallSettings callSettings = null)

Poll an operation once, using an operationName from a previous invocation of ExportForecasts.

Parameters
Name Description
operationName string

The name of a previously invoked operation. Must not be null or empty.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationExportForecastsResponseOperationMetadata

The result of polling the operation.

PollOnceExportForecastsAsync(string, CallSettings)

public virtual Task<Operation<ExportForecastsResponse, OperationMetadata>> PollOnceExportForecastsAsync(string operationName, CallSettings callSettings = null)

Asynchronously poll an operation once, using an operationName from a previous invocation of ExportForecasts.

Parameters
Name Description
operationName string

The name of a previously invoked operation. Must not be null or empty.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationExportForecastsResponseOperationMetadata

A task representing the result of polling the operation.

PollOnceExportReservationsUsage(string, CallSettings)

public virtual Operation<ExportReservationsUsageResponse, OperationMetadata> PollOnceExportReservationsUsage(string operationName, CallSettings callSettings = null)

Poll an operation once, using an operationName from a previous invocation of ExportReservationsUsage.

Parameters
Name Description
operationName string

The name of a previously invoked operation. Must not be null or empty.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationExportReservationsUsageResponseOperationMetadata

The result of polling the operation.

PollOnceExportReservationsUsageAsync(string, CallSettings)

public virtual Task<Operation<ExportReservationsUsageResponse, OperationMetadata>> PollOnceExportReservationsUsageAsync(string operationName, CallSettings callSettings = null)

Asynchronously poll an operation once, using an operationName from a previous invocation of ExportReservationsUsage.

Parameters
Name Description
operationName string

The name of a previously invoked operation. Must not be null or empty.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationExportReservationsUsageResponseOperationMetadata

A task representing the result of polling the operation.

PollOnceExportUsageHistories(string, CallSettings)

public virtual Operation<ExportUsageHistoriesResponse, OperationMetadata> PollOnceExportUsageHistories(string operationName, CallSettings callSettings = null)

Poll an operation once, using an operationName from a previous invocation of ExportUsageHistories .

Parameters
Name Description
operationName string

The name of a previously invoked operation. Must not be null or empty.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationExportUsageHistoriesResponseOperationMetadata

The result of polling the operation.

PollOnceExportUsageHistoriesAsync(string, CallSettings)

public virtual Task<Operation<ExportUsageHistoriesResponse, OperationMetadata>> PollOnceExportUsageHistoriesAsync(string operationName, CallSettings callSettings = null)

Asynchronously poll an operation once, using an operationName from a previous invocation of ExportUsageHistories.

Parameters
Name Description
operationName string

The name of a previously invoked operation. Must not be null or empty.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationExportUsageHistoriesResponseOperationMetadata

A task representing the result of polling the operation.

QueryForecasts(QueryForecastsRequest, CallSettings)

public virtual QueryForecastsResponse QueryForecasts(QueryForecastsRequest request, CallSettings callSettings = null)

Returns a list of the forecasts that are in the parent parameter and match your specified filters.

Parameters
Name Description
request QueryForecastsRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
QueryForecastsResponse

The RPC response.

Example
// Create client
UsageServiceClient usageServiceClient = UsageServiceClient.Create();
// Initialize request argument(s)
QueryForecastsRequest request = new QueryForecastsRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    MachineFamily = "",
    CloudResourceType = "",
    ForecastType = Forecast.Types.ForecastType.Unspecified,
    PredictionInterval = Forecast.Types.PredictionInterval.Unspecified,
    AggregationMethod = UsageHistory.Types.AggregationMethod.Unspecified,
    DiskType = "",
    GpuType = "",
    TpuType = "",
    MachineShape = new MachineShape(),
    ConfidentialMode = false,
};
// Make the request
QueryForecastsResponse response = usageServiceClient.QueryForecasts(request);

QueryForecastsAsync(QueryForecastsRequest, CallSettings)

public virtual Task<QueryForecastsResponse> QueryForecastsAsync(QueryForecastsRequest request, CallSettings callSettings = null)

Returns a list of the forecasts that are in the parent parameter and match your specified filters.

Parameters
Name Description
request QueryForecastsRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskQueryForecastsResponse

A Task containing the RPC response.

Example
// Create client
UsageServiceClient usageServiceClient = await UsageServiceClient.CreateAsync();
// Initialize request argument(s)
QueryForecastsRequest request = new QueryForecastsRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    MachineFamily = "",
    CloudResourceType = "",
    ForecastType = Forecast.Types.ForecastType.Unspecified,
    PredictionInterval = Forecast.Types.PredictionInterval.Unspecified,
    AggregationMethod = UsageHistory.Types.AggregationMethod.Unspecified,
    DiskType = "",
    GpuType = "",
    TpuType = "",
    MachineShape = new MachineShape(),
    ConfidentialMode = false,
};
// Make the request
QueryForecastsResponse response = await usageServiceClient.QueryForecastsAsync(request);

QueryForecastsAsync(QueryForecastsRequest, CancellationToken)

public virtual Task<QueryForecastsResponse> QueryForecastsAsync(QueryForecastsRequest request, CancellationToken cancellationToken)

Returns a list of the forecasts that are in the parent parameter and match your specified filters.

Parameters
Name Description
request QueryForecastsRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskQueryForecastsResponse

A Task containing the RPC response.

Example
// Create client
UsageServiceClient usageServiceClient = await UsageServiceClient.CreateAsync();
// Initialize request argument(s)
QueryForecastsRequest request = new QueryForecastsRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    MachineFamily = "",
    CloudResourceType = "",
    ForecastType = Forecast.Types.ForecastType.Unspecified,
    PredictionInterval = Forecast.Types.PredictionInterval.Unspecified,
    AggregationMethod = UsageHistory.Types.AggregationMethod.Unspecified,
    DiskType = "",
    GpuType = "",
    TpuType = "",
    MachineShape = new MachineShape(),
    ConfidentialMode = false,
};
// Make the request
QueryForecastsResponse response = await usageServiceClient.QueryForecastsAsync(request);

QueryReservations(LocationName, CallSettings)

public virtual QueryReservationsResponse QueryReservations(LocationName parent, CallSettings callSettings = null)

Returns a list of the reservations that are in the parent parameter and match your specified filters.

Parameters
Name Description
parent LocationName

Required. The compute engine resource and location for the time series values to return. The format is:

projects/{project}/locations/{location} or organizations/{organization}/locations/{location} or folders/{folder}/locations/{location}

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
QueryReservationsResponse

The RPC response.

Example
// Create client
UsageServiceClient usageServiceClient = UsageServiceClient.Create();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
// Make the request
QueryReservationsResponse response = usageServiceClient.QueryReservations(parent);

QueryReservations(QueryReservationsRequest, CallSettings)

public virtual QueryReservationsResponse QueryReservations(QueryReservationsRequest request, CallSettings callSettings = null)

Returns a list of the reservations that are in the parent parameter and match your specified filters.

Parameters
Name Description
request QueryReservationsRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
QueryReservationsResponse

The RPC response.

Example
// Create client
UsageServiceClient usageServiceClient = UsageServiceClient.Create();
// Initialize request argument(s)
QueryReservationsRequest request = new QueryReservationsRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    MachineFamily = "",
    GpuType = "",
    CloudResourceType = "",
    ReservationType = QueryReservationsRequest.Types.ReservationType.Unspecified,
    ShareType = QueryReservationsRequest.Types.ShareType.Unspecified,
    OwnershipType = QueryReservationsRequest.Types.OwnershipType.Unspecified,
    ReservationDataLevel = QueryReservationsRequest.Types.ReservationDataLevel.Unspecified,
    MachineShape = new MachineShape(),
    IncludeUnapprovedReservations = false,
    AggregationMethod = UsageHistory.Types.AggregationMethod.Unspecified,
    StartDate = new Date(),
    EndDate = new Date(),
    LocationLevel = TimeSeries.Types.LocationType.Unspecified,
};
// Make the request
QueryReservationsResponse response = usageServiceClient.QueryReservations(request);

QueryReservations(string, CallSettings)

public virtual QueryReservationsResponse QueryReservations(string parent, CallSettings callSettings = null)

Returns a list of the reservations that are in the parent parameter and match your specified filters.

Parameters
Name Description
parent string

Required. The compute engine resource and location for the time series values to return. The format is:

projects/{project}/locations/{location} or organizations/{organization}/locations/{location} or folders/{folder}/locations/{location}

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
QueryReservationsResponse

The RPC response.

Example
// Create client
UsageServiceClient usageServiceClient = UsageServiceClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
// Make the request
QueryReservationsResponse response = usageServiceClient.QueryReservations(parent);

QueryReservationsAsync(LocationName, CallSettings)

public virtual Task<QueryReservationsResponse> QueryReservationsAsync(LocationName parent, CallSettings callSettings = null)

Returns a list of the reservations that are in the parent parameter and match your specified filters.

Parameters
Name Description
parent LocationName

Required. The compute engine resource and location for the time series values to return. The format is:

projects/{project}/locations/{location} or organizations/{organization}/locations/{location} or folders/{folder}/locations/{location}

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskQueryReservationsResponse

A Task containing the RPC response.

Example
// Create client
UsageServiceClient usageServiceClient = await UsageServiceClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
// Make the request
QueryReservationsResponse response = await usageServiceClient.QueryReservationsAsync(parent);

QueryReservationsAsync(LocationName, CancellationToken)

public virtual Task<QueryReservationsResponse> QueryReservationsAsync(LocationName parent, CancellationToken cancellationToken)

Returns a list of the reservations that are in the parent parameter and match your specified filters.

Parameters
Name Description
parent LocationName

Required. The compute engine resource and location for the time series values to return. The format is:

projects/{project}/locations/{location} or organizations/{organization}/locations/{location} or folders/{folder}/locations/{location}

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskQueryReservationsResponse

A Task containing the RPC response.

Example
// Create client
UsageServiceClient usageServiceClient = await UsageServiceClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
// Make the request
QueryReservationsResponse response = await usageServiceClient.QueryReservationsAsync(parent);

QueryReservationsAsync(QueryReservationsRequest, CallSettings)

public virtual Task<QueryReservationsResponse> QueryReservationsAsync(QueryReservationsRequest request, CallSettings callSettings = null)

Returns a list of the reservations that are in the parent parameter and match your specified filters.

Parameters
Name Description
request QueryReservationsRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskQueryReservationsResponse

A Task containing the RPC response.

Example
// Create client
UsageServiceClient usageServiceClient = await UsageServiceClient.CreateAsync();
// Initialize request argument(s)
QueryReservationsRequest request = new QueryReservationsRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    MachineFamily = "",
    GpuType = "",
    CloudResourceType = "",
    ReservationType = QueryReservationsRequest.Types.ReservationType.Unspecified,
    ShareType = QueryReservationsRequest.Types.ShareType.Unspecified,
    OwnershipType = QueryReservationsRequest.Types.OwnershipType.Unspecified,
    ReservationDataLevel = QueryReservationsRequest.Types.ReservationDataLevel.Unspecified,
    MachineShape = new MachineShape(),
    IncludeUnapprovedReservations = false,
    AggregationMethod = UsageHistory.Types.AggregationMethod.Unspecified,
    StartDate = new Date(),
    EndDate = new Date(),
    LocationLevel = TimeSeries.Types.LocationType.Unspecified,
};
// Make the request
QueryReservationsResponse response = await usageServiceClient.QueryReservationsAsync(request);

QueryReservationsAsync(QueryReservationsRequest, CancellationToken)

public virtual Task<QueryReservationsResponse> QueryReservationsAsync(QueryReservationsRequest request, CancellationToken cancellationToken)

Returns a list of the reservations that are in the parent parameter and match your specified filters.

Parameters
Name Description
request QueryReservationsRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskQueryReservationsResponse

A Task containing the RPC response.

Example
// Create client
UsageServiceClient usageServiceClient = await UsageServiceClient.CreateAsync();
// Initialize request argument(s)
QueryReservationsRequest request = new QueryReservationsRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    MachineFamily = "",
    GpuType = "",
    CloudResourceType = "",
    ReservationType = QueryReservationsRequest.Types.ReservationType.Unspecified,
    ShareType = QueryReservationsRequest.Types.ShareType.Unspecified,
    OwnershipType = QueryReservationsRequest.Types.OwnershipType.Unspecified,
    ReservationDataLevel = QueryReservationsRequest.Types.ReservationDataLevel.Unspecified,
    MachineShape = new MachineShape(),
    IncludeUnapprovedReservations = false,
    AggregationMethod = UsageHistory.Types.AggregationMethod.Unspecified,
    StartDate = new Date(),
    EndDate = new Date(),
    LocationLevel = TimeSeries.Types.LocationType.Unspecified,
};
// Make the request
QueryReservationsResponse response = await usageServiceClient.QueryReservationsAsync(request);

QueryReservationsAsync(string, CallSettings)

public virtual Task<QueryReservationsResponse> QueryReservationsAsync(string parent, CallSettings callSettings = null)

Returns a list of the reservations that are in the parent parameter and match your specified filters.

Parameters
Name Description
parent string

Required. The compute engine resource and location for the time series values to return. The format is:

projects/{project}/locations/{location} or organizations/{organization}/locations/{location} or folders/{folder}/locations/{location}

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskQueryReservationsResponse

A Task containing the RPC response.

Example
// Create client
UsageServiceClient usageServiceClient = await UsageServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
// Make the request
QueryReservationsResponse response = await usageServiceClient.QueryReservationsAsync(parent);

QueryReservationsAsync(string, CancellationToken)

public virtual Task<QueryReservationsResponse> QueryReservationsAsync(string parent, CancellationToken cancellationToken)

Returns a list of the reservations that are in the parent parameter and match your specified filters.

Parameters
Name Description
parent string

Required. The compute engine resource and location for the time series values to return. The format is:

projects/{project}/locations/{location} or organizations/{organization}/locations/{location} or folders/{folder}/locations/{location}

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskQueryReservationsResponse

A Task containing the RPC response.

Example
// Create client
UsageServiceClient usageServiceClient = await UsageServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
// Make the request
QueryReservationsResponse response = await usageServiceClient.QueryReservationsAsync(parent);

QueryUsageHistories(QueryUsageHistoriesRequest, CallSettings)

public virtual QueryUsageHistoriesResponse QueryUsageHistories(QueryUsageHistoriesRequest request, CallSettings callSettings = null)

Returns a list of the usage histories that are in the parent parameter and match your specified filters.

Parameters
Name Description
request QueryUsageHistoriesRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
QueryUsageHistoriesResponse

The RPC response.

Example
// Create client
UsageServiceClient usageServiceClient = UsageServiceClient.Create();
// Initialize request argument(s)
QueryUsageHistoriesRequest request = new QueryUsageHistoriesRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    MachineFamily = "",
    CloudResourceType = "",
    UsageAggregationMethod = UsageHistory.Types.AggregationMethod.Unspecified,
    DiskType = "",
    GpuType = "",
    StartDate = new Date(),
    EndDate = new Date(),
    LocationLevel = TimeSeries.Types.LocationType.Unspecified,
    TpuType = "",
    MachineShape = new MachineShape(),
    IsSpot = false,
    ConfidentialMode = false,
};
// Make the request
QueryUsageHistoriesResponse response = usageServiceClient.QueryUsageHistories(request);

QueryUsageHistoriesAsync(QueryUsageHistoriesRequest, CallSettings)

public virtual Task<QueryUsageHistoriesResponse> QueryUsageHistoriesAsync(QueryUsageHistoriesRequest request, CallSettings callSettings = null)

Returns a list of the usage histories that are in the parent parameter and match your specified filters.

Parameters
Name Description
request QueryUsageHistoriesRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskQueryUsageHistoriesResponse

A Task containing the RPC response.

Example
// Create client
UsageServiceClient usageServiceClient = await UsageServiceClient.CreateAsync();
// Initialize request argument(s)
QueryUsageHistoriesRequest request = new QueryUsageHistoriesRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    MachineFamily = "",
    CloudResourceType = "",
    UsageAggregationMethod = UsageHistory.Types.AggregationMethod.Unspecified,
    DiskType = "",
    GpuType = "",
    StartDate = new Date(),
    EndDate = new Date(),
    LocationLevel = TimeSeries.Types.LocationType.Unspecified,
    TpuType = "",
    MachineShape = new MachineShape(),
    IsSpot = false,
    ConfidentialMode = false,
};
// Make the request
QueryUsageHistoriesResponse response = await usageServiceClient.QueryUsageHistoriesAsync(request);

QueryUsageHistoriesAsync(QueryUsageHistoriesRequest, CancellationToken)

public virtual Task<QueryUsageHistoriesResponse> QueryUsageHistoriesAsync(QueryUsageHistoriesRequest request, CancellationToken cancellationToken)

Returns a list of the usage histories that are in the parent parameter and match your specified filters.

Parameters
Name Description
request QueryUsageHistoriesRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskQueryUsageHistoriesResponse

A Task containing the RPC response.

Example
// Create client
UsageServiceClient usageServiceClient = await UsageServiceClient.CreateAsync();
// Initialize request argument(s)
QueryUsageHistoriesRequest request = new QueryUsageHistoriesRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    MachineFamily = "",
    CloudResourceType = "",
    UsageAggregationMethod = UsageHistory.Types.AggregationMethod.Unspecified,
    DiskType = "",
    GpuType = "",
    StartDate = new Date(),
    EndDate = new Date(),
    LocationLevel = TimeSeries.Types.LocationType.Unspecified,
    TpuType = "",
    MachineShape = new MachineShape(),
    IsSpot = false,
    ConfidentialMode = false,
};
// Make the request
QueryUsageHistoriesResponse response = await usageServiceClient.QueryUsageHistoriesAsync(request);

ShutdownDefaultChannelsAsync()

public static Task ShutdownDefaultChannelsAsync()

Shuts down any channels automatically created by Create() and CreateAsync(CancellationToken). Channels which weren't automatically created are not affected.

Returns
Type Description
Task

A task representing the asynchronous shutdown operation.

Remarks

After calling this method, further calls to Create() and CreateAsync(CancellationToken) will create new channels, which could in turn be shut down by another call to this method.