Skip to content

Commit

Permalink
Add support for links in Monitoring AlertPolicy (#11017)
Browse files Browse the repository at this point in the history
Co-authored-by: Zhenhua Li <zhenhuali@google.com>
  • Loading branch information
z-nand and zli82016 authored Jun 25, 2024
1 parent 5cfcabf commit c8d4f42
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
22 changes: 22 additions & 0 deletions mmv1/products/monitoring/AlertPolicy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -983,6 +983,7 @@ properties:
- documentation.0.content
- documentation.0.mime_type
- documentation.0.subject
- documentation.0.links
description: |
The text of the documentation, interpreted according to mimeType.
The content may not exceed 8,192 Unicode characters and may not
Expand All @@ -994,6 +995,7 @@ properties:
- documentation.0.content
- documentation.0.mime_type
- documentation.0.subject
- documentation.0.links
default_value: text/markdown
description: |
The format of the content field. Presently, only the value
Expand All @@ -1004,8 +1006,28 @@ properties:
- documentation.0.content
- documentation.0.mime_type
- documentation.0.subject
- documentation.0.links
description: |
The subject line of the notification. The subject line may not
exceed 10,240 bytes. In notifications generated by this policy the contents
of the subject line after variable expansion will be truncated to 255 bytes
or shorter at the latest UTF-8 character boundary.
- !ruby/object:Api::Type::Array
name: links
at_least_one_of:
- documentation.0.content
- documentation.0.mime_type
- documentation.0.subject
- documentation.0.links
description: |
Links to content such as playbooks, repositories, and other resources. This field can contain up to 3 entries.
item_type: !ruby/object:Api::Type::NestedObject
properties:
- !ruby/object:Api::Type::String
name: displayName
description: |
A short display name for the link. The display name must not be empty or exceed 63 characters. Example: "playbook".
- !ruby/object:Api::Type::String
name: url
description: |
The url of a webpage. A url can be templatized by using variables in the path or the query parameters. The total length of a URL should not exceed 2083 characters before and after variable expansion. Example: "https://my_domain.com/playbook?name=${resource.name}".
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,10 @@ resource "google_monitoring_alert_policy" "full" {
content = "test content"
mime_type = "text/markdown"
subject = "test subject"
links {
display_name = "link display name"
url = "http://mydomain.com"
}
}
}
`, alertName, conditionName1, conditionName2)
Expand Down Expand Up @@ -360,6 +364,14 @@ resource "google_monitoring_alert_policy" "mql" {
content = "test content"
mime_type = "text/markdown"
subject = "test subject"
links {
display_name = "link display name"
url = "http://mydomain.com"
}
links {
display_name = "link display name2"
url = "http://mydomain2.com"
}
}
}
`, alertName, conditionName)
Expand Down Expand Up @@ -395,7 +407,7 @@ resource "google_monitoring_alert_policy" "log" {
documentation {
content = "test content"
mime_type = "text/markdown"
subject = "test subject"
subject = "test subject"
}
}
`, alertName, conditionName)
Expand Down Expand Up @@ -457,6 +469,10 @@ resource "google_monitoring_alert_policy" "promql" {
content = "test content"
mime_type = "text/markdown"
subject = "test subject"
links {
display_name = "link display name"
url = "http://mydomain.com"
}
}
}
`, alertName, conditionName)
Expand Down

0 comments on commit c8d4f42

Please sign in to comment.