-
Notifications
You must be signed in to change notification settings - Fork 1
/
super_attribute.go
39 lines (30 loc) · 1.42 KB
/
super_attribute.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package superschema
import (
schemaD "github.com/hashicorp/terraform-plugin-framework/datasource/schema"
schemaR "github.com/hashicorp/terraform-plugin-framework/resource/schema"
)
type superAttribute interface {
schemaR.Attribute
schemaD.Attribute
}
func computeIsComputed[X, T superAttribute](common X, resourceOrDatasource T) bool {
return common.IsComputed() || resourceOrDatasource.IsComputed()
}
func computeIsOptional[X, T superAttribute](common X, resourceOrDatasource T) bool {
return common.IsOptional() || resourceOrDatasource.IsOptional()
}
func computeIsRequired[X, T superAttribute](common X, resourceOrDatasource T) bool {
return common.IsRequired() || resourceOrDatasource.IsRequired()
}
func computeIsSensitive[X, T superAttribute](common X, resourceOrDatasource T) bool {
return common.IsSensitive() || resourceOrDatasource.IsSensitive()
}
func computeMarkdownDescription[X, T superAttribute](common X, resourceOrDatasource T) string {
return addToDescription(common.GetMarkdownDescription(), resourceOrDatasource.GetMarkdownDescription())
}
func computeDescription[X, T superAttribute](common X, resourceOrDatasource T) string {
return addToDescription(common.GetDescription(), resourceOrDatasource.GetDescription())
}
func computeDeprecationMessage[X, T superAttribute](common X, resourceOrDatasource T) string {
return addToDescription(common.GetDeprecationMessage(), resourceOrDatasource.GetDeprecationMessage())
}