class ProjectsAlertPolicies extends Resource (View source)

The "alertPolicies" collection of methods.

Typical usage is:

 $monitoringService = new Google\Service\Monitoring(...);
 $alertPolicies = $monitoringService->projects_alertPolicies;

Methods

create(string $name, AlertPolicy $postBody, array $optParams = [])

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.

delete(string $name, array $optParams = [])

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.

get(string $name, array $optParams = [])

Gets a single alerting policy. (alertPolicies.get)

listProjectsAlertPolicies(string $name, array $optParams = [])

Lists the existing alerting policies for the workspace.

patch(string $name, AlertPolicy $postBody, array $optParams = [])

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.

Details

AlertPolicy create(string $name, AlertPolicy $postBody, array $optParams = [])

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.

(alertPolicies.create)

Parameters

string $name

Required. The project (https://cloud.google.com/monitoring/api/v3#project_name) 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 $postBody
array $optParams

Optional parameters.

Return Value

AlertPolicy

Exceptions

Exception

MonitoringEmpty delete(string $name, array $optParams = [])

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.

(alertPolicies.delete)

Parameters

string $name

Required. The alerting policy to delete. The format is: projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID] For more information, see AlertPolicy.

array $optParams

Optional parameters.

Return Value

MonitoringEmpty

Exceptions

Exception

AlertPolicy get(string $name, array $optParams = [])

Gets a single alerting policy. (alertPolicies.get)

Parameters

string $name

Required. The alerting policy to retrieve. The format is: projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID]

array $optParams

Optional parameters.

Return Value

AlertPolicy

Exceptions

Exception

ListAlertPoliciesResponse listProjectsAlertPolicies(string $name, array $optParams = [])

Lists the existing alerting policies for the workspace.

(alertPolicies.listProjectsAlertPolicies)

Parameters

string $name

Required. The project (https://cloud.google.com/monitoring/api/v3#project_name) 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 operation, instead.

array $optParams

Optional parameters.

Return Value

ListAlertPoliciesResponse

Exceptions

Exception

AlertPolicy patch(string $name, AlertPolicy $postBody, array $optParams = [])

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.

(alertPolicies.patch)

Parameters

string $name

Identifier. Required if the policy exists. The resource name for this policy. The format is: projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID] [ALERT_POLICY_ID] is assigned by Cloud Monitoring when the policy is created. When calling the alertPolicies.create method, do not include the name field in the alerting policy passed as part of the request.

AlertPolicy $postBody
array $optParams

Optional parameters.

Return Value

AlertPolicy

Exceptions

Exception