Class MetricsServiceV2Client (3.3.0)

public abstract class MetricsServiceV2Client

MetricsServiceV2 client wrapper, for convenient use.

Inheritance

Object > MetricsServiceV2Client

Namespace

Google.Cloud.Logging.V2

Assembly

Google.Cloud.Logging.V2.dll

Remarks

Service for configuring logs-based metrics.

Properties

DefaultEndpoint

public static string DefaultEndpoint { get; }

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

Property Value
TypeDescription
String

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default MetricsServiceV2 scopes.

Property Value
TypeDescription
IReadOnlyList<String>
Remarks

GrpcClient

public virtual MetricsServiceV2.MetricsServiceV2Client GrpcClient { get; }

The underlying gRPC MetricsServiceV2 client

Property Value
TypeDescription
MetricsServiceV2.MetricsServiceV2Client

Methods

Create()

public static MetricsServiceV2Client Create()

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

Returns
TypeDescription
MetricsServiceV2Client

The created MetricsServiceV2Client.

CreateAsync(CancellationToken)

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

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

Parameter
NameDescription
cancellationTokenCancellationToken

The CancellationToken to use while creating the client.

Returns
TypeDescription
Task<MetricsServiceV2Client>

The task representing the created MetricsServiceV2Client.

CreateLogMetric(ProjectName, LogMetric, CallSettings)

public virtual LogMetric CreateLogMetric(ProjectName parent, LogMetric metric, CallSettings callSettings = null)

Creates a logs-based metric.

Parameters
NameDescription
parentProjectName

Required. The resource name of the project in which to create the metric:

"projects/[PROJECT_ID]"

The new metric must be provided in the request.

metricLogMetric

Required. The new logs-based metric, which must not have an identifier that already exists.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
LogMetric

The RPC response.

Example
// Create client
MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.Create();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
LogMetric metric = new LogMetric();
// Make the request
LogMetric response = metricsServiceV2Client.CreateLogMetric(parent, metric);

CreateLogMetric(CreateLogMetricRequest, CallSettings)

public virtual LogMetric CreateLogMetric(CreateLogMetricRequest request, CallSettings callSettings = null)

Creates a logs-based metric.

Parameters
NameDescription
requestCreateLogMetricRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
LogMetric

The RPC response.

Example
// Create client
MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.Create();
// Initialize request argument(s)
CreateLogMetricRequest request = new CreateLogMetricRequest
{
    ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
    Metric = new LogMetric(),
};
// Make the request
LogMetric response = metricsServiceV2Client.CreateLogMetric(request);

CreateLogMetric(String, LogMetric, CallSettings)

public virtual LogMetric CreateLogMetric(string parent, LogMetric metric, CallSettings callSettings = null)

Creates a logs-based metric.

Parameters
NameDescription
parentString

Required. The resource name of the project in which to create the metric:

"projects/[PROJECT_ID]"

The new metric must be provided in the request.

metricLogMetric

Required. The new logs-based metric, which must not have an identifier that already exists.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
LogMetric

The RPC response.

Example
// Create client
MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
LogMetric metric = new LogMetric();
// Make the request
LogMetric response = metricsServiceV2Client.CreateLogMetric(parent, metric);

CreateLogMetricAsync(ProjectName, LogMetric, CallSettings)

public virtual Task<LogMetric> CreateLogMetricAsync(ProjectName parent, LogMetric metric, CallSettings callSettings = null)

Creates a logs-based metric.

Parameters
NameDescription
parentProjectName

Required. The resource name of the project in which to create the metric:

"projects/[PROJECT_ID]"

The new metric must be provided in the request.

metricLogMetric

Required. The new logs-based metric, which must not have an identifier that already exists.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<LogMetric>

A Task containing the RPC response.

Example
// Create client
MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
LogMetric metric = new LogMetric();
// Make the request
LogMetric response = await metricsServiceV2Client.CreateLogMetricAsync(parent, metric);

CreateLogMetricAsync(ProjectName, LogMetric, CancellationToken)

public virtual Task<LogMetric> CreateLogMetricAsync(ProjectName parent, LogMetric metric, CancellationToken cancellationToken)

Creates a logs-based metric.

Parameters
NameDescription
parentProjectName

Required. The resource name of the project in which to create the metric:

"projects/[PROJECT_ID]"

The new metric must be provided in the request.

metricLogMetric

Required. The new logs-based metric, which must not have an identifier that already exists.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<LogMetric>

A Task containing the RPC response.

Example
// Create client
MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
LogMetric metric = new LogMetric();
// Make the request
LogMetric response = await metricsServiceV2Client.CreateLogMetricAsync(parent, metric);

CreateLogMetricAsync(CreateLogMetricRequest, CallSettings)

public virtual Task<LogMetric> CreateLogMetricAsync(CreateLogMetricRequest request, CallSettings callSettings = null)

Creates a logs-based metric.

Parameters
NameDescription
requestCreateLogMetricRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<LogMetric>

A Task containing the RPC response.

Example
// Create client
MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync();
// Initialize request argument(s)
CreateLogMetricRequest request = new CreateLogMetricRequest
{
    ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
    Metric = new LogMetric(),
};
// Make the request
LogMetric response = await metricsServiceV2Client.CreateLogMetricAsync(request);

CreateLogMetricAsync(CreateLogMetricRequest, CancellationToken)

public virtual Task<LogMetric> CreateLogMetricAsync(CreateLogMetricRequest request, CancellationToken cancellationToken)

Creates a logs-based metric.

Parameters
NameDescription
requestCreateLogMetricRequest

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

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<LogMetric>

A Task containing the RPC response.

Example
// Create client
MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync();
// Initialize request argument(s)
CreateLogMetricRequest request = new CreateLogMetricRequest
{
    ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
    Metric = new LogMetric(),
};
// Make the request
LogMetric response = await metricsServiceV2Client.CreateLogMetricAsync(request);

CreateLogMetricAsync(String, LogMetric, CallSettings)

public virtual Task<LogMetric> CreateLogMetricAsync(string parent, LogMetric metric, CallSettings callSettings = null)

Creates a logs-based metric.

Parameters
NameDescription
parentString

Required. The resource name of the project in which to create the metric:

"projects/[PROJECT_ID]"

The new metric must be provided in the request.

metricLogMetric

Required. The new logs-based metric, which must not have an identifier that already exists.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<LogMetric>

A Task containing the RPC response.

Example
// Create client
MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
LogMetric metric = new LogMetric();
// Make the request
LogMetric response = await metricsServiceV2Client.CreateLogMetricAsync(parent, metric);

CreateLogMetricAsync(String, LogMetric, CancellationToken)

public virtual Task<LogMetric> CreateLogMetricAsync(string parent, LogMetric metric, CancellationToken cancellationToken)

Creates a logs-based metric.

Parameters
NameDescription
parentString

Required. The resource name of the project in which to create the metric:

"projects/[PROJECT_ID]"

The new metric must be provided in the request.

metricLogMetric

Required. The new logs-based metric, which must not have an identifier that already exists.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<LogMetric>

A Task containing the RPC response.

Example
// Create client
MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
LogMetric metric = new LogMetric();
// Make the request
LogMetric response = await metricsServiceV2Client.CreateLogMetricAsync(parent, metric);

DeleteLogMetric(DeleteLogMetricRequest, CallSettings)

public virtual void DeleteLogMetric(DeleteLogMetricRequest request, CallSettings callSettings = null)

Deletes a logs-based metric.

Parameters
NameDescription
requestDeleteLogMetricRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Example
// Create client
MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.Create();
// Initialize request argument(s)
DeleteLogMetricRequest request = new DeleteLogMetricRequest
{
    MetricNameAsLogMetricName = LogMetricName.FromProjectMetric("[PROJECT]", "[METRIC]"),
};
// Make the request
metricsServiceV2Client.DeleteLogMetric(request);

DeleteLogMetric(LogMetricName, CallSettings)

public virtual void DeleteLogMetric(LogMetricName metricName, CallSettings callSettings = null)

Deletes a logs-based metric.

Parameters
NameDescription
metricNameLogMetricName

Required. The resource name of the metric to delete:

"projects/[PROJECT_ID]/metrics/[METRIC_ID]"

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Example
// Create client
MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.Create();
// Initialize request argument(s)
LogMetricName metricName = LogMetricName.FromProjectMetric("[PROJECT]", "[METRIC]");
// Make the request
metricsServiceV2Client.DeleteLogMetric(metricName);

DeleteLogMetric(String, CallSettings)

public virtual void DeleteLogMetric(string metricName, CallSettings callSettings = null)

Deletes a logs-based metric.

Parameters
NameDescription
metricNameString

Required. The resource name of the metric to delete:

"projects/[PROJECT_ID]/metrics/[METRIC_ID]"

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Example
// Create client
MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.Create();
// Initialize request argument(s)
string metricName = "projects/[PROJECT]/metrics/[METRIC]";
// Make the request
metricsServiceV2Client.DeleteLogMetric(metricName);

DeleteLogMetricAsync(DeleteLogMetricRequest, CallSettings)

public virtual Task DeleteLogMetricAsync(DeleteLogMetricRequest request, CallSettings callSettings = null)

Deletes a logs-based metric.

Parameters
NameDescription
requestDeleteLogMetricRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task

A Task containing the RPC response.

Example
// Create client
MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync();
// Initialize request argument(s)
DeleteLogMetricRequest request = new DeleteLogMetricRequest
{
    MetricNameAsLogMetricName = LogMetricName.FromProjectMetric("[PROJECT]", "[METRIC]"),
};
// Make the request
await metricsServiceV2Client.DeleteLogMetricAsync(request);

DeleteLogMetricAsync(DeleteLogMetricRequest, CancellationToken)

public virtual Task DeleteLogMetricAsync(DeleteLogMetricRequest request, CancellationToken cancellationToken)

Deletes a logs-based metric.

Parameters
NameDescription
requestDeleteLogMetricRequest

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

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task

A Task containing the RPC response.

Example
// Create client
MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync();
// Initialize request argument(s)
DeleteLogMetricRequest request = new DeleteLogMetricRequest
{
    MetricNameAsLogMetricName = LogMetricName.FromProjectMetric("[PROJECT]", "[METRIC]"),
};
// Make the request
await metricsServiceV2Client.DeleteLogMetricAsync(request);

DeleteLogMetricAsync(LogMetricName, CallSettings)

public virtual Task DeleteLogMetricAsync(LogMetricName metricName, CallSettings callSettings = null)

Deletes a logs-based metric.

Parameters
NameDescription
metricNameLogMetricName

Required. The resource name of the metric to delete:

"projects/[PROJECT_ID]/metrics/[METRIC_ID]"

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task

A Task containing the RPC response.

Example
// Create client
MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync();
// Initialize request argument(s)
LogMetricName metricName = LogMetricName.FromProjectMetric("[PROJECT]", "[METRIC]");
// Make the request
await metricsServiceV2Client.DeleteLogMetricAsync(metricName);

DeleteLogMetricAsync(LogMetricName, CancellationToken)

public virtual Task DeleteLogMetricAsync(LogMetricName metricName, CancellationToken cancellationToken)

Deletes a logs-based metric.

Parameters
NameDescription
metricNameLogMetricName

Required. The resource name of the metric to delete:

"projects/[PROJECT_ID]/metrics/[METRIC_ID]"

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task

A Task containing the RPC response.

Example
// Create client
MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync();
// Initialize request argument(s)
LogMetricName metricName = LogMetricName.FromProjectMetric("[PROJECT]", "[METRIC]");
// Make the request
await metricsServiceV2Client.DeleteLogMetricAsync(metricName);

DeleteLogMetricAsync(String, CallSettings)

public virtual Task DeleteLogMetricAsync(string metricName, CallSettings callSettings = null)

Deletes a logs-based metric.

Parameters
NameDescription
metricNameString

Required. The resource name of the metric to delete:

"projects/[PROJECT_ID]/metrics/[METRIC_ID]"

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task

A Task containing the RPC response.

Example
// Create client
MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync();
// Initialize request argument(s)
string metricName = "projects/[PROJECT]/metrics/[METRIC]";
// Make the request
await metricsServiceV2Client.DeleteLogMetricAsync(metricName);

DeleteLogMetricAsync(String, CancellationToken)

public virtual Task DeleteLogMetricAsync(string metricName, CancellationToken cancellationToken)

Deletes a logs-based metric.

Parameters
NameDescription
metricNameString

Required. The resource name of the metric to delete:

"projects/[PROJECT_ID]/metrics/[METRIC_ID]"

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task

A Task containing the RPC response.

Example
// Create client
MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync();
// Initialize request argument(s)
string metricName = "projects/[PROJECT]/metrics/[METRIC]";
// Make the request
await metricsServiceV2Client.DeleteLogMetricAsync(metricName);

GetLogMetric(GetLogMetricRequest, CallSettings)

public virtual LogMetric GetLogMetric(GetLogMetricRequest request, CallSettings callSettings = null)

Gets a logs-based metric.

Parameters
NameDescription
requestGetLogMetricRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
LogMetric

The RPC response.

Example
// Create client
MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.Create();
// Initialize request argument(s)
GetLogMetricRequest request = new GetLogMetricRequest
{
    MetricNameAsLogMetricName = LogMetricName.FromProjectMetric("[PROJECT]", "[METRIC]"),
};
// Make the request
LogMetric response = metricsServiceV2Client.GetLogMetric(request);

GetLogMetric(LogMetricName, CallSettings)

public virtual LogMetric GetLogMetric(LogMetricName metricName, CallSettings callSettings = null)

Gets a logs-based metric.

Parameters
NameDescription
metricNameLogMetricName

Required. The resource name of the desired metric:

"projects/[PROJECT_ID]/metrics/[METRIC_ID]"

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
LogMetric

The RPC response.

Example
// Create client
MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.Create();
// Initialize request argument(s)
LogMetricName metricName = LogMetricName.FromProjectMetric("[PROJECT]", "[METRIC]");
// Make the request
LogMetric response = metricsServiceV2Client.GetLogMetric(metricName);

GetLogMetric(String, CallSettings)

public virtual LogMetric GetLogMetric(string metricName, CallSettings callSettings = null)

Gets a logs-based metric.

Parameters
NameDescription
metricNameString

Required. The resource name of the desired metric:

"projects/[PROJECT_ID]/metrics/[METRIC_ID]"

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
LogMetric

The RPC response.

Example
// Create client
MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.Create();
// Initialize request argument(s)
string metricName = "projects/[PROJECT]/metrics/[METRIC]";
// Make the request
LogMetric response = metricsServiceV2Client.GetLogMetric(metricName);

GetLogMetricAsync(GetLogMetricRequest, CallSettings)

public virtual Task<LogMetric> GetLogMetricAsync(GetLogMetricRequest request, CallSettings callSettings = null)

Gets a logs-based metric.

Parameters
NameDescription
requestGetLogMetricRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<LogMetric>

A Task containing the RPC response.

Example
// Create client
MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync();
// Initialize request argument(s)
GetLogMetricRequest request = new GetLogMetricRequest
{
    MetricNameAsLogMetricName = LogMetricName.FromProjectMetric("[PROJECT]", "[METRIC]"),
};
// Make the request
LogMetric response = await metricsServiceV2Client.GetLogMetricAsync(request);

GetLogMetricAsync(GetLogMetricRequest, CancellationToken)

public virtual Task<LogMetric> GetLogMetricAsync(GetLogMetricRequest request, CancellationToken cancellationToken)

Gets a logs-based metric.

Parameters
NameDescription
requestGetLogMetricRequest

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

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<LogMetric>

A Task containing the RPC response.

Example
// Create client
MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync();
// Initialize request argument(s)
GetLogMetricRequest request = new GetLogMetricRequest
{
    MetricNameAsLogMetricName = LogMetricName.FromProjectMetric("[PROJECT]", "[METRIC]"),
};
// Make the request
LogMetric response = await metricsServiceV2Client.GetLogMetricAsync(request);

GetLogMetricAsync(LogMetricName, CallSettings)

public virtual Task<LogMetric> GetLogMetricAsync(LogMetricName metricName, CallSettings callSettings = null)

Gets a logs-based metric.

Parameters
NameDescription
metricNameLogMetricName

Required. The resource name of the desired metric:

"projects/[PROJECT_ID]/metrics/[METRIC_ID]"

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<LogMetric>

A Task containing the RPC response.

Example
// Create client
MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync();
// Initialize request argument(s)
LogMetricName metricName = LogMetricName.FromProjectMetric("[PROJECT]", "[METRIC]");
// Make the request
LogMetric response = await metricsServiceV2Client.GetLogMetricAsync(metricName);

GetLogMetricAsync(LogMetricName, CancellationToken)

public virtual Task<LogMetric> GetLogMetricAsync(LogMetricName metricName, CancellationToken cancellationToken)

Gets a logs-based metric.

Parameters
NameDescription
metricNameLogMetricName

Required. The resource name of the desired metric:

"projects/[PROJECT_ID]/metrics/[METRIC_ID]"

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<LogMetric>

A Task containing the RPC response.

Example
// Create client
MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync();
// Initialize request argument(s)
LogMetricName metricName = LogMetricName.FromProjectMetric("[PROJECT]", "[METRIC]");
// Make the request
LogMetric response = await metricsServiceV2Client.GetLogMetricAsync(metricName);

GetLogMetricAsync(String, CallSettings)

public virtual Task<LogMetric> GetLogMetricAsync(string metricName, CallSettings callSettings = null)

Gets a logs-based metric.

Parameters
NameDescription
metricNameString

Required. The resource name of the desired metric:

"projects/[PROJECT_ID]/metrics/[METRIC_ID]"

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<LogMetric>

A Task containing the RPC response.

Example
// Create client
MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync();
// Initialize request argument(s)
string metricName = "projects/[PROJECT]/metrics/[METRIC]";
// Make the request
LogMetric response = await metricsServiceV2Client.GetLogMetricAsync(metricName);

GetLogMetricAsync(String, CancellationToken)

public virtual Task<LogMetric> GetLogMetricAsync(string metricName, CancellationToken cancellationToken)

Gets a logs-based metric.

Parameters
NameDescription
metricNameString

Required. The resource name of the desired metric:

"projects/[PROJECT_ID]/metrics/[METRIC_ID]"

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<LogMetric>

A Task containing the RPC response.

Example
// Create client
MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync();
// Initialize request argument(s)
string metricName = "projects/[PROJECT]/metrics/[METRIC]";
// Make the request
LogMetric response = await metricsServiceV2Client.GetLogMetricAsync(metricName);

ListLogMetrics(ProjectName, String, Nullable<Int32>, CallSettings)

public virtual PagedEnumerable<ListLogMetricsResponse, LogMetric> ListLogMetrics(ProjectName parent, string pageToken = null, int? pageSize = default(int? ), CallSettings callSettings = null)

Lists logs-based metrics.

Parameters
NameDescription
parentProjectName

Required. The name of the project containing the metrics:

"projects/[PROJECT_ID]"

pageTokenString

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeNullable<Int32>

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerable<ListLogMetricsResponse, LogMetric>

A pageable sequence of LogMetric resources.

