Google Cloud Monitoring v3 API - Class AlertPolicyServiceClient (3.9.0)

public abstract class AlertPolicyServiceClient

Reference documentation and code samples for the Google Cloud Monitoring v3 API class AlertPolicyServiceClient.

AlertPolicyService client wrapper, for convenient use.

Inheritance

object > AlertPolicyServiceClient

Namespace

Google.Cloud.Monitoring.V3

Assembly

Google.Cloud.Monitoring.V3.dll

Remarks

The AlertPolicyService API is used to manage (list, create, delete, edit) alert policies in Cloud Monitoring. An alerting policy is a description of the conditions under which some aspect of your system is considered to be "unhealthy" and the ways to notify people or services about this state. In addition to using this API, alert policies can also be managed through Cloud Monitoring, which can be reached by clicking the "Monitoring" tab in Cloud console.

Properties

DefaultEndpoint

public static string DefaultEndpoint { get; }

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

Property Value
Type Description
string

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default AlertPolicyService scopes.

Property Value
Type Description
IReadOnlyListstring
Remarks

GrpcClient

public virtual AlertPolicyService.AlertPolicyServiceClient GrpcClient { get; }

The underlying gRPC AlertPolicyService client

Property Value
Type Description
AlertPolicyServiceAlertPolicyServiceClient

ServiceMetadata

public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

Property Value
Type Description
ServiceMetadata

Methods

Create()

public static AlertPolicyServiceClient Create()

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

Returns
Type Description
AlertPolicyServiceClient

The created AlertPolicyServiceClient.

CreateAlertPolicy(IResourceName, AlertPolicy, CallSettings)

public virtual AlertPolicy CreateAlertPolicy(IResourceName name, AlertPolicy alertPolicy, CallSettings callSettings = null)

Creates a new alerting policy.

Design your application to single-thread API calls that modify the state of alerting policies in a single project. This includes calls to CreateAlertPolicy, DeleteAlertPolicy and UpdateAlertPolicy.

Parameters
Name Description
name IResourceName

Required. The project in which to create the alerting policy. The format is:

projects/[PROJECT_ID_OR_NUMBER]

Note that this field names the parent container in which the alerting policy will be written, not the name of the created policy. |name| must be a host project of a Metrics Scope, otherwise INVALID_ARGUMENT error will return. The alerting policy that is returned will have a name that contains a normalized representation of this name as a prefix but adds a suffix of the form /alertPolicies/[ALERT_POLICY_ID], identifying the policy in the container.

alertPolicy AlertPolicy

Required. The requested alerting policy. You should omit the name field in this policy. The name will be returned in the new policy, including a new [ALERT_POLICY_ID] value.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
AlertPolicy

The RPC response.

Example
// Create client
AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.Create();
// Initialize request argument(s)
IResourceName name = new UnparsedResourceName("a/wildcard/resource");
AlertPolicy alertPolicy = new AlertPolicy();
// Make the request
AlertPolicy response = alertPolicyServiceClient.CreateAlertPolicy(name, alertPolicy);

CreateAlertPolicy(FolderName, AlertPolicy, CallSettings)

public virtual AlertPolicy CreateAlertPolicy(FolderName name, AlertPolicy alertPolicy, CallSettings callSettings = null)

Creates a new alerting policy.

Design your application to single-thread API calls that modify the state of alerting policies in a single project. This includes calls to CreateAlertPolicy, DeleteAlertPolicy and UpdateAlertPolicy.

Parameters
Name Description
name FolderName

Required. The project in which to create the alerting policy. The format is:

projects/[PROJECT_ID_OR_NUMBER]

Note that this field names the parent container in which the alerting policy will be written, not the name of the created policy. |name| must be a host project of a Metrics Scope, otherwise INVALID_ARGUMENT error will return. The alerting policy that is returned will have a name that contains a normalized representation of this name as a prefix but adds a suffix of the form /alertPolicies/[ALERT_POLICY_ID], identifying the policy in the container.

alertPolicy AlertPolicy

Required. The requested alerting policy. You should omit the name field in this policy. The name will be returned in the new policy, including a new [ALERT_POLICY_ID] value.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
AlertPolicy

The RPC response.

Example
// Create client
AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.Create();
// Initialize request argument(s)
FolderName name = FolderName.FromFolder("[FOLDER]");
AlertPolicy alertPolicy = new AlertPolicy();
// Make the request
AlertPolicy response = alertPolicyServiceClient.CreateAlertPolicy(name, alertPolicy);

CreateAlertPolicy(OrganizationName, AlertPolicy, CallSettings)

public virtual AlertPolicy CreateAlertPolicy(OrganizationName name, AlertPolicy alertPolicy, CallSettings callSettings = null)

Creates a new alerting policy.

Design your application to single-thread API calls that modify the state of alerting policies in a single project. This includes calls to CreateAlertPolicy, DeleteAlertPolicy and UpdateAlertPolicy.

Parameters
Name Description
name OrganizationName

Required. The project in which to create the alerting policy. The format is:

projects/[PROJECT_ID_OR_NUMBER]

Note that this field names the parent container in which the alerting policy will be written, not the name of the created policy. |name| must be a host project of a Metrics Scope, otherwise INVALID_ARGUMENT error will return. The alerting policy that is returned will have a name that contains a normalized representation of this name as a prefix but adds a suffix of the form /alertPolicies/[ALERT_POLICY_ID], identifying the policy in the container.

alertPolicy AlertPolicy

Required. The requested alerting policy. You should omit the name field in this policy. The name will be returned in the new policy, including a new [ALERT_POLICY_ID] value.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
AlertPolicy

The RPC response.

Example
// Create client
AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.Create();
// Initialize request argument(s)
OrganizationName name = OrganizationName.FromOrganization("[ORGANIZATION]");
AlertPolicy alertPolicy = new AlertPolicy();
// Make the request
AlertPolicy response = alertPolicyServiceClient.CreateAlertPolicy(name, alertPolicy);

CreateAlertPolicy(ProjectName, AlertPolicy, CallSettings)

public virtual AlertPolicy CreateAlertPolicy(ProjectName name, AlertPolicy alertPolicy, CallSettings callSettings = null)

Creates a new alerting policy.

Design your application to single-thread API calls that modify the state of alerting policies in a single project. This includes calls to CreateAlertPolicy, DeleteAlertPolicy and UpdateAlertPolicy.

Parameters
Name Description
name ProjectName

Required. The project in which to create the alerting policy. The format is:

projects/[PROJECT_ID_OR_NUMBER]

Note that this field names the parent container in which the alerting policy will be written, not the name of the created policy. |name| must be a host project of a Metrics Scope, otherwise INVALID_ARGUMENT error will return. The alerting policy that is returned will have a name that contains a normalized representation of this name as a prefix but adds a suffix of the form /alertPolicies/[ALERT_POLICY_ID], identifying the policy in the container.

alertPolicy AlertPolicy

Required. The requested alerting policy. You should omit the name field in this policy. The name will be returned in the new policy, including a new [ALERT_POLICY_ID] value.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
AlertPolicy

The RPC response.

Example
// Create client
AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.Create();
// Initialize request argument(s)
ProjectName name = ProjectName.FromProject("[PROJECT]");
AlertPolicy alertPolicy = new AlertPolicy();
// Make the request
AlertPolicy response = alertPolicyServiceClient.CreateAlertPolicy(name, alertPolicy);

CreateAlertPolicy(CreateAlertPolicyRequest, CallSettings)

public virtual AlertPolicy CreateAlertPolicy(CreateAlertPolicyRequest request, CallSettings callSettings = null)

Creates a new alerting policy.

Design your application to single-thread API calls that modify the state of alerting policies in a single project. This includes calls to CreateAlertPolicy, DeleteAlertPolicy and UpdateAlertPolicy.

Parameters
Name Description
request CreateAlertPolicyRequest

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
AlertPolicy

The RPC response.

Example
// Create client
AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.Create();
// Initialize request argument(s)
CreateAlertPolicyRequest request = new CreateAlertPolicyRequest
{
    AlertPolicy = new AlertPolicy(),
    ProjectName = ProjectName.FromProject("[PROJECT]"),
};
// Make the request
AlertPolicy response = alertPolicyServiceClient.CreateAlertPolicy(request);

CreateAlertPolicy(string, AlertPolicy, CallSettings)

public virtual AlertPolicy CreateAlertPolicy(string name, AlertPolicy alertPolicy, CallSettings callSettings = null)

Creates a new alerting policy.

Design your application to single-thread API calls that modify the state of alerting policies in a single project. This includes calls to CreateAlertPolicy, DeleteAlertPolicy and UpdateAlertPolicy.

