@@ -920,15 +920,35 @@ limited capacity might not show this documentation.`,
920
920
The content may not exceed 8,192 Unicode characters and may not
921
921
exceed more than 10,240 bytes when encoded in UTF-8 format,
922
922
whichever is smaller.` ,
923
- AtLeastOneOf : []string {"documentation.0.content" , "documentation.0.mime_type" , "documentation.0.subject" },
923
+ AtLeastOneOf : []string {"documentation.0.content" , "documentation.0.mime_type" , "documentation.0.subject" , "documentation.0.links" },
924
+ },
925
+ "links" : {
926
+ Type : schema .TypeList ,
927
+ Optional : true ,
928
+ Description : `Links to content such as playbooks, repositories, and other resources. This field can contain up to 3 entries.` ,
929
+ Elem : & schema.Resource {
930
+ Schema : map [string ]* schema.Schema {
931
+ "display_name" : {
932
+ Type : schema .TypeString ,
933
+ Optional : true ,
934
+ Description : `A short display name for the link. The display name must not be empty or exceed 63 characters. Example: "playbook".` ,
935
+ },
936
+ "url" : {
937
+ Type : schema .TypeString ,
938
+ Optional : true ,
939
+ 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}".` ,
940
+ },
941
+ },
942
+ },
943
+ AtLeastOneOf : []string {"documentation.0.content" , "documentation.0.mime_type" , "documentation.0.subject" , "documentation.0.links" },
924
944
},
925
945
"mime_type" : {
926
946
Type : schema .TypeString ,
927
947
Optional : true ,
928
948
Description : `The format of the content field. Presently, only the value
929
949
"text/markdown" is supported.` ,
930
950
Default : "text/markdown" ,
931
- AtLeastOneOf : []string {"documentation.0.content" , "documentation.0.mime_type" , "documentation.0.subject" },
951
+ AtLeastOneOf : []string {"documentation.0.content" , "documentation.0.mime_type" , "documentation.0.subject" , "documentation.0.links" },
932
952
},
933
953
"subject" : {
934
954
Type : schema .TypeString ,
@@ -937,7 +957,7 @@ whichever is smaller.`,
937
957
exceed 10,240 bytes. In notifications generated by this policy the contents
938
958
of the subject line after variable expansion will be truncated to 255 bytes
939
959
or shorter at the latest UTF-8 character boundary.` ,
940
- AtLeastOneOf : []string {"documentation.0.content" , "documentation.0.mime_type" , "documentation.0.subject" },
960
+ AtLeastOneOf : []string {"documentation.0.content" , "documentation.0.mime_type" , "documentation.0.subject" , "documentation.0.links" },
941
961
},
942
962
},
943
963
},
@@ -2049,6 +2069,8 @@ func flattenMonitoringAlertPolicyDocumentation(v interface{}, d *schema.Resource
2049
2069
flattenMonitoringAlertPolicyDocumentationMimeType (original ["mimeType" ], d , config )
2050
2070
transformed ["subject" ] =
2051
2071
flattenMonitoringAlertPolicyDocumentationSubject (original ["subject" ], d , config )
2072
+ transformed ["links" ] =
2073
+ flattenMonitoringAlertPolicyDocumentationLinks (original ["links" ], d , config )
2052
2074
return []interface {}{transformed }
2053
2075
}
2054
2076
func flattenMonitoringAlertPolicyDocumentationContent (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
@@ -2063,6 +2085,33 @@ func flattenMonitoringAlertPolicyDocumentationSubject(v interface{}, d *schema.R
2063
2085
return v
2064
2086
}
2065
2087
2088
+ func flattenMonitoringAlertPolicyDocumentationLinks (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
2089
+ if v == nil {
2090
+ return v
2091
+ }
2092
+ l := v .([]interface {})
2093
+ transformed := make ([]interface {}, 0 , len (l ))
2094
+ for _ , raw := range l {
2095
+ original := raw .(map [string ]interface {})
2096
+ if len (original ) < 1 {
2097
+ // Do not include empty json objects coming back from the api
2098
+ continue
2099
+ }
2100
+ transformed = append (transformed , map [string ]interface {}{
2101
+ "display_name" : flattenMonitoringAlertPolicyDocumentationLinksDisplayName (original ["displayName" ], d , config ),
2102
+ "url" : flattenMonitoringAlertPolicyDocumentationLinksUrl (original ["url" ], d , config ),
2103
+ })
2104
+ }
2105
+ return transformed
2106
+ }
2107
+ func flattenMonitoringAlertPolicyDocumentationLinksDisplayName (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
2108
+ return v
2109
+ }
2110
+
2111
+ func flattenMonitoringAlertPolicyDocumentationLinksUrl (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
2112
+ return v
2113
+ }
2114
+
2066
2115
func expandMonitoringAlertPolicyDisplayName (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
2067
2116
return v , nil
2068
2117
}
@@ -2927,6 +2976,13 @@ func expandMonitoringAlertPolicyDocumentation(v interface{}, d tpgresource.Terra
2927
2976
transformed ["subject" ] = transformedSubject
2928
2977
}
2929
2978
2979
+ transformedLinks , err := expandMonitoringAlertPolicyDocumentationLinks (original ["links" ], d , config )
2980
+ if err != nil {
2981
+ return nil , err
2982
+ } else if val := reflect .ValueOf (transformedLinks ); val .IsValid () && ! tpgresource .IsEmptyValue (val ) {
2983
+ transformed ["links" ] = transformedLinks
2984
+ }
2985
+
2930
2986
return transformed , nil
2931
2987
}
2932
2988
@@ -2941,3 +2997,40 @@ func expandMonitoringAlertPolicyDocumentationMimeType(v interface{}, d tpgresour
2941
2997
func expandMonitoringAlertPolicyDocumentationSubject (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
2942
2998
return v , nil
2943
2999
}
3000
+
3001
+ func expandMonitoringAlertPolicyDocumentationLinks (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
3002
+ l := v .([]interface {})
3003
+ req := make ([]interface {}, 0 , len (l ))
3004
+ for _ , raw := range l {
3005
+ if raw == nil {
3006
+ continue
3007
+ }
3008
+ original := raw .(map [string ]interface {})
3009
+ transformed := make (map [string ]interface {})
3010
+
3011
+ transformedDisplayName , err := expandMonitoringAlertPolicyDocumentationLinksDisplayName (original ["display_name" ], d , config )
3012
+ if err != nil {
3013
+ return nil , err
3014
+ } else if val := reflect .ValueOf (transformedDisplayName ); val .IsValid () && ! tpgresource .IsEmptyValue (val ) {
3015
+ transformed ["displayName" ] = transformedDisplayName
3016
+ }
3017
+
3018
+ transformedUrl , err := expandMonitoringAlertPolicyDocumentationLinksUrl (original ["url" ], d , config )
3019
+ if err != nil {
3020
+ return nil , err
3021
+ } else if val := reflect .ValueOf (transformedUrl ); val .IsValid () && ! tpgresource .IsEmptyValue (val ) {
3022
+ transformed ["url" ] = transformedUrl
3023
+ }
3024
+
3025
+ req = append (req , transformed )
3026
+ }
3027
+ return req , nil
3028
+ }
3029
+
3030
+ func expandMonitoringAlertPolicyDocumentationLinksDisplayName (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
3031
+ return v , nil
3032
+ }
3033
+
3034
+ func expandMonitoringAlertPolicyDocumentationLinksUrl (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
3035
+ return v , nil
3036
+ }
0 commit comments