Example
// Create client
MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.Create();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
// Make the request
PagedEnumerable<ListLogMetricsResponse, LogMetric> response = metricsServiceV2Client.ListLogMetrics(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (LogMetric item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListLogMetricsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (LogMetric 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<LogMetric> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (LogMetric 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;

ListLogMetrics(ListLogMetricsRequest, CallSettings)

public virtual PagedEnumerable<ListLogMetricsResponse, LogMetric> ListLogMetrics(ListLogMetricsRequest request, CallSettings callSettings = null)

Lists logs-based metrics.

Parameters
NameDescription
requestListLogMetricsRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerable<ListLogMetricsResponse, LogMetric>

A pageable sequence of LogMetric resources.

Example
// Create client
MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.Create();
// Initialize request argument(s)
ListLogMetricsRequest request = new ListLogMetricsRequest
{
    ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
};
// Make the request
PagedEnumerable<ListLogMetricsResponse, LogMetric> response = metricsServiceV2Client.ListLogMetrics(request);

// Iterate over all response items, lazily performing RPCs as required
foreach (LogMetric item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListLogMetricsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (LogMetric 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<LogMetric> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (LogMetric 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;

ListLogMetrics(String, String, Nullable<Int32>, CallSettings)

public virtual PagedEnumerable<ListLogMetricsResponse, LogMetric> ListLogMetrics(string parent, string pageToken = null, int? pageSize = default(int? ), CallSettings callSettings = null)

Lists logs-based metrics.

Parameters
NameDescription
parentString

Required. The name of the project containing the metrics:

"projects/[PROJECT_ID]"

pageTokenString

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeNullable<Int32>

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerable<ListLogMetricsResponse, LogMetric>

A pageable sequence of LogMetric resources.

Example
// Create client
MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
// Make the request
PagedEnumerable<ListLogMetricsResponse, LogMetric> response = metricsServiceV2Client.ListLogMetrics(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (LogMetric item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListLogMetricsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (LogMetric 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<LogMetric> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (LogMetric 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;

ListLogMetricsAsync(ProjectName, String, Nullable<Int32>, CallSettings)

public virtual PagedAsyncEnumerable<ListLogMetricsResponse, LogMetric> ListLogMetricsAsync(ProjectName parent, string pageToken = null, int? pageSize = default(int? ), CallSettings callSettings = null)

Lists logs-based metrics.

Parameters
NameDescription
parentProjectName

Required. The name of the project containing the metrics:

"projects/[PROJECT_ID]"

pageTokenString

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeNullable<Int32>

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerable<ListLogMetricsResponse, LogMetric>

A pageable asynchronous sequence of LogMetric resources.

Example
// Create client
MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
// Make the request
PagedAsyncEnumerable<ListLogMetricsResponse, LogMetric> response = metricsServiceV2Client.ListLogMetricsAsync(parent);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((LogMetric 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((ListLogMetricsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (LogMetric 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<LogMetric> 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 (LogMetric 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;

ListLogMetricsAsync(ListLogMetricsRequest, CallSettings)

public virtual PagedAsyncEnumerable<ListLogMetricsResponse, LogMetric> ListLogMetricsAsync(ListLogMetricsRequest request, CallSettings callSettings = null)

Lists logs-based metrics.

Parameters
NameDescription
requestListLogMetricsRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerable<ListLogMetricsResponse, LogMetric>

A pageable asynchronous sequence of LogMetric resources.

Example
// Create client
MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync();
// Initialize request argument(s)
ListLogMetricsRequest request = new ListLogMetricsRequest
{
    ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
};
// Make the request
PagedAsyncEnumerable<ListLogMetricsResponse, LogMetric> response = metricsServiceV2Client.ListLogMetricsAsync(request);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((LogMetric 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((ListLogMetricsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (LogMetric 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<LogMetric> 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 (LogMetric 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;

ListLogMetricsAsync(String, String, Nullable<Int32>, CallSettings)

public virtual PagedAsyncEnumerable<ListLogMetricsResponse, LogMetric> ListLogMetricsAsync(string parent, string pageToken = null, int? pageSize = default(int? ), CallSettings callSettings = null)

Lists logs-based metrics.

Parameters
NameDescription
parentString

Required. The name of the project containing the metrics:

"projects/[PROJECT_ID]"

pageTokenString

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeNullable<Int32>

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerable<ListLogMetricsResponse, LogMetric>

A pageable asynchronous sequence of LogMetric resources.

Example
// Create client
MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
// Make the request
PagedAsyncEnumerable<ListLogMetricsResponse, LogMetric> response = metricsServiceV2Client.ListLogMetricsAsync(parent);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((LogMetric 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((ListLogMetricsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (LogMetric 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<LogMetric> 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 (LogMetric 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;

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
TypeDescription
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.

UpdateLogMetric(LogMetricName, LogMetric, CallSettings)

public virtual LogMetric UpdateLogMetric(LogMetricName metricName, LogMetric metric, CallSettings callSettings = null)

Creates or updates a logs-based metric.

Parameters
NameDescription
metricNameLogMetricName

Required. The resource name of the metric to update:

"projects/[PROJECT_ID]/metrics/[METRIC_ID]"

The updated metric must be provided in the request and it's name field must be the same as [METRIC_ID] If the metric does not exist in [PROJECT_ID], then a new metric is created.

metricLogMetric

Required. The updated metric.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
LogMetric

The RPC response.

Example
// Create client
MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.Create();
// Initialize request argument(s)
LogMetricName metricName = LogMetricName.FromProjectMetric("[PROJECT]", "[METRIC]");
LogMetric metric = new LogMetric();
// Make the request
LogMetric response = metricsServiceV2Client.UpdateLogMetric(metricName, metric);

UpdateLogMetric(UpdateLogMetricRequest, CallSettings)

public virtual LogMetric UpdateLogMetric(UpdateLogMetricRequest request, CallSettings callSettings = null)

Creates or updates a logs-based metric.

Parameters
NameDescription
requestUpdateLogMetricRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
LogMetric

The RPC response.

Example
// Create client
MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.Create();
// Initialize request argument(s)
UpdateLogMetricRequest request = new UpdateLogMetricRequest
{
    MetricNameAsLogMetricName = LogMetricName.FromProjectMetric("[PROJECT]", "[METRIC]"),
    Metric = new LogMetric(),
};
// Make the request
LogMetric response = metricsServiceV2Client.UpdateLogMetric(request);

UpdateLogMetric(String, LogMetric, CallSettings)

public virtual LogMetric UpdateLogMetric(string metricName, LogMetric metric, CallSettings callSettings = null)

Creates or updates a logs-based metric.

Parameters
NameDescription
metricNameString

Required. The resource name of the metric to update:

"projects/[PROJECT_ID]/metrics/[METRIC_ID]"

The updated metric must be provided in the request and it's name field must be the same as [METRIC_ID] If the metric does not exist in [PROJECT_ID], then a new metric is created.

metricLogMetric

Required. The updated metric.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
LogMetric

The RPC response.

Example
// Create client
MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.Create();
// Initialize request argument(s)
string metricName = "projects/[PROJECT]/metrics/[METRIC]";
LogMetric metric = new LogMetric();
// Make the request
LogMetric response = metricsServiceV2Client.UpdateLogMetric(metricName, metric);

UpdateLogMetricAsync(LogMetricName, LogMetric, CallSettings)

public virtual Task<LogMetric> UpdateLogMetricAsync(LogMetricName metricName, LogMetric metric, CallSettings callSettings = null)

Creates or updates a logs-based metric.

Parameters
NameDescription
metricNameLogMetricName

Required. The resource name of the metric to update:

"projects/[PROJECT_ID]/metrics/[METRIC_ID]"

The updated metric must be provided in the request and it's name field must be the same as [METRIC_ID] If the metric does not exist in [PROJECT_ID], then a new metric is created.

metricLogMetric

Required. The updated metric.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<LogMetric>

A Task containing the RPC response.

Example
// Create client
MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync();
// Initialize request argument(s)
LogMetricName metricName = LogMetricName.FromProjectMetric("[PROJECT]", "[METRIC]");
LogMetric metric = new LogMetric();
// Make the request
LogMetric response = await metricsServiceV2Client.UpdateLogMetricAsync(metricName, metric);

UpdateLogMetricAsync(LogMetricName, LogMetric, CancellationToken)

public virtual Task<LogMetric> UpdateLogMetricAsync(LogMetricName metricName, LogMetric metric, CancellationToken cancellationToken)

Creates or updates a logs-based metric.

Parameters
NameDescription
metricNameLogMetricName

Required. The resource name of the metric to update:

"projects/[PROJECT_ID]/metrics/[METRIC_ID]"

The updated metric must be provided in the request and it's name field must be the same as [METRIC_ID] If the metric does not exist in [PROJECT_ID], then a new metric is created.

metricLogMetric

Required. The updated metric.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<LogMetric>

A Task containing the RPC response.

Example
// Create client
MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync();
// Initialize request argument(s)
LogMetricName metricName = LogMetricName.FromProjectMetric("[PROJECT]", "[METRIC]");
LogMetric metric = new LogMetric();
// Make the request
LogMetric response = await metricsServiceV2Client.UpdateLogMetricAsync(metricName, metric);

UpdateLogMetricAsync(UpdateLogMetricRequest, CallSettings)

public virtual Task<LogMetric> UpdateLogMetricAsync(UpdateLogMetricRequest request, CallSettings callSettings = null)

Creates or updates a logs-based metric.

Parameters
NameDescription
requestUpdateLogMetricRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<LogMetric>

A Task containing the RPC response.

Example
// Create client
MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync();
// Initialize request argument(s)
UpdateLogMetricRequest request = new UpdateLogMetricRequest
{
    MetricNameAsLogMetricName = LogMetricName.FromProjectMetric("[PROJECT]", "[METRIC]"),
    Metric = new LogMetric(),
};
// Make the request
LogMetric response = await metricsServiceV2Client.UpdateLogMetricAsync(request);

UpdateLogMetricAsync(UpdateLogMetricRequest, CancellationToken)

public virtual Task<LogMetric> UpdateLogMetricAsync(UpdateLogMetricRequest request, CancellationToken cancellationToken)

Creates or updates a logs-based metric.

Parameters
NameDescription
requestUpdateLogMetricRequest

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

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<LogMetric>

A Task containing the RPC response.

Example
// Create client
MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync();
// Initialize request argument(s)
UpdateLogMetricRequest request = new UpdateLogMetricRequest
{
    MetricNameAsLogMetricName = LogMetricName.FromProjectMetric("[PROJECT]", "[METRIC]"),
    Metric = new LogMetric(),
};
// Make the request
LogMetric response = await metricsServiceV2Client.UpdateLogMetricAsync(request);

UpdateLogMetricAsync(String, LogMetric, CallSettings)

public virtual Task<LogMetric> UpdateLogMetricAsync(string metricName, LogMetric metric, CallSettings callSettings = null)

Creates or updates a logs-based metric.

Parameters
NameDescription
metricNameString

Required. The resource name of the metric to update:

"projects/[PROJECT_ID]/metrics/[METRIC_ID]"

The updated metric must be provided in the request and it's name field must be the same as [METRIC_ID] If the metric does not exist in [PROJECT_ID], then a new metric is created.

metricLogMetric

Required. The updated metric.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<LogMetric>

A Task containing the RPC response.

Example
// Create client
MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync();
// Initialize request argument(s)
string metricName = "projects/[PROJECT]/metrics/[METRIC]";
LogMetric metric = new LogMetric();
// Make the request
LogMetric response = await metricsServiceV2Client.UpdateLogMetricAsync(metricName, metric);

UpdateLogMetricAsync(String, LogMetric, CancellationToken)

public virtual Task<LogMetric> UpdateLogMetricAsync(string metricName, LogMetric metric, CancellationToken cancellationToken)

Creates or updates a logs-based metric.

Parameters
NameDescription
metricNameString

Required. The resource name of the metric to update:

"projects/[PROJECT_ID]/metrics/[METRIC_ID]"

The updated metric must be provided in the request and it's name field must be the same as [METRIC_ID] If the metric does not exist in [PROJECT_ID], then a new metric is created.

metricLogMetric

Required. The updated metric.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<LogMetric>

A Task containing the RPC response.

Example
// Create client
MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync();
// Initialize request argument(s)
string metricName = "projects/[PROJECT]/metrics/[METRIC]";
LogMetric metric = new LogMetric();
// Make the request
LogMetric response = await metricsServiceV2Client.UpdateLogMetricAsync(metricName, metric);