common

package
v0.8.0-rc1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 23, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ErrFmtNoAttribute is an error string for not-found attributes
	ErrFmtNoAttribute = `"attribute not found: %s`
	// ErrFmtUnexpectedType is an error string for attribute map values of unexpected type
	ErrFmtUnexpectedType = `unexpected type for attribute %s: Expecting a string`

	// VersionV1Alpha2 is used as minimum version for all manually configured resources.
	VersionV1Alpha2 = "v1alpha2"
)

Variables

This section is empty.

Functions

func AddCommonReferences added in v0.6.0

func AddCommonReferences(r *tjconfig.Resource) error

AddCommonReferences adds some common reference fields. This is a part of resource generation pipeline.

func GetAttributeValue added in v0.6.0

func GetAttributeValue(attrMap map[string]interface{}, attr string) (string, error)

GetAttributeValue reads a string attribute from the specified map

func GetFullyQualifiedIDFn

func GetFullyQualifiedIDFn(serviceProvider string, keyPairs ...string) tjconfig.GetIDFn

GetFullyQualifiedIDFn returns a GetIDFn that can parse any Azure fully qualifier. An example identifier is as follows: /subscriptions/%s/resourceGroups/%s/providers/Microsoft.DocumentDB/databaseAccounts/%s/sqlDatabases/%s/containers/%s An input to this function to parse it would be: serviceProvider: "Microsoft.DocumentDB" keyPairs: []string{"databaseAccounts", "account_name", "sqlDatabases", "database_name", "containers", "name"}

func GetNameFromFullyQualifiedID

func GetNameFromFullyQualifiedID(tfstate map[string]interface{}) (string, error)

GetNameFromFullyQualifiedID extracts external-name from Azure ID using the "id" attribute. Examples of fully qualifiers: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.DBforMySQL/servers/server1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Network/networkInterfaces/nic1

func GetResourceNameFromIDURLFn added in v0.6.0

func GetResourceNameFromIDURLFn(pos int) tjconfig.GetExternalNameFn

GetResourceNameFromIDURLFn returns a GetExternalNameFn fuction that extracts external-name from an Azure URL ID at the specified pos. Examples of persistent IDs to be parsed with pos==2: https://example.vault.azure.net/secrets/example-secret/c0ffee5f4d45440cb60c28672887f832 https://example-keyvault.vault.azure.net/keys/example-key/fdf067c93bbb4b22bff4d8b7a9a56217 https://key-vault-name.vault.azure.net/certificates/issuers/example

func ParseNameFromIDField added in v0.6.0

func ParseNameFromIDField(attrMap map[string]interface{}, idAttr string) (string, error)

ParseNameFromIDField extracts external-name from Azure ID using the specified field. Examples of fully qualifiers: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.DBforMySQL/servers/server1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Network/networkInterfaces/nic1

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL