Documentation ¶
Index ¶
- Constants
- func GetResourceID(resourceID string) (string, string, error)
- func SetResourceID(identifier string, key string) string
- func TagsSchema() *schema.Schema
- func TagsSchemaComputed() *schema.Schema
- func TagsSchemaForceNew() *schema.Schema
- func ToSnakeCase(str string) string
- type DefaultConfig
- type IgnoreConfig
- type KeyValueTags
- func (tags KeyValueTags) Chunks(size int) []KeyValueTags
- func (tags KeyValueTags) ContainsAll(target KeyValueTags) bool
- func (tags KeyValueTags) Equal(other KeyValueTags) bool
- func (tags KeyValueTags) Hash() int
- func (tags KeyValueTags) Ignore(ignoreTags KeyValueTags) KeyValueTags
- func (tags KeyValueTags) IgnoreAWS() KeyValueTags
- func (tags KeyValueTags) IgnoreConfig(config *IgnoreConfig) KeyValueTags
- func (tags KeyValueTags) IgnoreElasticbeanstalk() KeyValueTags
- func (tags KeyValueTags) IgnorePrefixes(ignoreTagPrefixes KeyValueTags) KeyValueTags
- func (tags KeyValueTags) IgnoreRds() KeyValueTags
- func (tags KeyValueTags) IgnoreServerlessApplicationRepository() KeyValueTags
- func (tags KeyValueTags) KeyAdditionalBoolValue(key string, fieldName string) *bool
- func (tags KeyValueTags) KeyAdditionalStringValue(key string, fieldName string) *string
- func (tags KeyValueTags) KeyExists(key string) bool
- func (tags KeyValueTags) KeyTagData(key string) *TagData
- func (tags KeyValueTags) KeyValue(key string) *string
- func (tags KeyValueTags) Keys() []string
- func (tags KeyValueTags) ListofMap() []map[string]interface{}
- func (tags KeyValueTags) Map() map[string]string
- func (tags KeyValueTags) Merge(mergeTags KeyValueTags) KeyValueTags
- func (tags KeyValueTags) Only(onlyTags KeyValueTags) KeyValueTags
- func (tags KeyValueTags) RemoveDefaultConfig(dc *DefaultConfig) KeyValueTags
- func (tags KeyValueTags) Removed(newTags KeyValueTags) KeyValueTags
- func (tags KeyValueTags) String() string
- func (tags KeyValueTags) Updated(newTags KeyValueTags) KeyValueTags
- func (tags KeyValueTags) UrlEncode() string
- func (tags KeyValueTags) UrlQueryString() string
- type TagData
Constants ¶
const ( AwsTagKeyPrefix = `aws:` ElasticbeanstalkTagKeyPrefix = `elasticbeanstalk:` NameTagKey = `Name` RdsTagKeyPrefix = `rds:` ServerlessApplicationRepositoryTagKeyPrefix = `serverlessrepo:` )
Variables ¶
This section is empty.
Functions ¶
func GetResourceID ¶
GetResourceID parses a given resource identifier for tag identifier and tag key.
func SetResourceID ¶
SetResourceID creates a resource identifier given a tag identifier and a tag key.
func TagsSchemaComputed ¶
func TagsSchemaForceNew ¶
func ToSnakeCase ¶
ToSnakeCase converts a string to snake case.
For example, AWS Go SDK field names are in PascalCase, while Terraform schema attribute names are in snake_case.
Types ¶
type DefaultConfig ¶
type DefaultConfig struct {
Tags KeyValueTags
}
DefaultConfig contains tags to default across all resources.
func (*DefaultConfig) GetTags ¶
func (dc *DefaultConfig) GetTags() KeyValueTags
GetTags is convenience method that returns the DefaultConfig's Tags, if any
func (*DefaultConfig) MergeTags ¶
func (dc *DefaultConfig) MergeTags(tags KeyValueTags) KeyValueTags
MergeTags returns the result of keyvaluetags.Merge() on the given DefaultConfig.Tags with KeyValueTags provided as an argument, overriding the value of any tag with a matching key.
func (*DefaultConfig) TagsEqual ¶
func (dc *DefaultConfig) TagsEqual(tags KeyValueTags) bool
TagsEqual returns true if the given configuration's Tags are equal to those passed in as an argument; otherwise returns false
type IgnoreConfig ¶
type IgnoreConfig struct { Keys KeyValueTags KeyPrefixes KeyValueTags }
IgnoreConfig contains various options for removing resource tags.
type KeyValueTags ¶
KeyValueTags is a standard implementation for AWS key-value resource tags. The AWS Go SDK is split into multiple service packages, each service with its own Go struct type representing a resource tag. To standardize logic across all these Go types, we convert them into this Go type.
func New ¶
func New(i interface{}) KeyValueTags
New creates KeyValueTags from common types or returns an empty KeyValueTags.
Supports various Terraform Plugin SDK types including map[string]string, map[string]*string, map[string]interface{}, and []interface{}. When passed []interface{}, all elements are treated as keys and assigned nil values. When passed KeyValueTags or its underlying type implementation, returns itself.
func (KeyValueTags) Chunks ¶
func (tags KeyValueTags) Chunks(size int) []KeyValueTags
Chunks returns a slice of KeyValueTags, each of the specified size.
func (KeyValueTags) ContainsAll ¶
func (tags KeyValueTags) ContainsAll(target KeyValueTags) bool
ContainsAll returns whether or not all the target tags are contained.
func (KeyValueTags) Equal ¶
func (tags KeyValueTags) Equal(other KeyValueTags) bool
Equal returns whether or two sets of key-value tags are equal.
func (KeyValueTags) Hash ¶
func (tags KeyValueTags) Hash() int
Hash returns a stable hash value. The returned value may be negative (i.e. not suitable for a 'Set' function).
func (KeyValueTags) Ignore ¶
func (tags KeyValueTags) Ignore(ignoreTags KeyValueTags) KeyValueTags
Ignore returns non-matching tag keys.
func (KeyValueTags) IgnoreAWS ¶
func (tags KeyValueTags) IgnoreAWS() KeyValueTags
IgnoreAWS returns non-AWS tag keys.
func (KeyValueTags) IgnoreConfig ¶
func (tags KeyValueTags) IgnoreConfig(config *IgnoreConfig) KeyValueTags
IgnoreConfig returns any tags not removed by a given configuration.
func (KeyValueTags) IgnoreElasticbeanstalk ¶
func (tags KeyValueTags) IgnoreElasticbeanstalk() KeyValueTags
IgnoreElasticbeanstalk returns non-AWS and non-Elasticbeanstalk tag keys.
func (KeyValueTags) IgnorePrefixes ¶
func (tags KeyValueTags) IgnorePrefixes(ignoreTagPrefixes KeyValueTags) KeyValueTags
IgnorePrefixes returns non-matching tag key prefixes.
func (KeyValueTags) IgnoreRds ¶
func (tags KeyValueTags) IgnoreRds() KeyValueTags
IgnoreRDS returns non-AWS and non-RDS tag keys.
func (KeyValueTags) IgnoreServerlessApplicationRepository ¶
func (tags KeyValueTags) IgnoreServerlessApplicationRepository() KeyValueTags
IgnoreServerlessApplicationRepository returns non-AWS and non-ServerlessApplicationRepository tag keys.
func (KeyValueTags) KeyAdditionalBoolValue ¶
func (tags KeyValueTags) KeyAdditionalBoolValue(key string, fieldName string) *bool
KeyAdditionalBoolValue returns the boolean value of an additional tag field. If the key or additional field is not found, returns nil.
func (KeyValueTags) KeyAdditionalStringValue ¶
func (tags KeyValueTags) KeyAdditionalStringValue(key string, fieldName string) *string
KeyAdditionalStringValue returns the string value of an additional tag field. If the key or additional field is not found, returns nil.
func (KeyValueTags) KeyExists ¶
func (tags KeyValueTags) KeyExists(key string) bool
KeyExists returns true if a tag key exists. If the key is not found, returns nil.
func (KeyValueTags) KeyTagData ¶
func (tags KeyValueTags) KeyTagData(key string) *TagData
KeyTagData returns all tag key data. If the key is not found, returns nil. Use KeyExists to determine if key is present.
func (KeyValueTags) KeyValue ¶
func (tags KeyValueTags) KeyValue(key string) *string
KeyValue returns a tag key value. If the key is not found, returns nil. Use KeyExists to determine if key is present.
func (KeyValueTags) ListofMap ¶
func (tags KeyValueTags) ListofMap() []map[string]interface{}
ListofMap returns a list of flattened tags. Compatible with setting Terraform state for strongly typed configuration blocks.
func (KeyValueTags) Map ¶
func (tags KeyValueTags) Map() map[string]string
Map returns tag keys mapped to their values.
func (KeyValueTags) Merge ¶
func (tags KeyValueTags) Merge(mergeTags KeyValueTags) KeyValueTags
Merge adds missing and updates existing tags.
func (KeyValueTags) Only ¶
func (tags KeyValueTags) Only(onlyTags KeyValueTags) KeyValueTags
Only returns matching tag keys.
func (KeyValueTags) RemoveDefaultConfig ¶
func (tags KeyValueTags) RemoveDefaultConfig(dc *DefaultConfig) KeyValueTags
RemoveDefaultConfig returns tags not present in a DefaultConfig object in addition to tags with key/value pairs that override those in a DefaultConfig; however, if all tags present in the DefaultConfig object are equivalent to those in the given KeyValueTags, then the KeyValueTags are returned, effectively bypassing the need to remove differing tags.
func (KeyValueTags) Removed ¶
func (tags KeyValueTags) Removed(newTags KeyValueTags) KeyValueTags
Removed returns tags removed.
func (KeyValueTags) String ¶
func (tags KeyValueTags) String() string
String returns the default string representation of the KeyValueTags.
func (KeyValueTags) Updated ¶
func (tags KeyValueTags) Updated(newTags KeyValueTags) KeyValueTags
Updated returns tags added and updated.
func (KeyValueTags) UrlEncode ¶
func (tags KeyValueTags) UrlEncode() string
UrlEncode returns the KeyValueTags encoded as URL Query parameters.
func (KeyValueTags) UrlQueryString ¶
func (tags KeyValueTags) UrlQueryString() string
UrlQueryString returns the KeyValueTags formatted as URL Query parameters without encoding.
type TagData ¶
type TagData struct { // Additional boolean field names and values associated with this tag. // Each service is responsible for properly handling this data. AdditionalBoolFields map[string]*bool // Additional string field names and values associated with this tag. // Each service is responsible for properly handling this data. AdditionalStringFields map[string]*string // Tag value. Value *string }
TagData represents the data associated with a resource tag key. Almost exclusively for AWS services, this is just a tag value, however there are services that attach additional data to tags. An example is autoscaling with the PropagateAtLaunch field.