From 61056a5c8627086de31d18f395f7273efefae93a Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Sun, 2 Feb 2025 15:37:37 -0800 Subject: [PATCH] feat: remove extra fenced code block markers (#8067) * docs: remove extra fenced code block markers feat: add filter field to snooze proto PiperOrigin-RevId: 721410619 Source-Link: https://github.com/googleapis/googleapis/commit/4d95834e9db8ee827f0e7846b175a3aeaf92f9ef Source-Link: https://github.com/googleapis/googleapis-gen/commit/6f3fbcbbcd2a61dd72b0144ecd7043a9973d39e1 Copy-Tag: eyJwIjoiTW9uaXRvcmluZy8uT3dsQm90LnlhbWwiLCJoIjoiNmYzZmJjYmJjZDJhNjFkZDcyYjAxNDRlY2Q3MDQzYTk5NzNkMzllMSJ9 --- Monitoring/metadata/V3/Snooze.php | 9 +-- Monitoring/src/V3/ListSnoozesRequest.php | 8 --- Monitoring/src/V3/Snooze/Criteria.php | 90 ++++++++++++++++++++++++ 3 files changed, 95 insertions(+), 12 deletions(-) diff --git a/Monitoring/metadata/V3/Snooze.php b/Monitoring/metadata/V3/Snooze.php index e98aca9ec3cc..eddd88184345 100644 --- a/Monitoring/metadata/V3/Snooze.php +++ b/Monitoring/metadata/V3/Snooze.php @@ -19,16 +19,17 @@ public static function initOnce() { \GPBMetadata\Google\Monitoring\V3\Common::initOnce(); $pool->internalAddGeneratedFile( ' - -!google/monitoring/v3/snooze.protogoogle.monitoring.v3google/api/resource.proto!google/monitoring/v3/common.proto" + +!google/monitoring/v3/snooze.protogoogle.monitoring.v3google/api/resource.proto!google/monitoring/v3/common.proto" Snooze name ( BA< criteria ( 2%.google.monitoring.v3.Snooze.CriteriaBA9 interval ( 2".google.monitoring.v3.TimeIntervalBA - display_name ( BAH + display_name ( BAX Criteria< policies ( B*A\' -%monitoring.googleapis.com/AlertPolicy:JAG +%monitoring.googleapis.com/AlertPolicy +filter ( :JAG monitoring.googleapis.com/Snooze#projects/{project}/snoozes/{snooze}B com.google.monitoring.v3B SnoozeProtoPZAcloud.google.com/go/monitoring/apiv3/v2/monitoringpb;monitoringpbGoogle.Cloud.Monitoring.V3Google\\Cloud\\Monitoring\\V3Google::Cloud::Monitoring::V3bproto3' , true); diff --git a/Monitoring/src/V3/ListSnoozesRequest.php b/Monitoring/src/V3/ListSnoozesRequest.php index ff92a8e233fa..9377cad8b086 100644 --- a/Monitoring/src/V3/ListSnoozesRequest.php +++ b/Monitoring/src/V3/ListSnoozesRequest.php @@ -31,10 +31,8 @@ class ListSnoozesRequest extends \Google\Protobuf\Internal\Message * * `interval.start_time` * * `interval.end_time` * For example: - * ``` * interval.start_time > "2022-03-11T00:00:00-08:00" AND * interval.end_time < "2022-03-12T00:00:00-08:00" - * ``` * * Generated from protobuf field string filter = 2 [(.google.api.field_behavior) = OPTIONAL]; */ @@ -92,10 +90,8 @@ public static function build(string $parent): self * * `interval.start_time` * * `interval.end_time` * For example: - * ``` * interval.start_time > "2022-03-11T00:00:00-08:00" AND * interval.end_time < "2022-03-12T00:00:00-08:00" - * ``` * @type int $page_size * Optional. The maximum number of results to return for a single query. The * server may further constrain the maximum number of results returned in a @@ -150,10 +146,8 @@ public function setParent($var) * * `interval.start_time` * * `interval.end_time` * For example: - * ``` * interval.start_time > "2022-03-11T00:00:00-08:00" AND * interval.end_time < "2022-03-12T00:00:00-08:00" - * ``` * * Generated from protobuf field string filter = 2 [(.google.api.field_behavior) = OPTIONAL]; * @return string @@ -169,10 +163,8 @@ public function getFilter() * * `interval.start_time` * * `interval.end_time` * For example: - * ``` * interval.start_time > "2022-03-11T00:00:00-08:00" AND * interval.end_time < "2022-03-12T00:00:00-08:00" - * ``` * * Generated from protobuf field string filter = 2 [(.google.api.field_behavior) = OPTIONAL]; * @param string $var diff --git a/Monitoring/src/V3/Snooze/Criteria.php b/Monitoring/src/V3/Snooze/Criteria.php index d04b1395151b..3edbde825549 100644 --- a/Monitoring/src/V3/Snooze/Criteria.php +++ b/Monitoring/src/V3/Snooze/Criteria.php @@ -23,10 +23,30 @@ class Criteria extends \Google\Protobuf\Internal\Message * projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[POLICY_ID] * There is a limit of 16 policies per snooze. This limit is checked during * snooze creation. + * Exactly 1 alert policy is required if `filter` is specified at the same + * time. * * Generated from protobuf field repeated string policies = 1 [(.google.api.resource_reference) = { */ private $policies; + /** + * Optional. The filter string to match on Alert fields when silencing the + * alerts. It follows the standard https://google.aip.dev/160 syntax. + * A filter string used to apply the snooze to specific incidents + * that have matching filter values. + * Filters can be defined for snoozes that apply to one alerting + * policy. + * Filters must be a string formatted as one or more resource labels with + * specific label values. If multiple resource labels are used, then they + * must be connected with an AND operator. For example, the following filter + * applies the snooze to incidents that have an instance ID of + * `1234567890` and a zone of `us-central1-a`: + * resource.labels.instance_id="1234567890" AND + * resource.labels.zone="us-central1-a" + * + * Generated from protobuf field string filter = 2; + */ + protected $filter = ''; /** * Constructor. @@ -40,6 +60,22 @@ class Criteria extends \Google\Protobuf\Internal\Message * projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[POLICY_ID] * There is a limit of 16 policies per snooze. This limit is checked during * snooze creation. + * Exactly 1 alert policy is required if `filter` is specified at the same + * time. + * @type string $filter + * Optional. The filter string to match on Alert fields when silencing the + * alerts. It follows the standard https://google.aip.dev/160 syntax. + * A filter string used to apply the snooze to specific incidents + * that have matching filter values. + * Filters can be defined for snoozes that apply to one alerting + * policy. + * Filters must be a string formatted as one or more resource labels with + * specific label values. If multiple resource labels are used, then they + * must be connected with an AND operator. For example, the following filter + * applies the snooze to incidents that have an instance ID of + * `1234567890` and a zone of `us-central1-a`: + * resource.labels.instance_id="1234567890" AND + * resource.labels.zone="us-central1-a" * } */ public function __construct($data = NULL) { @@ -53,6 +89,8 @@ public function __construct($data = NULL) { * projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[POLICY_ID] * There is a limit of 16 policies per snooze. This limit is checked during * snooze creation. + * Exactly 1 alert policy is required if `filter` is specified at the same + * time. * * Generated from protobuf field repeated string policies = 1 [(.google.api.resource_reference) = { * @return \Google\Protobuf\Internal\RepeatedField @@ -68,6 +106,8 @@ public function getPolicies() * projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[POLICY_ID] * There is a limit of 16 policies per snooze. This limit is checked during * snooze creation. + * Exactly 1 alert policy is required if `filter` is specified at the same + * time. * * Generated from protobuf field repeated string policies = 1 [(.google.api.resource_reference) = { * @param array|\Google\Protobuf\Internal\RepeatedField $var @@ -81,6 +121,56 @@ public function setPolicies($var) return $this; } + /** + * Optional. The filter string to match on Alert fields when silencing the + * alerts. It follows the standard https://google.aip.dev/160 syntax. + * A filter string used to apply the snooze to specific incidents + * that have matching filter values. + * Filters can be defined for snoozes that apply to one alerting + * policy. + * Filters must be a string formatted as one or more resource labels with + * specific label values. If multiple resource labels are used, then they + * must be connected with an AND operator. For example, the following filter + * applies the snooze to incidents that have an instance ID of + * `1234567890` and a zone of `us-central1-a`: + * resource.labels.instance_id="1234567890" AND + * resource.labels.zone="us-central1-a" + * + * Generated from protobuf field string filter = 2; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. The filter string to match on Alert fields when silencing the + * alerts. It follows the standard https://google.aip.dev/160 syntax. + * A filter string used to apply the snooze to specific incidents + * that have matching filter values. + * Filters can be defined for snoozes that apply to one alerting + * policy. + * Filters must be a string formatted as one or more resource labels with + * specific label values. If multiple resource labels are used, then they + * must be connected with an AND operator. For example, the following filter + * applies the snooze to incidents that have an instance ID of + * `1234567890` and a zone of `us-central1-a`: + * resource.labels.instance_id="1234567890" AND + * resource.labels.zone="us-central1-a" + * + * Generated from protobuf field string filter = 2; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + }