helpers

package
v0.0.0-...-6806e21 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

copied from github.com/Azure/open-service-broker-azure/

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainsString

func ContainsString(slice []string, s string) bool

func FillWithRandom

func FillWithRandom(s string, maxLen int) string

PadRightWithRandom pads a string up to a maxLen with random characters

func FindBadChars

func FindBadChars(stack string) error

FindBadChars find the bad chars in a postgresql user

func FromBase64EncodedString

func FromBase64EncodedString(input string) string

FromBase64EncodedString can be used to decode a base64 encoded string into another string in the return.

func GenerateRandomPassword

func GenerateRandomPassword(n int) (string, error)

GenerateRandomPassword - helper function to generate random password for sql server

func GenerateRandomUsername

func GenerateRandomUsername(n int) string

GenerateRandomUsername - helper function to generate random username for sql server

func Hash256

func Hash256(i interface{}) string

Hash256 hashes the i argument to a sha265 string

func IsDeploymentComplete

func IsDeploymentComplete(status string) bool

IsDeploymentComplete will dtermine if the deployment is complete

func IsSQLAll

func IsSQLAll(privilege string) bool

Returns whether the string matches the special privilege value ALL.

func LabelsToTags

func LabelsToTags(in map[string]string) map[string]*string

LabelsToTags converts labels from a kube resource to the data structure expected by Azure for tags this function will translate characters that are not allows by Azure to "."s

func MakeResourceID

func MakeResourceID(subscriptionID string, resourceGroupName string, provider string, resourceType string, resourceName string, subResourceType string, subResourceName string) string

MakeResourceID can be used to construct a resource ID using the input segments Sample 1: /subscriptions/88fd8cb2-8248-499e-9a2d-4929a4b0133c/resourceGroups/resourcegroup-azure-operators/providers/Microsoft.Network/publicIPAddresses/azurepublicipaddress-sample-3 Sample 2: /subscriptions/88fd8cb2-8248-499e-9a2d-4929a4b0133c/resourceGroups/resourcegroup-azure-operators/providers/Microsoft.Network/virtualNetworks/vnet-sample-hpf-1/subnets/test2

func NewPassword

func NewPassword() string

NewPassword generates a strong, random password stolen from osba-azure

func RandomString

func RandomString(length int) string

func RemoveNonAlphaNumeric

func RemoveNonAlphaNumeric(s string) string

RemoveNonAlphaNumeric removes all runes that are not letters or digits

func RemoveString

func RemoveString(slice []string, s string) (result []string)

func ReplaceAny

func ReplaceAny(s string, chars []string) string

ReplaceAny replaces any instance of the strings passes in the chars slice replacing a backslash is problematic so it will require 4 eg []string{"\\\\"}

func Retry

func Retry(timeout time.Duration, sleep time.Duration, fn func() error) error

Types

type AADIdentity

type AADIdentity struct {
	IdentityName string
	ResourceId   string
	ClientID     string
}

type AADIdentityFinder

type AADIdentityFinder struct {
	// contains filtered or unexported fields
}

func NewAADIdentityFinder

func NewAADIdentityFinder(client client.Reader, namespace string) *AADIdentityFinder

func (*AADIdentityFinder) FindIdentity

func (a *AADIdentityFinder) FindIdentity(ctx context.Context) (*AADIdentity, error)

type SQLRoleDelta

type SQLRoleDelta struct {
	AddedRoles   map[string]struct{}
	DeletedRoles map[string]struct{}
}

func DiffCurrentAndExpectedSQLRoles

func DiffCurrentAndExpectedSQLRoles(currentRoles map[string]struct{}, expectedRoles map[string]struct{}) SQLRoleDelta

type Seeded

type Seeded struct {
	// contains filtered or unexported fields
}

Seeded contains a self-contained, seeded (math/rand).Rand. It allows you to generate random numbers in a concurrency-safe manner.

Create one of these with NewSeeded()

func NewSeeded

func NewSeeded() *Seeded

NewSeeded creates a new Seeded

func (*Seeded) Intn

func (s *Seeded) Intn(max int) int

Intn returns, as an int, a non-negative pseudo-random number in [0,n) from the internally held seeded random number generator.

It panics if n <= 0.

This function (and its documentation!) is similar to (math/rand).Intn(max)

type StopErr

type StopErr struct {
	Err error
}

func NewStop

func NewStop(e error) *StopErr

func (*StopErr) Error

func (s *StopErr) Error() string

Jump to

Keyboard shortcuts

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