Documentation
¶
Index ¶
- func GetHashCode(i interface{}) string
- func GetLastChunkOfSlashed(s string) string
- func GetResourceKey(namespace, name string) string
- func ParseResourceID(ID string) (SubscriptionID, ResourceGroup, ResourceName)
- func ParseSubResourceID(ID string) (SubscriptionID, ResourceGroup, ResourceName, ResourceName)
- func PrettyJSON(js []byte, prefix string) ([]byte, error)
- func RandStringRunes(n int) string
- func RemoveDuplicateStrings(list []string) []string
- func ResourceGroupID(subscriptionID SubscriptionID, resourceGroup ResourceGroup) string
- func ResourceID(subscriptionID SubscriptionID, resourceGroup ResourceGroup, provider string, ...) string
- func Retry(totalRetryCount int, retryPause time.Duration, ...) (err error)
- func SaveToFile(fileName string, content []byte) (string, error)
- type ResourceGroup
- type ResourceName
- type Retriable
- type RetriableFunction
- type SubscriptionID
- type ThreadsafeMultiMap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetHashCode ¶
func GetHashCode(i interface{}) string
GetHashCode generates hashcode of given type
func GetLastChunkOfSlashed ¶
GetLastChunkOfSlashed splits a string by slash and returns the last chunk.
func GetResourceKey ¶
GetResourceKey generates the key in k8s format for a given resource
func ParseResourceID ¶
func ParseResourceID(ID string) (SubscriptionID, ResourceGroup, ResourceName)
ParseResourceID gets subscriptionId, resource group, resource name from resourceID
func ParseSubResourceID ¶
func ParseSubResourceID(ID string) (SubscriptionID, ResourceGroup, ResourceName, ResourceName)
ParseSubResourceID gets subscriptionId, resource group, resource name, sub resource name from resourceID
func PrettyJSON ¶
PrettyJSON Unmarshals and Marshall again with Indent so it is human readable
func RandStringRunes ¶
RandStringRunes generates n length random string
func RemoveDuplicateStrings ¶
RemoveDuplicates returns a copy of a slice with duplicates removed
func ResourceGroupID ¶
func ResourceGroupID(subscriptionID SubscriptionID, resourceGroup ResourceGroup) string
ResourceGroupID generates a resource group resource id
func ResourceID ¶
func ResourceID(subscriptionID SubscriptionID, resourceGroup ResourceGroup, provider string, resourceKind string, resourcePath string) string
ResourceID generates a resource id
func Retry ¶
func Retry(totalRetryCount int, retryPause time.Duration, retriableFunction RetriableFunction) (err error)
Retry retries retriableFunction for totalRetryCount times with a gap of retryPause. if retriableFunction returns boolean as false, then Retry will not retry and return error if retriableFunction returns boolean as true, then Retry will retry if fn returned an error if totalRetryCount is -1, then retry happen forever until one of the two above conditions are satisfied.
Types ¶
type ResourceGroup ¶
type ResourceGroup string
ResourceGroup is the resource group in which resource is deployed in the resourceID
type Retriable ¶
type Retriable bool
Retriable is returned by RetriableFunction and tells whether to retry the function or not.
type RetriableFunction ¶
RetriableFunction is function that can be retried
type SubscriptionID ¶
type SubscriptionID string
SubscriptionID is the subscription of the resource in the resourceID
type ThreadsafeMultiMap ¶
type ThreadsafeMultiMap interface {
Insert(key interface{}, value interface{})
Clear(key interface{})
Erase(key interface{}) bool
EraseValue(value interface{}) bool
ContainsPair(key interface{}, value interface{}) bool
ContainsValue(value interface{}) bool
}
ThreadsafeMultiMap is a thread safe implementation of a multimap.
func NewThreadsafeMultimap ¶
func NewThreadsafeMultimap() ThreadsafeMultiMap
NewThreadsafeMultimap creates a ThreadsafeMultiMap.