Parameters
Name Description
name string

Required. The project in which to create the alerting policy. The format is:

projects/[PROJECT_ID_OR_NUMBER]

Note that this field names the parent container in which the alerting policy will be written, not the name of the created policy. |name| must be a host project of a Metrics Scope, otherwise INVALID_ARGUMENT error will return. The alerting policy that is returned will have a name that contains a normalized representation of this name as a prefix but adds a suffix of the form /alertPolicies/[ALERT_POLICY_ID], identifying the policy in the container.

alertPolicy AlertPolicy

Required. The requested alerting policy. You should omit the name field in this policy. The name will be returned in the new policy, including a new [ALERT_POLICY_ID] value.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
AlertPolicy

The RPC response.

Example
// Create client
AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]";
AlertPolicy alertPolicy = new AlertPolicy();
// Make the request
AlertPolicy response = alertPolicyServiceClient.CreateAlertPolicy(name, alertPolicy);

CreateAlertPolicyAsync(IResourceName, AlertPolicy, CallSettings)

public virtual Task<AlertPolicy> CreateAlertPolicyAsync(IResourceName name, AlertPolicy alertPolicy, CallSettings callSettings = null)

Creates a new alerting policy.

Design your application to single-thread API calls that modify the state of alerting policies in a single project. This includes calls to CreateAlertPolicy, DeleteAlertPolicy and UpdateAlertPolicy.

Parameters
Name Description
name IResourceName

Required. The project in which to create the alerting policy. The format is:

projects/[PROJECT_ID_OR_NUMBER]

Note that this field names the parent container in which the alerting policy will be written, not the name of the created policy. |name| must be a host project of a Metrics Scope, otherwise INVALID_ARGUMENT error will return. The alerting policy that is returned will have a name that contains a normalized representation of this name as a prefix but adds a suffix of the form /alertPolicies/[ALERT_POLICY_ID], identifying the policy in the container.

alertPolicy AlertPolicy

Required. The requested alerting policy. You should omit the name field in this policy. The name will be returned in the new policy, including a new [ALERT_POLICY_ID] value.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskAlertPolicy

A Task containing the RPC response.

Example
// Create client
AlertPolicyServiceClient alertPolicyServiceClient = await AlertPolicyServiceClient.CreateAsync();
// Initialize request argument(s)
IResourceName name = new UnparsedResourceName("a/wildcard/resource");
AlertPolicy alertPolicy = new AlertPolicy();
// Make the request
AlertPolicy response = await alertPolicyServiceClient.CreateAlertPolicyAsync(name, alertPolicy);

CreateAlertPolicyAsync(IResourceName, AlertPolicy, CancellationToken)

public virtual Task<AlertPolicy> CreateAlertPolicyAsync(IResourceName name, AlertPolicy alertPolicy, CancellationToken cancellationToken)

Creates a new alerting policy.

Design your application to single-thread API calls that modify the state of alerting policies in a single project. This includes calls to CreateAlertPolicy, DeleteAlertPolicy and UpdateAlertPolicy.

Parameters
Name Description
name IResourceName

Required. The project in which to create the alerting policy. The format is:

projects/[PROJECT_ID_OR_NUMBER]

Note that this field names the parent container in which the alerting policy will be written, not the name of the created policy. |name| must be a host project of a Metrics Scope, otherwise INVALID_ARGUMENT error will return. The alerting policy that is returned will have a name that contains a normalized representation of this name as a prefix but adds a suffix of the form /alertPolicies/[ALERT_POLICY_ID], identifying the policy in the container.

alertPolicy AlertPolicy

Required. The requested alerting policy. You should omit the name field in this policy. The name will be returned in the new policy, including a new [ALERT_POLICY_ID] value.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskAlertPolicy

A Task containing the RPC response.

Example
// Create client
AlertPolicyServiceClient alertPolicyServiceClient = await AlertPolicyServiceClient.CreateAsync();
// Initialize request argument(s)
IResourceName name = new UnparsedResourceName("a/wildcard/resource");
AlertPolicy alertPolicy = new AlertPolicy();
// Make the request
AlertPolicy response = await alertPolicyServiceClient.CreateAlertPolicyAsync(name, alertPolicy);

CreateAlertPolicyAsync(FolderName, AlertPolicy, CallSettings)

public virtual Task<AlertPolicy> CreateAlertPolicyAsync(FolderName name, AlertPolicy alertPolicy, CallSettings callSettings = null)

Creates a new alerting policy.

Design your application to single-thread API calls that modify the state of alerting policies in a single project. This includes calls to CreateAlertPolicy, DeleteAlertPolicy and UpdateAlertPolicy.

Parameters
Name Description
name FolderName

Required. The project in which to create the alerting policy. The format is:

projects/[PROJECT_ID_OR_NUMBER]

Note that this field names the parent container in which the alerting policy will be written, not the name of the created policy. |name| must be a host project of a Metrics Scope, otherwise INVALID_ARGUMENT error will return. The alerting policy that is returned will have a name that contains a normalized representation of this name as a prefix but adds a suffix of the form /alertPolicies/[ALERT_POLICY_ID], identifying the policy in the container.

alertPolicy AlertPolicy

Required. The requested alerting policy. You should omit the name field in this policy. The name will be returned in the new policy, including a new [ALERT_POLICY_ID] value.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskAlertPolicy

A Task containing the RPC response.

Example
// Create client
AlertPolicyServiceClient alertPolicyServiceClient = await AlertPolicyServiceClient.CreateAsync();
// Initialize request argument(s)
FolderName name = FolderName.FromFolder("[FOLDER]");
AlertPolicy alertPolicy = new AlertPolicy();
// Make the request
AlertPolicy response = await alertPolicyServiceClient.CreateAlertPolicyAsync(name, alertPolicy);

CreateAlertPolicyAsync(FolderName, AlertPolicy, CancellationToken)

public virtual Task<AlertPolicy> CreateAlertPolicyAsync(FolderName name, AlertPolicy alertPolicy, CancellationToken cancellationToken)

Creates a new alerting policy.

Design your application to single-thread API calls that modify the state of alerting policies in a single project. This includes calls to CreateAlertPolicy, DeleteAlertPolicy and UpdateAlertPolicy.

Parameters
Name Description
name FolderName

Required. The project in which to create the alerting policy. The format is:

projects/[PROJECT_ID_OR_NUMBER]

Note that this field names the parent container in which the alerting policy will be written, not the name of the created policy. |name| must be a host project of a Metrics Scope, otherwise INVALID_ARGUMENT error will return. The alerting policy that is returned will have a name that contains a normalized representation of this name as a prefix but adds a suffix of the form /alertPolicies/[ALERT_POLICY_ID], identifying the policy in the container.

alertPolicy AlertPolicy

Required. The requested alerting policy. You should omit the name field in this policy. The name will be returned in the new policy, including a new [ALERT_POLICY_ID] value.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskAlertPolicy

A Task containing the RPC response.

Example
// Create client
AlertPolicyServiceClient alertPolicyServiceClient = await AlertPolicyServiceClient.CreateAsync();
// Initialize request argument(s)
FolderName name = FolderName.FromFolder("[FOLDER]");
AlertPolicy alertPolicy = new AlertPolicy();
// Make the request
AlertPolicy response = await alertPolicyServiceClient.CreateAlertPolicyAsync(name, alertPolicy);

CreateAlertPolicyAsync(OrganizationName, AlertPolicy, CallSettings)

public virtual Task<AlertPolicy> CreateAlertPolicyAsync(OrganizationName name, AlertPolicy alertPolicy, CallSettings callSettings = null)

Creates a new alerting policy.

Design your application to single-thread API calls that modify the state of alerting policies in a single project. This includes calls to CreateAlertPolicy, DeleteAlertPolicy and UpdateAlertPolicy.

Parameters
Name Description
name OrganizationName

Required. The project in which to create the alerting policy. The format is:

projects/[PROJECT_ID_OR_NUMBER]

Note that this field names the parent container in which the alerting policy will be written, not the name of the created policy. |name| must be a host project of a Metrics Scope, otherwise INVALID_ARGUMENT error will return. The alerting policy that is returned will have a name that contains a normalized representation of this name as a prefix but adds a suffix of the form /alertPolicies/[ALERT_POLICY_ID], identifying the policy in the container.

alertPolicy AlertPolicy

Required. The requested alerting policy. You should omit the name field in this policy. The name will be returned in the new policy, including a new [ALERT_POLICY_ID] value.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskAlertPolicy

A Task containing the RPC response.

Example
// Create client
AlertPolicyServiceClient alertPolicyServiceClient = await AlertPolicyServiceClient.CreateAsync();
// Initialize request argument(s)
OrganizationName name = OrganizationName.FromOrganization("[ORGANIZATION]");
AlertPolicy alertPolicy = new AlertPolicy();
// Make the request
AlertPolicy response = await alertPolicyServiceClient.CreateAlertPolicyAsync(name, alertPolicy);

CreateAlertPolicyAsync(OrganizationName, AlertPolicy, CancellationToken)

public virtual Task<AlertPolicy> CreateAlertPolicyAsync(OrganizationName name, AlertPolicy alertPolicy, CancellationToken cancellationToken)

Creates a new alerting policy.

Design your application to single-thread API calls that modify the state of alerting policies in a single project. This includes calls to CreateAlertPolicy, DeleteAlertPolicy and UpdateAlertPolicy.

Parameters
Name Description
name OrganizationName

Required. The project in which to create the alerting policy. The format is:

projects/[PROJECT_ID_OR_NUMBER]

Note that this field names the parent container in which the alerting policy will be written, not the name of the created policy. |name| must be a host project of a Metrics Scope, otherwise INVALID_ARGUMENT error will return. The alerting policy that is returned will have a name that contains a normalized representation of this name as a prefix but adds a suffix of the form /alertPolicies/[ALERT_POLICY_ID], identifying the policy in the container.

alertPolicy AlertPolicy

Required. The requested alerting policy. You should omit the name field in this policy. The name will be returned in the new policy, including a new [ALERT_POLICY_ID] value.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskAlertPolicy

A Task containing the RPC response.

Example
// Create client
AlertPolicyServiceClient alertPolicyServiceClient = await AlertPolicyServiceClient.CreateAsync();
// Initialize request argument(s)
OrganizationName name = OrganizationName.FromOrganization("[ORGANIZATION]");
AlertPolicy alertPolicy = new AlertPolicy();
// Make the request
AlertPolicy response = await alertPolicyServiceClient.CreateAlertPolicyAsync(name, alertPolicy);

CreateAlertPolicyAsync(ProjectName, AlertPolicy, CallSettings)

public virtual Task<AlertPolicy> CreateAlertPolicyAsync(ProjectName name, AlertPolicy alertPolicy, CallSettings callSettings = null)

Creates a new alerting policy.

Design your application to single-thread API calls that modify the state of alerting policies in a single project. This includes calls to CreateAlertPolicy, DeleteAlertPolicy and UpdateAlertPolicy.

Parameters
Name Description
name ProjectName

Required. The project in which to create the alerting policy. The format is:

projects/[PROJECT_ID_OR_NUMBER]

Note that this field names the parent container in which the alerting policy will be written, not the name of the created policy. |name| must be a host project of a Metrics Scope, otherwise INVALID_ARGUMENT error will return. The alerting policy that is returned will have a name that contains a normalized representation of this name as a prefix but adds a suffix of the form /alertPolicies/[ALERT_POLICY_ID], identifying the policy in the container.

alertPolicy AlertPolicy

Required. The requested alerting policy. You should omit the name field in this policy. The name will be returned in the new policy, including a new [ALERT_POLICY_ID] value.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskAlertPolicy

A Task containing the RPC response.

Example
// Create client
AlertPolicyServiceClient alertPolicyServiceClient = await AlertPolicyServiceClient.CreateAsync();
// Initialize request argument(s)
ProjectName name = ProjectName.FromProject("[PROJECT]");
AlertPolicy alertPolicy = new AlertPolicy();
// Make the request
AlertPolicy response = await alertPolicyServiceClient.CreateAlertPolicyAsync(name, alertPolicy);

CreateAlertPolicyAsync(ProjectName, AlertPolicy, CancellationToken)

public virtual Task<AlertPolicy> CreateAlertPolicyAsync(ProjectName name, AlertPolicy alertPolicy, CancellationToken cancellationToken)

Creates a new alerting policy.

Design your application to single-thread API calls that modify the state of alerting policies in a single project. This includes calls to CreateAlertPolicy, DeleteAlertPolicy and UpdateAlertPolicy.

Parameters
Name Description
name ProjectName

Required. The project in which to create the alerting policy. The format is:

projects/[PROJECT_ID_OR_NUMBER]

Note that this field names the parent container in which the alerting policy will be written, not the name of the created policy. |name| must be a host project of a Metrics Scope, otherwise INVALID_ARGUMENT error will return. The alerting policy that is returned will have a name that contains a normalized representation of this name as a prefix but adds a suffix of the form /alertPolicies/[ALERT_POLICY_ID], identifying the policy in the container.

alertPolicy AlertPolicy

Required. The requested alerting policy. You should omit the name field in this policy. The name will be returned in the new policy, including a new [ALERT_POLICY_ID] value.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskAlertPolicy

A Task containing the RPC response.

Example
// Create client
AlertPolicyServiceClient alertPolicyServiceClient = await AlertPolicyServiceClient.CreateAsync();
// Initialize request argument(s)
ProjectName name = ProjectName.FromProject("[PROJECT]");
AlertPolicy alertPolicy = new AlertPolicy();
// Make the request
AlertPolicy response = await alertPolicyServiceClient.CreateAlertPolicyAsync(name, alertPolicy);

CreateAlertPolicyAsync(CreateAlertPolicyRequest, CallSettings)

public virtual Task<AlertPolicy> CreateAlertPolicyAsync(CreateAlertPolicyRequest request, CallSettings callSettings = null)

Creates a new alerting policy.

Design your application to single-thread API calls that modify the state of alerting policies in a single project. This includes calls to CreateAlertPolicy, DeleteAlertPolicy and UpdateAlertPolicy.

Parameters
Name Description
request CreateAlertPolicyRequest

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
TaskAlertPolicy

A Task containing the RPC response.

Example
// Create client
AlertPolicyServiceClient alertPolicyServiceClient = await AlertPolicyServiceClient.CreateAsync();
// Initialize request argument(s)
CreateAlertPolicyRequest request = new CreateAlertPolicyRequest
{
    AlertPolicy = new AlertPolicy(),
    ProjectName = ProjectName.FromProject("[PROJECT]"),
};
// Make the request
AlertPolicy response = await alertPolicyServiceClient.CreateAlertPolicyAsync(request);

CreateAlertPolicyAsync(CreateAlertPolicyRequest, CancellationToken)

public virtual Task<AlertPolicy> CreateAlertPolicyAsync(CreateAlertPolicyRequest request, CancellationToken cancellationToken)

Creates a new alerting policy.

Design your application to single-thread API calls that modify the state of alerting policies in a single project. This includes calls to CreateAlertPolicy, DeleteAlertPolicy and UpdateAlertPolicy.

Parameters
Name Description
request CreateAlertPolicyRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskAlertPolicy

A Task containing the RPC response.

Example
// Create client
AlertPolicyServiceClient alertPolicyServiceClient = await AlertPolicyServiceClient.CreateAsync();
// Initialize request argument(s)
CreateAlertPolicyRequest request = new CreateAlertPolicyRequest
{
    AlertPolicy = new AlertPolicy(),
    ProjectName = ProjectName.FromProject("[PROJECT]"),
};
// Make the request
AlertPolicy response = await alertPolicyServiceClient.CreateAlertPolicyAsync(request);

CreateAlertPolicyAsync(string, AlertPolicy, CallSettings)

public virtual Task<AlertPolicy> CreateAlertPolicyAsync(string name, AlertPolicy alertPolicy, CallSettings callSettings = null)

Creates a new alerting policy.

Design your application to single-thread API calls that modify the state of alerting policies in a single project. This includes calls to CreateAlertPolicy, DeleteAlertPolicy and UpdateAlertPolicy.

Parameters
Name Description
name string

Required. The project in which to create the alerting policy. The format is:

projects/[PROJECT_ID_OR_NUMBER]

Note that this field names the parent container in which the alerting policy will be written, not the name of the created policy. |name| must be a host project of a Metrics Scope, otherwise INVALID_ARGUMENT error will return. The alerting policy that is returned will have a name that contains a normalized representation of this name as a prefix but adds a suffix of the form /alertPolicies/[ALERT_POLICY_ID], identifying the policy in the container.

alertPolicy AlertPolicy

Required. The requested alerting policy. You should omit the name field in this policy. The name will be returned in the new policy, including a new [ALERT_POLICY_ID] value.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskAlertPolicy

A Task containing the RPC response.

Example
// Create client
AlertPolicyServiceClient alertPolicyServiceClient = await AlertPolicyServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]";
AlertPolicy alertPolicy = new AlertPolicy();
// Make the request
AlertPolicy response = await alertPolicyServiceClient.CreateAlertPolicyAsync(name, alertPolicy);

