Google Cloud Monitoring v3 API - Class AlertPolicyServiceClient (3.4.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
TypeDescription
string

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default AlertPolicyService scopes.

Property Value
TypeDescription
IReadOnlyListstring
Remarks

GrpcClient

public virtual AlertPolicyService.AlertPolicyServiceClient GrpcClient { get; }

The underlying gRPC AlertPolicyService client

Property Value
TypeDescription
AlertPolicyServiceAlertPolicyServiceClient

ServiceMetadata

public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

Property Value
TypeDescription
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
TypeDescription
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
NameDescription
nameIResourceName

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.

alertPolicyAlertPolicy

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.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
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
NameDescription
nameFolderName

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.

alertPolicyAlertPolicy

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.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
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
NameDescription
nameOrganizationName

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.

alertPolicyAlertPolicy

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.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
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
NameDescription
nameProjectName

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.

alertPolicyAlertPolicy

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.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
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
NameDescription
requestCreateAlertPolicyRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
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
NameDescription
namestring

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.

alertPolicyAlertPolicy

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.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
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
NameDescription
nameIResourceName

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