id

package
v0.12.103 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// maximum elb name length (the most limiting id) = 32
	// maximum prefix length = 15
	// maximum prefix length = l0-<prefix>- = 19
	// maximum id length = 31 - 19 = 13 (add buffer of 1 just to be safe) = 12
	MAX_ID_LENGTH      = 12
	MIN_ID_LENGTH      = 2
	MIN_ID_HASH_LENGTH = 5
)

Variables

View Source
var GenerateHashedEntityID = func(name string) string {
	prefix := filterUsableName(name)

	if maxPrefixLength := MAX_ID_LENGTH - MIN_ID_HASH_LENGTH; len(prefix) > maxPrefixLength {
		prefix = prefix[:maxPrefixLength]
	}

	hashLength := MAX_ID_LENGTH - len(prefix)
	hash := hashNow()[:hashLength]

	return prefix + hash
}

generates an id using as much of the name as possible with at least MIN_ID_HASH_LENGTH characters of the id randomly hashed the id will always be MAX_ID_LENGTH characters in length

View Source
var GenerateHashlessEntityID = func(name string) string {
	id := filterUsableName(name)

	if len(id) > MAX_ID_LENGTH {
		id = id[:MAX_ID_LENGTH]
	}

	if len(id) < MIN_ID_LENGTH {
		hashLength := MIN_ID_LENGTH - len(id)
		hash := hashNow()[:hashLength]
		id = id + hash
	}

	return id
}

generates an id using only the name while still being being safe in regards to length and character limitations (if possible)

View Source
var PREFIX = fmt.Sprintf("l0-%s-", config.Prefix())

Functions

func CertificateARNToName

func CertificateARNToName(arn string) string

func StubIDGeneration

func StubIDGeneration(id string) func()

used for testing

Types

type ECSDeployID

type ECSDeployID string

func TaskDefinitionARNToECSDeployID

func TaskDefinitionARNToECSDeployID(arn string) ECSDeployID

func TaskDefinitionToECSDeployID

func TaskDefinitionToECSDeployID(taskDefinition string) ECSDeployID

func (ECSDeployID) FamilyName

func (id ECSDeployID) FamilyName() string

func (ECSDeployID) L0DeployID

func (id ECSDeployID) L0DeployID() string

func (ECSDeployID) Revision

func (id ECSDeployID) Revision() string

func (ECSDeployID) String

func (id ECSDeployID) String() string

we need to add a custom .String() function, or else string conversions add quotes

func (ECSDeployID) TaskDefinition

func (id ECSDeployID) TaskDefinition() string

type ECSEnvironmentID

type ECSEnvironmentID string

func ClusterARNToECSEnvironmentID

func ClusterARNToECSEnvironmentID(arn string) ECSEnvironmentID

func (ECSEnvironmentID) AutoScalingGroupName

func (id ECSEnvironmentID) AutoScalingGroupName() string

func (ECSEnvironmentID) L0EnvironmentID

func (id ECSEnvironmentID) L0EnvironmentID() string

func (ECSEnvironmentID) LaunchConfigurationName

func (id ECSEnvironmentID) LaunchConfigurationName() string

func (ECSEnvironmentID) SecurityGroupName

func (id ECSEnvironmentID) SecurityGroupName() string

func (ECSEnvironmentID) String

func (id ECSEnvironmentID) String() string

we need to add a custom .String() function, or else string conversions add quotes

type ECSLoadBalancerID

type ECSLoadBalancerID string

func (ECSLoadBalancerID) L0LoadBalancerID

func (id ECSLoadBalancerID) L0LoadBalancerID() string

func (ECSLoadBalancerID) RoleName

func (id ECSLoadBalancerID) RoleName() string

func (ECSLoadBalancerID) SecurityGroupName

func (id ECSLoadBalancerID) SecurityGroupName() string

func (ECSLoadBalancerID) String

func (id ECSLoadBalancerID) String() string

we need to add a custom .String() function, or else string conversions add quotes

type ECSServiceID

type ECSServiceID string

func ServiceARNToECSServiceID

func ServiceARNToECSServiceID(arn string) ECSServiceID

func (ECSServiceID) L0ServiceID

func (id ECSServiceID) L0ServiceID() string

func (ECSServiceID) String

func (id ECSServiceID) String() string

we need to add a custom .String() function, or else string conversions add quotes

type ECSTaskID

type ECSTaskID string

func (ECSTaskID) L0TaskID

func (id ECSTaskID) L0TaskID() string

func (ECSTaskID) String

func (id ECSTaskID) String() string

we need to add a custom .String() function, or else string conversions add quotes

type L0DeployID

type L0DeployID string

func (L0DeployID) ECSDeployID

func (id L0DeployID) ECSDeployID() ECSDeployID

func (L0DeployID) String

func (id L0DeployID) String() string

we need to add a custom .String() function, or else string conversions add quotes

type L0EnvironmentID

type L0EnvironmentID string

func (L0EnvironmentID) ECSEnvironmentID

func (id L0EnvironmentID) ECSEnvironmentID() ECSEnvironmentID

func (L0EnvironmentID) String

func (id L0EnvironmentID) String() string

we need to add a custom .String() function, or else string conversions add quotes

type L0LoadBalancerID

type L0LoadBalancerID string

func (L0LoadBalancerID) ECSLoadBalancerID

func (id L0LoadBalancerID) ECSLoadBalancerID() ECSLoadBalancerID

func (L0LoadBalancerID) String

func (id L0LoadBalancerID) String() string

type L0ServiceID

type L0ServiceID string

func (L0ServiceID) ECSServiceID

func (id L0ServiceID) ECSServiceID() ECSServiceID

func (L0ServiceID) String

func (id L0ServiceID) String() string

we need to add a custom .String() function, or else string conversions add quotes

type L0TaskID

type L0TaskID string

func (L0TaskID) ECSTaskID

func (id L0TaskID) ECSTaskID() ECSTaskID

func (L0TaskID) String

func (id L0TaskID) String() string

we need to add a custom .String() function, or else string conversions add quotes

Jump to

Keyboard shortcuts

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