CreateAlertPolicyAsync(string, AlertPolicy, CancellationToken)

public virtual Task<AlertPolicy> CreateAlertPolicyAsync(string name, AlertPolicy alertPolicy, CancellationToken cancellationToken)

Creates a new alerting policy.

Design your application to single-thread API calls that modify the state of alerting policies in a single project. This includes calls to CreateAlertPolicy, DeleteAlertPolicy and UpdateAlertPolicy.

Parameters
Name Description
name string

Required. The project in which to create the alerting policy. The format is:

projects/[PROJECT_ID_OR_NUMBER]

Note that this field names the parent container in which the alerting policy will be written, not the name of the created policy. |name| must be a host project of a Metrics Scope, otherwise INVALID_ARGUMENT error will return. The alerting policy that is returned will have a name that contains a normalized representation of this name as a prefix but adds a suffix of the form /alertPolicies/[ALERT_POLICY_ID], identifying the policy in the container.

alertPolicy AlertPolicy

Required. The requested alerting policy. You should omit the name field in this policy. The name will be returned in the new policy, including a new [ALERT_POLICY_ID] value.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskAlertPolicy

A Task containing the RPC response.

Example
// Create client
AlertPolicyServiceClient alertPolicyServiceClient = await AlertPolicyServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]";
AlertPolicy alertPolicy = new AlertPolicy();
// Make the request
AlertPolicy response = await alertPolicyServiceClient.CreateAlertPolicyAsync(name, alertPolicy);

CreateAsync(CancellationToken)

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

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

Parameter
Name Description
cancellationToken CancellationToken

The CancellationToken to use while creating the client.

Returns
Type Description
TaskAlertPolicyServiceClient

The task representing the created AlertPolicyServiceClient.

DeleteAlertPolicy(IResourceName, CallSettings)

public virtual void DeleteAlertPolicy(IResourceName name, CallSettings callSettings = null)

Deletes an alerting policy.

Design your application to single-thread API calls that modify the state of alerting policies in a single project. This includes calls to CreateAlertPolicy, DeleteAlertPolicy and UpdateAlertPolicy.

Parameters
Name Description
name IResourceName

Required. The alerting policy to delete. The format is:

projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID]

For more information, see [AlertPolicy][google.monitoring.v3.AlertPolicy].

callSettings CallSettings

If not null, applies overrides to this RPC call.

Example
// Create client
AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.Create();
// Initialize request argument(s)
IResourceName name = new UnparsedResourceName("a/wildcard/resource");
// Make the request
alertPolicyServiceClient.DeleteAlertPolicy(name);

DeleteAlertPolicy(AlertPolicyName, CallSettings)

public virtual void DeleteAlertPolicy(AlertPolicyName name, CallSettings callSettings = null)

Deletes an alerting policy.

Design your application to single-thread API calls that modify the state of alerting policies in a single project. This includes calls to CreateAlertPolicy, DeleteAlertPolicy and UpdateAlertPolicy.

Parameters
Name Description
name AlertPolicyName

Required. The alerting policy to delete. The format is:

projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID]

For more information, see [AlertPolicy][google.monitoring.v3.AlertPolicy].

callSettings CallSettings

If not null, applies overrides to this RPC call.

Example
// Create client
AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.Create();
// Initialize request argument(s)
AlertPolicyName name = AlertPolicyName.FromProjectAlertPolicy("[PROJECT]", "[ALERT_POLICY]");
// Make the request
alertPolicyServiceClient.DeleteAlertPolicy(name);

DeleteAlertPolicy(DeleteAlertPolicyRequest, CallSettings)

public virtual void DeleteAlertPolicy(DeleteAlertPolicyRequest request, CallSettings callSettings = null)

Deletes an alerting policy.

Design your application to single-thread API calls that modify the state of alerting policies in a single project. This includes calls to CreateAlertPolicy, DeleteAlertPolicy and UpdateAlertPolicy.

Parameters
Name Description
request DeleteAlertPolicyRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Example
// Create client
AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.Create();
// Initialize request argument(s)
DeleteAlertPolicyRequest request = new DeleteAlertPolicyRequest
{
    AlertPolicyName = AlertPolicyName.FromProjectAlertPolicy("[PROJECT]", "[ALERT_POLICY]"),
};
// Make the request
alertPolicyServiceClient.DeleteAlertPolicy(request);

DeleteAlertPolicy(string, CallSettings)

public virtual void DeleteAlertPolicy(string name, CallSettings callSettings = null)

Deletes an alerting policy.

Design your application to single-thread API calls that modify the state of alerting policies in a single project. This includes calls to CreateAlertPolicy, DeleteAlertPolicy and UpdateAlertPolicy.

Parameters
Name Description
name string

Required. The alerting policy to delete. The format is:

projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID]

For more information, see [AlertPolicy][google.monitoring.v3.AlertPolicy].

callSettings CallSettings

If not null, applies overrides to this RPC call.

Example
// Create client
AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/alertPolicies/[ALERT_POLICY]";
// Make the request
alertPolicyServiceClient.DeleteAlertPolicy(name);

DeleteAlertPolicyAsync(IResourceName, CallSettings)

public virtual Task DeleteAlertPolicyAsync(IResourceName name, CallSettings callSettings = null)

Deletes an alerting policy.

Design your application to single-thread API calls that modify the state of alerting policies in a single project. This includes calls to CreateAlertPolicy, DeleteAlertPolicy and UpdateAlertPolicy.

Parameters
Name Description
name IResourceName

Required. The alerting policy to delete. The format is:

projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID]

For more information, see [AlertPolicy][google.monitoring.v3.AlertPolicy].

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
AlertPolicyServiceClient alertPolicyServiceClient = await AlertPolicyServiceClient.CreateAsync();
// Initialize request argument(s)
IResourceName name = new UnparsedResourceName("a/wildcard/resource");
// Make the request
await alertPolicyServiceClient.DeleteAlertPolicyAsync(name);

DeleteAlertPolicyAsync(IResourceName, CancellationToken)

public virtual Task DeleteAlertPolicyAsync(IResourceName name, CancellationToken cancellationToken)

Deletes an alerting policy.

Design your application to single-thread API calls that modify the state of alerting policies in a single project. This includes calls to CreateAlertPolicy, DeleteAlertPolicy and UpdateAlertPolicy.

Parameters
Name Description
name IResourceName

Required. The alerting policy to delete. The format is:

projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID]

For more information, see [AlertPolicy][google.monitoring.v3.AlertPolicy].

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
AlertPolicyServiceClient alertPolicyServiceClient = await AlertPolicyServiceClient.CreateAsync();
// Initialize request argument(s)
IResourceName name = new UnparsedResourceName("a/wildcard/resource");
// Make the request
await alertPolicyServiceClient.DeleteAlertPolicyAsync(name);

DeleteAlertPolicyAsync(AlertPolicyName, CallSettings)

public virtual Task DeleteAlertPolicyAsync(AlertPolicyName name, CallSettings callSettings = null)

Deletes an alerting policy.

Design your application to single-thread API calls that modify the state of alerting policies in a single project. This includes calls to CreateAlertPolicy, DeleteAlertPolicy and UpdateAlertPolicy.

Parameters
Name Description
name AlertPolicyName

Required. The alerting policy to delete. The format is:

projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID]

For more information, see [AlertPolicy][google.monitoring.v3.AlertPolicy].

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
AlertPolicyServiceClient alertPolicyServiceClient = await AlertPolicyServiceClient.CreateAsync();
// Initialize request argument(s)
AlertPolicyName name = AlertPolicyName.FromProjectAlertPolicy("[PROJECT]", "[ALERT_POLICY]");
// Make the request
await alertPolicyServiceClient.DeleteAlertPolicyAsync(name);

DeleteAlertPolicyAsync(AlertPolicyName, CancellationToken)

public virtual Task DeleteAlertPolicyAsync(AlertPolicyName name, CancellationToken cancellationToken)

Deletes an alerting policy.

Design your application to single-thread API calls that modify the state of alerting policies in a single project. This includes calls to CreateAlertPolicy, DeleteAlertPolicy and UpdateAlertPolicy.

Parameters
Name Description
name AlertPolicyName

Required. The alerting policy to delete. The format is:

projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID]

For more information, see [AlertPolicy][google.monitoring.v3.AlertPolicy].

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
AlertPolicyServiceClient alertPolicyServiceClient = await AlertPolicyServiceClient.CreateAsync();
// Initialize request argument(s)
AlertPolicyName name = AlertPolicyName.FromProjectAlertPolicy("[PROJECT]", "[ALERT_POLICY]");
// Make the request
await alertPolicyServiceClient.DeleteAlertPolicyAsync(name);

