From 8d80bdb04e86271c18d1ca5a057cbd094f6ca88f Mon Sep 17 00:00:00 2001 From: Hausten Irving Date: Tue, 31 Oct 2023 15:07:35 -0500 Subject: [PATCH] Added Subject Field to Alert Policy Monitoring Resource (#9360) * Added Alert Policy resource field for subject line. * Added test for Alert Policy field. * Included subject in one_of lists. * Included subject in one_of lists. --- mmv1/products/monitoring/AlertPolicy.yaml | 13 +++++++++++++ .../resource_monitoring_alert_policy_test.go | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/mmv1/products/monitoring/AlertPolicy.yaml b/mmv1/products/monitoring/AlertPolicy.yaml index 1a8021a6b5a6..92aa4f110ad8 100644 --- a/mmv1/products/monitoring/AlertPolicy.yaml +++ b/mmv1/products/monitoring/AlertPolicy.yaml @@ -971,6 +971,7 @@ properties: at_least_one_of: - documentation.0.content - documentation.0.mime_type + - documentation.0.subject description: | The text of the documentation, interpreted according to mimeType. The content may not exceed 8,192 Unicode characters and may not @@ -981,7 +982,19 @@ properties: at_least_one_of: - documentation.0.content - documentation.0.mime_type + - documentation.0.subject default_value: text/markdown description: | The format of the content field. Presently, only the value "text/markdown" is supported. + - !ruby/object:Api::Type::String + name: subject + at_least_one_of: + - documentation.0.content + - documentation.0.mime_type + - documentation.0.subject + 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. diff --git a/mmv1/third_party/terraform/services/monitoring/resource_monitoring_alert_policy_test.go b/mmv1/third_party/terraform/services/monitoring/resource_monitoring_alert_policy_test.go index fa773fb57d52..857d40c00b24 100644 --- a/mmv1/third_party/terraform/services/monitoring/resource_monitoring_alert_policy_test.go +++ b/mmv1/third_party/terraform/services/monitoring/resource_monitoring_alert_policy_test.go @@ -322,6 +322,7 @@ resource "google_monitoring_alert_policy" "full" { documentation { content = "test content" mime_type = "text/markdown" + subject = "test subject" } } `, alertName, conditionName1, conditionName2) @@ -350,6 +351,7 @@ resource "google_monitoring_alert_policy" "mql" { documentation { content = "test content" mime_type = "text/markdown" + subject = "test subject" } } `, alertName, conditionName) @@ -383,6 +385,7 @@ resource "google_monitoring_alert_policy" "log" { documentation { content = "test content" mime_type = "text/markdown" + subject = "test subject" } } `, alertName, conditionName) @@ -441,6 +444,7 @@ resource "google_monitoring_alert_policy" "promql" { documentation { content = "test content" mime_type = "text/markdown" + subject = "test subject" } } `, alertName, conditionName)