DeleteAlertPolicyAsync(DeleteAlertPolicyRequest, CallSettings)

public virtual Task DeleteAlertPolicyAsync(DeleteAlertPolicyRequest request, CallSettings callSettings = null)

Deletes an alerting policy.

Design your application to single-thread API calls that modify the state of alerting policies in a single project. This includes calls to CreateAlertPolicy, DeleteAlertPolicy and UpdateAlertPolicy.

Parameters
Name Description
request DeleteAlertPolicyRequest

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
Task

A Task containing the RPC response.

Example
// Create client
AlertPolicyServiceClient alertPolicyServiceClient = await AlertPolicyServiceClient.CreateAsync();
// Initialize request argument(s)
DeleteAlertPolicyRequest request = new DeleteAlertPolicyRequest
{
    AlertPolicyName = AlertPolicyName.FromProjectAlertPolicy("[PROJECT]", "[ALERT_POLICY]"),
};
// Make the request
await alertPolicyServiceClient.DeleteAlertPolicyAsync(request);

DeleteAlertPolicyAsync(DeleteAlertPolicyRequest, CancellationToken)

public virtual Task DeleteAlertPolicyAsync(DeleteAlertPolicyRequest request, CancellationToken cancellationToken)

Deletes an alerting policy.

Design your application to single-thread API calls that modify the state of alerting policies in a single project. This includes calls to CreateAlertPolicy, DeleteAlertPolicy and UpdateAlertPolicy.

Parameters
Name Description
request DeleteAlertPolicyRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
AlertPolicyServiceClient alertPolicyServiceClient = await AlertPolicyServiceClient.CreateAsync();
// Initialize request argument(s)
DeleteAlertPolicyRequest request = new DeleteAlertPolicyRequest
{
    AlertPolicyName = AlertPolicyName.FromProjectAlertPolicy("[PROJECT]", "[ALERT_POLICY]"),
};
// Make the request
await alertPolicyServiceClient.DeleteAlertPolicyAsync(request);

DeleteAlertPolicyAsync(string, CallSettings)

public virtual Task DeleteAlertPolicyAsync(string name, CallSettings callSettings = null)

Deletes an alerting policy.

Design your application to single-thread API calls that modify the state of alerting policies in a single project. This includes calls to CreateAlertPolicy, DeleteAlertPolicy and UpdateAlertPolicy.

Parameters
Name Description
name string

Required. The alerting policy to delete. The format is:

projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID]

For more information, see [AlertPolicy][google.monitoring.v3.AlertPolicy].

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
AlertPolicyServiceClient alertPolicyServiceClient = await AlertPolicyServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/alertPolicies/[ALERT_POLICY]";
// Make the request
await alertPolicyServiceClient.DeleteAlertPolicyAsync(name);

DeleteAlertPolicyAsync(string, CancellationToken)

public virtual Task DeleteAlertPolicyAsync(string name, CancellationToken cancellationToken)

Deletes an alerting policy.

Design your application to single-thread API calls that modify the state of alerting policies in a single project. This includes calls to CreateAlertPolicy, DeleteAlertPolicy and UpdateAlertPolicy.

Parameters
Name Description
name string

Required. The alerting policy to delete. The format is:

projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID]

For more information, see [AlertPolicy][google.monitoring.v3.AlertPolicy].

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
AlertPolicyServiceClient alertPolicyServiceClient = await AlertPolicyServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/alertPolicies/[ALERT_POLICY]";
// Make the request
await alertPolicyServiceClient.DeleteAlertPolicyAsync(name);

GetAlertPolicy(IResourceName, CallSettings)

public virtual AlertPolicy GetAlertPolicy(IResourceName name, CallSettings callSettings = null)

Gets a single alerting policy.

Parameters
Name Description
name IResourceName

Required. The alerting policy to retrieve. The format is:

projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID]

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
AlertPolicy

The RPC response.

Example
// Create client
AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.Create();
// Initialize request argument(s)
IResourceName name = new UnparsedResourceName("a/wildcard/resource");
// Make the request
AlertPolicy response = alertPolicyServiceClient.GetAlertPolicy(name);

GetAlertPolicy(AlertPolicyName, CallSettings)

public virtual AlertPolicy GetAlertPolicy(AlertPolicyName name, CallSettings callSettings = null)

Gets a single alerting policy.

Parameters
Name Description
name AlertPolicyName

Required. The alerting policy to retrieve. The format is:

projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID]

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
AlertPolicy

The RPC response.

Example
// Create client
AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.Create();
// Initialize request argument(s)
AlertPolicyName name = AlertPolicyName.FromProjectAlertPolicy("[PROJECT]", "[ALERT_POLICY]");
// Make the request
AlertPolicy response = alertPolicyServiceClient.GetAlertPolicy(name);

GetAlertPolicy(GetAlertPolicyRequest, CallSettings)

public virtual AlertPolicy GetAlertPolicy(GetAlertPolicyRequest request, CallSettings callSettings = null)

Gets a single alerting policy.

Parameters
Name Description
request GetAlertPolicyRequest

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
AlertPolicy

The RPC response.

Example
// Create client
AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.Create();
// Initialize request argument(s)
GetAlertPolicyRequest request = new GetAlertPolicyRequest
{
    AlertPolicyName = AlertPolicyName.FromProjectAlertPolicy("[PROJECT]", "[ALERT_POLICY]"),
};
// Make the request
AlertPolicy response = alertPolicyServiceClient.GetAlertPolicy(request);

GetAlertPolicy(string, CallSettings)

public virtual AlertPolicy GetAlertPolicy(string name, CallSettings callSettings = null)

Gets a single alerting policy.

Parameters
Name Description
name string

Required. The alerting policy to retrieve. The format is:

projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID]

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
AlertPolicy

The RPC response.

Example
// Create client
AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/alertPolicies/[ALERT_POLICY]";
// Make the request
AlertPolicy response = alertPolicyServiceClient.GetAlertPolicy(name);

GetAlertPolicyAsync(IResourceName, CallSettings)

public virtual Task<AlertPolicy> GetAlertPolicyAsync(IResourceName name, CallSettings callSettings = null)

Gets a single alerting policy.

Parameters
Name Description
name IResourceName

Required. The alerting policy to retrieve. The format is:

projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID]

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskAlertPolicy

A Task containing the RPC response.

Example
// Create client
AlertPolicyServiceClient alertPolicyServiceClient = await AlertPolicyServiceClient.CreateAsync();
// Initialize request argument(s)
IResourceName name = new UnparsedResourceName("a/wildcard/resource");
// Make the request
AlertPolicy response = await alertPolicyServiceClient.GetAlertPolicyAsync(name);

GetAlertPolicyAsync(IResourceName, CancellationToken)

public virtual Task<AlertPolicy> GetAlertPolicyAsync(IResourceName name, CancellationToken cancellationToken)

Gets a single alerting policy.

Parameters
Name Description
name IResourceName

Required. The alerting policy to retrieve. The format is:

projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID]

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskAlertPolicy

A Task containing the RPC response.

Example
// Create client
AlertPolicyServiceClient alertPolicyServiceClient = await AlertPolicyServiceClient.CreateAsync();
// Initialize request argument(s)
IResourceName name = new UnparsedResourceName("a/wildcard/resource");
// Make the request
AlertPolicy response = await alertPolicyServiceClient.GetAlertPolicyAsync(name);

GetAlertPolicyAsync(AlertPolicyName, CallSettings)

public virtual Task<AlertPolicy> GetAlertPolicyAsync(AlertPolicyName name, CallSettings callSettings = null)

Gets a single alerting policy.

Parameters
Name Description
name AlertPolicyName

Required. The alerting policy to retrieve. The format is:

projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID]

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskAlertPolicy

A Task containing the RPC response.

Example
// Create client
AlertPolicyServiceClient alertPolicyServiceClient = await AlertPolicyServiceClient.CreateAsync();
// Initialize request argument(s)
AlertPolicyName name = AlertPolicyName.FromProjectAlertPolicy("[PROJECT]", "[ALERT_POLICY]");
// Make the request
AlertPolicy response = await alertPolicyServiceClient.GetAlertPolicyAsync(name);

GetAlertPolicyAsync(AlertPolicyName, CancellationToken)

public virtual Task<AlertPolicy> GetAlertPolicyAsync(AlertPolicyName name, CancellationToken cancellationToken)

Gets a single alerting policy.

Parameters
Name Description
name AlertPolicyName

Required. The alerting policy to retrieve. The format is:

projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID]

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskAlertPolicy

A Task containing the RPC response.

Example
// Create client
AlertPolicyServiceClient alertPolicyServiceClient = await AlertPolicyServiceClient.CreateAsync();
// Initialize request argument(s)
AlertPolicyName name = AlertPolicyName.FromProjectAlertPolicy("[PROJECT]", "[ALERT_POLICY]");
// Make the request
AlertPolicy response = await alertPolicyServiceClient.GetAlertPolicyAsync(name);

GetAlertPolicyAsync(GetAlertPolicyRequest, CallSettings)

public virtual Task<AlertPolicy> GetAlertPolicyAsync(GetAlertPolicyRequest request, CallSettings callSettings = null)

Gets a single alerting policy.

Parameters
Name Description
request GetAlertPolicyRequest

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
TaskAlertPolicy

A Task containing the RPC response.

Example
// Create client
AlertPolicyServiceClient alertPolicyServiceClient = await AlertPolicyServiceClient.CreateAsync();
// Initialize request argument(s)
GetAlertPolicyRequest request = new GetAlertPolicyRequest
{
    AlertPolicyName = AlertPolicyName.FromProjectAlertPolicy("[PROJECT]", "[ALERT_POLICY]"),
};
// Make the request
AlertPolicy response = await alertPolicyServiceClient.GetAlertPolicyAsync(request);

GetAlertPolicyAsync(GetAlertPolicyRequest, CancellationToken)

public virtual Task<AlertPolicy> GetAlertPolicyAsync(GetAlertPolicyRequest request, CancellationToken cancellationToken)

Gets a single alerting policy.

Parameters
Name Description
request GetAlertPolicyRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskAlertPolicy

A Task containing the RPC response.

Example
// Create client
AlertPolicyServiceClient alertPolicyServiceClient = await AlertPolicyServiceClient.CreateAsync();
// Initialize request argument(s)
GetAlertPolicyRequest request = new GetAlertPolicyRequest
{
    AlertPolicyName = AlertPolicyName.FromProjectAlertPolicy("[PROJECT]", "[ALERT_POLICY]"),
};
// Make the request
AlertPolicy response = await alertPolicyServiceClient.GetAlertPolicyAsync(request);

GetAlertPolicyAsync(string, CallSettings)

public virtual Task<AlertPolicy> GetAlertPolicyAsync(string name, CallSettings callSettings = null)

Gets a single alerting policy.

Parameters
Name Description
name string

Required. The alerting policy to retrieve. The format is:

projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID]

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskAlertPolicy

A Task containing the RPC response.

Example
// Create client
AlertPolicyServiceClient alertPolicyServiceClient = await AlertPolicyServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/alertPolicies/[ALERT_POLICY]";
// Make the request
AlertPolicy response = await alertPolicyServiceClient.GetAlertPolicyAsync(name);

GetAlertPolicyAsync(string, CancellationToken)

public virtual Task<AlertPolicy> GetAlertPolicyAsync(string name, CancellationToken cancellationToken)

Gets a single alerting policy.

Parameters
Name Description
name string

Required. The alerting policy to retrieve. The format is:

projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID]

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskAlertPolicy

A Task containing the RPC response.

Example
// Create client
AlertPolicyServiceClient alertPolicyServiceClient = await AlertPolicyServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/alertPolicies/[ALERT_POLICY]";
// Make the request
AlertPolicy response = await alertPolicyServiceClient.GetAlertPolicyAsync(name);

ListAlertPolicies(IResourceName, string, int?, CallSettings)

public virtual PagedEnumerable<ListAlertPoliciesResponse, AlertPolicy> ListAlertPolicies(IResourceName name, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists the existing alerting policies for the workspace.

Parameters
Name Description
name IResourceName

Required. The project whose alert policies are to be listed. The format is:

projects/[PROJECT_ID_OR_NUMBER]

Note that this field names the parent container in which the alerting policies to be listed are stored. To retrieve a single alerting policy by name, use the [GetAlertPolicy][google.monitoring.v3.AlertPolicyService.GetAlertPolicy] operation, instead.

pageToken string

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

pageSize int

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.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListAlertPoliciesResponseAlertPolicy

A pageable sequence of AlertPolicy resources.

Example
// Create client
AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.Create();
// Initialize request argument(s)
IResourceName name = new UnparsedResourceName("a/wildcard/resource");
// Make the request
PagedEnumerable<ListAlertPoliciesResponse, AlertPolicy> response = alertPolicyServiceClient.ListAlertPolicies(name);

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

ListAlertPolicies(FolderName, string, int?, CallSettings)

public virtual PagedEnumerable<ListAlertPoliciesResponse, AlertPolicy> ListAlertPolicies(FolderName name, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists the existing alerting policies for the workspace.

Parameters
Name Description
name FolderName

Required. The project whose alert policies are to be listed. The format is:

projects/[PROJECT_ID_OR_NUMBER]

Note that this field names the parent container in which the alerting policies to be listed are stored. To retrieve a single alerting policy by name, use the [GetAlertPolicy][google.monitoring.v3.AlertPolicyService.GetAlertPolicy] operation, instead.

pageToken string

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

pageSize int

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.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListAlertPoliciesResponseAlertPolicy

A pageable sequence of AlertPolicy resources.

Example
// Create client
AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.Create();
// Initialize request argument(s)
FolderName name = FolderName.FromFolder("[FOLDER]");
// Make the request
PagedEnumerable<ListAlertPoliciesResponse, AlertPolicy> response = alertPolicyServiceClient.ListAlertPolicies(name);

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

ListAlertPolicies(OrganizationName, string, int?, CallSettings)

public virtual PagedEnumerable<ListAlertPoliciesResponse, AlertPolicy> ListAlertPolicies(OrganizationName name, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists the existing alerting policies for the workspace.

Parameters
Name Description
name OrganizationName

Required. The project whose alert policies are to be listed. The format is:

projects/[PROJECT_ID_OR_NUMBER]

Note that this field names the parent container in which the alerting policies to be listed are stored. To retrieve a single alerting policy by name, use the [GetAlertPolicy][google.monitoring.v3.AlertPolicyService.GetAlertPolicy] operation, instead.

pageToken string

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

pageSize int

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.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListAlertPoliciesResponseAlertPolicy

A pageable sequence of AlertPolicy resources.

Example
// Create client
AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.Create();
// Initialize request argument(s)
OrganizationName name = OrganizationName.FromOrganization("[ORGANIZATION]");
// Make the request
PagedEnumerable<ListAlertPoliciesResponse, AlertPolicy> response = alertPolicyServiceClient.ListAlertPolicies(name);

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

ListAlertPolicies(ProjectName, string, int?, CallSettings)

public virtual PagedEnumerable<ListAlertPoliciesResponse, AlertPolicy> ListAlertPolicies(ProjectName name, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists the existing alerting policies for the workspace.

Parameters
Name Description
name ProjectName

Required. The project whose alert policies are to be listed. The format is:

projects/[PROJECT_ID_OR_NUMBER]

Note that this field names the parent container in which the alerting policies to be listed are stored. To retrieve a single alerting policy by name, use the [GetAlertPolicy][google.monitoring.v3.AlertPolicyService.GetAlertPolicy] operation, instead.

pageToken string

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

pageSize int

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.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListAlertPoliciesResponseAlertPolicy

A pageable sequence of AlertPolicy resources.

Example
// Create client
AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.Create();
// Initialize request argument(s)
ProjectName name = ProjectName.FromProject("[PROJECT]");
// Make the request
PagedEnumerable<ListAlertPoliciesResponse, AlertPolicy> response = alertPolicyServiceClient.ListAlertPolicies(name);

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

ListAlertPolicies(ListAlertPoliciesRequest, CallSettings)

public virtual PagedEnumerable<ListAlertPoliciesResponse, AlertPolicy> ListAlertPolicies(ListAlertPoliciesRequest request, CallSettings callSettings = null)

Lists the existing alerting policies for the workspace.

Parameters
Name Description
request ListAlertPoliciesRequest

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
PagedEnumerableListAlertPoliciesResponseAlertPolicy

A pageable sequence of AlertPolicy resources.

Example
// Create client
AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.Create();
// Initialize request argument(s)
ListAlertPoliciesRequest request = new ListAlertPoliciesRequest
{
    ProjectName = ProjectName.FromProject("[PROJECT]"),
    Filter = "",
    OrderBy = "",
};
// Make the request
PagedEnumerable<ListAlertPoliciesResponse, AlertPolicy> response = alertPolicyServiceClient.ListAlertPolicies(request);

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

ListAlertPolicies(string, string, int?, CallSettings)

public virtual PagedEnumerable<ListAlertPoliciesResponse, AlertPolicy> ListAlertPolicies(string name, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists the existing alerting policies for the workspace.

Parameters
Name Description
name string

Required. The project whose alert policies are to be listed. The format is:

projects/[PROJECT_ID_OR_NUMBER]

Note that this field names the parent container in which the alerting policies to be listed are stored. To retrieve a single alerting policy by name, use the [GetAlertPolicy][google.monitoring.v3.AlertPolicyService.GetAlertPolicy] operation, instead.

pageToken string

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

pageSize int

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.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListAlertPoliciesResponseAlertPolicy

A pageable sequence of AlertPolicy resources.

Example
// Create client
AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]";
// Make the request
PagedEnumerable<ListAlertPoliciesResponse, AlertPolicy> response = alertPolicyServiceClient.ListAlertPolicies(name);

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

ListAlertPoliciesAsync(IResourceName, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListAlertPoliciesResponse, AlertPolicy> ListAlertPoliciesAsync(IResourceName name, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists the existing alerting policies for the workspace.

Parameters
Name Description
name IResourceName

Required. The project whose alert policies are to be listed. The format is:

projects/[PROJECT_ID_OR_NUMBER]

Note that this field names the parent container in which the alerting policies to be listed are stored. To retrieve a single alerting policy by name, use the [GetAlertPolicy][google.monitoring.v3.AlertPolicyService.GetAlertPolicy] operation, instead.

pageToken string

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

pageSize int

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.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListAlertPoliciesResponseAlertPolicy

A pageable asynchronous sequence of AlertPolicy resources.

Example
// Create client
AlertPolicyServiceClient alertPolicyServiceClient = await AlertPolicyServiceClient.CreateAsync();
// Initialize request argument(s)
IResourceName name = new UnparsedResourceName("a/wildcard/resource");
// Make the request
PagedAsyncEnumerable<ListAlertPoliciesResponse, AlertPolicy> response = alertPolicyServiceClient.ListAlertPoliciesAsync(name);

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

ListAlertPoliciesAsync(FolderName, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListAlertPoliciesResponse, AlertPolicy> ListAlertPoliciesAsync(FolderName name, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists the existing alerting policies for the workspace.

Parameters
Name Description
name FolderName

Required. The project whose alert policies are to be listed. The format is:

projects/[PROJECT_ID_OR_NUMBER]

Note that this field names the parent container in which the alerting policies to be listed are stored. To retrieve a single alerting policy by name, use the [GetAlertPolicy][google.monitoring.v3.AlertPolicyService.GetAlertPolicy] operation, instead.

pageToken string

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

pageSize int

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.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListAlertPoliciesResponseAlertPolicy

A pageable asynchronous sequence of AlertPolicy resources.

Example
// Create client
AlertPolicyServiceClient alertPolicyServiceClient = await AlertPolicyServiceClient.CreateAsync();
// Initialize request argument(s)
FolderName name = FolderName.FromFolder("[FOLDER]");
// Make the request
PagedAsyncEnumerable<ListAlertPoliciesResponse, AlertPolicy> response = alertPolicyServiceClient.ListAlertPoliciesAsync(name);

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

ListAlertPoliciesAsync(OrganizationName, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListAlertPoliciesResponse, AlertPolicy> ListAlertPoliciesAsync(OrganizationName name, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists the existing alerting policies for the workspace.

Parameters
Name Description
name OrganizationName

Required. The project whose alert policies are to be listed. The format is:

projects/[PROJECT_ID_OR_NUMBER]

Note that this field names the parent container in which the alerting policies to be listed are stored. To retrieve a single alerting policy by name, use the [GetAlertPolicy][google.monitoring.v3.AlertPolicyService.GetAlertPolicy] operation, instead.

pageToken string

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

pageSize int

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.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListAlertPoliciesResponseAlertPolicy

A pageable asynchronous sequence of AlertPolicy resources.

Example
// Create client
AlertPolicyServiceClient alertPolicyServiceClient = await AlertPolicyServiceClient.CreateAsync();
// Initialize request argument(s)
OrganizationName name = OrganizationName.FromOrganization("[ORGANIZATION]");
// Make the request
PagedAsyncEnumerable<ListAlertPoliciesResponse, AlertPolicy> response = alertPolicyServiceClient.ListAlertPoliciesAsync(name);

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

ListAlertPoliciesAsync(ProjectName, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListAlertPoliciesResponse, AlertPolicy> ListAlertPoliciesAsync(ProjectName name, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists the existing alerting policies for the workspace.

Parameters
Name Description
name ProjectName

Required. The project whose alert policies are to be listed. The format is:

projects/[PROJECT_ID_OR_NUMBER]

Note that this field names the parent container in which the alerting policies to be listed are stored. To retrieve a single alerting policy by name, use the [GetAlertPolicy][google.monitoring.v3.AlertPolicyService.GetAlertPolicy] operation, instead.

pageToken string

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

pageSize int

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.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListAlertPoliciesResponseAlertPolicy

A pageable asynchronous sequence of AlertPolicy resources.

Example
// Create client
AlertPolicyServiceClient alertPolicyServiceClient = await AlertPolicyServiceClient.CreateAsync();
// Initialize request argument(s)
ProjectName name = ProjectName.FromProject("[PROJECT]");
// Make the request
PagedAsyncEnumerable<ListAlertPoliciesResponse, AlertPolicy> response = alertPolicyServiceClient.ListAlertPoliciesAsync(name);

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

ListAlertPoliciesAsync(ListAlertPoliciesRequest, CallSettings)

public virtual PagedAsyncEnumerable<ListAlertPoliciesResponse, AlertPolicy> ListAlertPoliciesAsync(ListAlertPoliciesRequest request, CallSettings callSettings = null)

Lists the existing alerting policies for the workspace.

Parameters
Name Description
request ListAlertPoliciesRequest

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
PagedAsyncEnumerableListAlertPoliciesResponseAlertPolicy

A pageable asynchronous sequence of AlertPolicy resources.

Example
// Create client
AlertPolicyServiceClient alertPolicyServiceClient = await AlertPolicyServiceClient.CreateAsync();
// Initialize request argument(s)
ListAlertPoliciesRequest request = new ListAlertPoliciesRequest
{
    ProjectName = ProjectName.FromProject("[PROJECT]"),
    Filter = "",
    OrderBy = "",
};
// Make the request
PagedAsyncEnumerable<ListAlertPoliciesResponse, AlertPolicy> response = alertPolicyServiceClient.ListAlertPoliciesAsync(request);

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

ListAlertPoliciesAsync(string, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListAlertPoliciesResponse, AlertPolicy> ListAlertPoliciesAsync(string name, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists the existing alerting policies for the workspace.

Parameters
Name Description
name string

Required. The project whose alert policies are to be listed. The format is:

projects/[PROJECT_ID_OR_NUMBER]

Note that this field names the parent container in which the alerting policies to be listed are stored. To retrieve a single alerting policy by name, use the [GetAlertPolicy][google.monitoring.v3.AlertPolicyService.GetAlertPolicy] operation, instead.

pageToken string

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

pageSize int

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.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListAlertPoliciesResponseAlertPolicy

A pageable asynchronous sequence of AlertPolicy resources.

Example
// Create client
AlertPolicyServiceClient alertPolicyServiceClient = await AlertPolicyServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]";
// Make the request
PagedAsyncEnumerable<ListAlertPoliciesResponse, AlertPolicy> response = alertPolicyServiceClient.ListAlertPoliciesAsync(name);

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

UpdateAlertPolicy(UpdateAlertPolicyRequest, CallSettings)

public virtual AlertPolicy UpdateAlertPolicy(UpdateAlertPolicyRequest request, CallSettings callSettings = null)

Updates an alerting policy. You can either replace the entire policy with a new one or replace only certain fields in the current alerting policy by specifying the fields to be updated via updateMask. Returns the updated alerting policy.

Design your application to single-thread API calls that modify the state of alerting policies in a single project. This includes calls to CreateAlertPolicy, DeleteAlertPolicy and UpdateAlertPolicy.

Parameters
Name Description
request UpdateAlertPolicyRequest

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
AlertPolicy

The RPC response.

Example
// Create client
AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.Create();
// Initialize request argument(s)
UpdateAlertPolicyRequest request = new UpdateAlertPolicyRequest
{
    UpdateMask = new FieldMask(),
    AlertPolicy = new AlertPolicy(),
};
// Make the request
AlertPolicy response = alertPolicyServiceClient.UpdateAlertPolicy(request);

UpdateAlertPolicy(FieldMask, AlertPolicy, CallSettings)

public virtual AlertPolicy UpdateAlertPolicy(FieldMask updateMask, AlertPolicy alertPolicy, CallSettings callSettings = null)

Updates an alerting policy. You can either replace the entire policy with a new one or replace only certain fields in the current alerting policy by specifying the fields to be updated via updateMask. Returns the updated alerting policy.

Design your application to single-thread API calls that modify the state of alerting policies in a single project. This includes calls to CreateAlertPolicy, DeleteAlertPolicy and UpdateAlertPolicy.

Parameters
Name Description
updateMask FieldMask

Optional. A list of alerting policy field names. If this field is not empty, each listed field in the existing alerting policy is set to the value of the corresponding field in the supplied policy (alert_policy), or to the field's default value if the field is not in the supplied alerting policy. Fields not listed retain their previous value.

Examples of valid field masks include display_name, documentation, documentation.content, documentation.mime_type, user_labels, user_label.nameofkey, enabled, conditions, combiner, etc.

If this field is empty, then the supplied alerting policy replaces the existing policy. It is the same as deleting the existing policy and adding the supplied policy, except for the following:

  • The new policy will have the same [ALERT_POLICY_ID] as the former policy. This gives you continuity with the former policy in your notifications and incidents.
  • Conditions in the new policy will keep their former [CONDITION_ID] if the supplied condition includes the name field with that [CONDITION_ID]. If the supplied condition omits the name field, then a new [CONDITION_ID] is created.
alertPolicy AlertPolicy

Required. The updated alerting policy or the updated values for the fields listed in update_mask. If update_mask is not empty, any fields in this policy that are not in update_mask are ignored.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
AlertPolicy

The RPC response.

Example
// Create client
AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.Create();
// Initialize request argument(s)
FieldMask updateMask = new FieldMask();
AlertPolicy alertPolicy = new AlertPolicy();
// Make the request
AlertPolicy response = alertPolicyServiceClient.UpdateAlertPolicy(updateMask, alertPolicy);

UpdateAlertPolicyAsync(UpdateAlertPolicyRequest, CallSettings)

public virtual Task<AlertPolicy> UpdateAlertPolicyAsync(UpdateAlertPolicyRequest request, CallSettings callSettings = null)

Updates an alerting policy. You can either replace the entire policy with a new one or replace only certain fields in the current alerting policy by specifying the fields to be updated via updateMask. Returns the updated alerting policy.

Design your application to single-thread API calls that modify the state of alerting policies in a single project. This includes calls to CreateAlertPolicy, DeleteAlertPolicy and UpdateAlertPolicy.

Parameters
Name Description
request UpdateAlertPolicyRequest

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
TaskAlertPolicy

A Task containing the RPC response.

Example
// Create client
AlertPolicyServiceClient alertPolicyServiceClient = await AlertPolicyServiceClient.CreateAsync();
// Initialize request argument(s)
UpdateAlertPolicyRequest request = new UpdateAlertPolicyRequest
{
    UpdateMask = new FieldMask(),
    AlertPolicy = new AlertPolicy(),
};
// Make the request
AlertPolicy response = await alertPolicyServiceClient.UpdateAlertPolicyAsync(request);

UpdateAlertPolicyAsync(UpdateAlertPolicyRequest, CancellationToken)

public virtual Task<AlertPolicy> UpdateAlertPolicyAsync(UpdateAlertPolicyRequest request, CancellationToken cancellationToken)

Updates an alerting policy. You can either replace the entire policy with a new one or replace only certain fields in the current alerting policy by specifying the fields to be updated via updateMask. Returns the updated alerting policy.

Design your application to single-thread API calls that modify the state of alerting policies in a single project. This includes calls to CreateAlertPolicy, DeleteAlertPolicy and UpdateAlertPolicy.

Parameters
Name Description
request UpdateAlertPolicyRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskAlertPolicy

A Task containing the RPC response.

Example
// Create client
AlertPolicyServiceClient alertPolicyServiceClient = await AlertPolicyServiceClient.CreateAsync();
// Initialize request argument(s)
UpdateAlertPolicyRequest request = new UpdateAlertPolicyRequest
{
    UpdateMask = new FieldMask(),
    AlertPolicy = new AlertPolicy(),
};
// Make the request
AlertPolicy response = await alertPolicyServiceClient.UpdateAlertPolicyAsync(request);

UpdateAlertPolicyAsync(FieldMask, AlertPolicy, CallSettings)

public virtual Task<AlertPolicy> UpdateAlertPolicyAsync(FieldMask updateMask, AlertPolicy alertPolicy, CallSettings callSettings = null)

Updates an alerting policy. You can either replace the entire policy with a new one or replace only certain fields in the current alerting policy by specifying the fields to be updated via updateMask. Returns the updated alerting policy.

Design your application to single-thread API calls that modify the state of alerting policies in a single project. This includes calls to CreateAlertPolicy, DeleteAlertPolicy and UpdateAlertPolicy.

Parameters
Name Description
updateMask FieldMask

Optional. A list of alerting policy field names. If this field is not empty, each listed field in the existing alerting policy is set to the value of the corresponding field in the supplied policy (alert_policy), or to the field's default value if the field is not in the supplied alerting policy. Fields not listed retain their previous value.

Examples of valid field masks include display_name, documentation, documentation.content, documentation.mime_type, user_labels, user_label.nameofkey, enabled, conditions, combiner, etc.

If this field is empty, then the supplied alerting policy replaces the existing policy. It is the same as deleting the existing policy and adding the supplied policy, except for the following:

  • The new policy will have the same [ALERT_POLICY_ID] as the former policy. This gives you continuity with the former policy in your notifications and incidents.
  • Conditions in the new policy will keep their former [CONDITION_ID] if the supplied condition includes the name field with that [CONDITION_ID]. If the supplied condition omits the name field, then a new [CONDITION_ID] is created.
alertPolicy AlertPolicy

Required. The updated alerting policy or the updated values for the fields listed in update_mask. If update_mask is not empty, any fields in this policy that are not in update_mask are ignored.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskAlertPolicy

A Task containing the RPC response.

Example
// Create client
AlertPolicyServiceClient alertPolicyServiceClient = await AlertPolicyServiceClient.CreateAsync();
// Initialize request argument(s)
FieldMask updateMask = new FieldMask();
AlertPolicy alertPolicy = new AlertPolicy();
// Make the request
AlertPolicy response = await alertPolicyServiceClient.UpdateAlertPolicyAsync(updateMask, alertPolicy);

UpdateAlertPolicyAsync(FieldMask, AlertPolicy, CancellationToken)

public virtual Task<AlertPolicy> UpdateAlertPolicyAsync(FieldMask updateMask, AlertPolicy alertPolicy, CancellationToken cancellationToken)

Updates an alerting policy. You can either replace the entire policy with a new one or replace only certain fields in the current alerting policy by specifying the fields to be updated via updateMask. Returns the updated alerting policy.

Design your application to single-thread API calls that modify the state of alerting policies in a single project. This includes calls to CreateAlertPolicy, DeleteAlertPolicy and UpdateAlertPolicy.

Parameters
Name Description
updateMask FieldMask

Optional. A list of alerting policy field names. If this field is not empty, each listed field in the existing alerting policy is set to the value of the corresponding field in the supplied policy (alert_policy), or to the field's default value if the field is not in the supplied alerting policy. Fields not listed retain their previous value.

Examples of valid field masks include display_name, documentation, documentation.content, documentation.mime_type, user_labels, user_label.nameofkey, enabled, conditions, combiner, etc.

If this field is empty, then the supplied alerting policy replaces the existing policy. It is the same as deleting the existing policy and adding the supplied policy, except for the following:

  • The new policy will have the same [ALERT_POLICY_ID] as the former policy. This gives you continuity with the former policy in your notifications and incidents.
  • Conditions in the new policy will keep their former [CONDITION_ID] if the supplied condition includes the name field with that [CONDITION_ID]. If the supplied condition omits the name field, then a new [CONDITION_ID] is created.
alertPolicy AlertPolicy

Required. The updated alerting policy or the updated values for the fields listed in update_mask. If update_mask is not empty, any fields in this policy that are not in update_mask are ignored.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskAlertPolicy

A Task containing the RPC response.

Example
// Create client
AlertPolicyServiceClient alertPolicyServiceClient = await AlertPolicyServiceClient.CreateAsync();
// Initialize request argument(s)
FieldMask updateMask = new FieldMask();
AlertPolicy alertPolicy = new AlertPolicy();
// Make the request
AlertPolicy response = await alertPolicyServiceClient.UpdateAlertPolicyAsync(updateMask, alertPolicy);