utils

package
v6.5.3 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CertificateEndpoint = "artifactory/api/system/security/certificates/"
	KeypairEndPoint     = "artifactory/api/security/keypair/"
)

Variables

View Source
var CommaSeperatedList = validation.ToDiagFunc(
	validation.StringMatch(regexp.MustCompile(`.+(?:,.+)*`), "must be comma separated string"),
)
View Source
var GradleLikeRepoTypes = []string{
	"gradle",
	"sbt",
	"ivy",
}
View Source
var ProjectKeyValidator = validation.ToDiagFunc(
	validation.StringMatch(regexp.MustCompile(`^[a-z0-9]{3,10}$`), "project_key must be 3 - 10 lowercase alphanumeric characters"),
)

Functions

func AddAuthToResty

func AddAuthToResty(client *resty.Client, apiKey, accessToken string) (*resty.Client, error)

func BoolPtr

func BoolPtr(v bool) *bool

func BuildResty

func BuildResty(URL, version string) (*resty.Client, error)

func CastToInterfaceArr

func CastToInterfaceArr(arr []string) []interface{}

func CastToStringArr

func CastToStringArr(arr []interface{}) []string

func FormatCommaSeparatedString

func FormatCommaSeparatedString(thing interface{}) string

func GetDefaultRepoLayoutRef added in v6.5.2

func GetDefaultRepoLayoutRef(repositoryType string, packageType string) func() (interface{}, error)

Return the default repo layout by Repository Type & Package Type

func MergeSchema

func MergeSchema(schemata ...map[string]*schema.Schema) map[string]*schema.Schema

func NeverRetry

func NeverRetry(response *resty.Response, err error) bool

func RandBool

func RandBool() bool

func RandSelect

func RandSelect(items ...interface{}) interface{}

func RandomInt

func RandomInt() int

func RepoLayoutRefSchemaOverrideValidator

func RepoLayoutRefSchemaOverrideValidator(_ interface{}, _ cty.Path) diag.Diagnostics

func RetryOnMergeError added in v6.5.2

func RetryOnMergeError(response *resty.Response, _r error) bool

func ValidateCron

func ValidateCron(value interface{}, key string) (ws []string, es []error)

func ValidateIsEmail

func ValidateIsEmail(address interface{}, _ cty.Path) diag.Diagnostics

func ValidateLdapDn

func ValidateLdapDn(value interface{}, _ string) ([]string, []error)

func ValidateLdapFilter

func ValidateLdapFilter(value interface{}, _ string) ([]string, []error)

func ValidateLowerCase

func ValidateLowerCase(value interface{}, key string) (ws []string, es []error)

func VerifyKeyPair added in v6.5.2

func VerifyKeyPair(id string, request *resty.Request) (*resty.Response, error)

Types

type HclPredicate

type HclPredicate func(hcl string) bool

func SchemaHasKey

func SchemaHasKey(skeema map[string]*schema.Schema) HclPredicate

type Lens

type Lens func(key string, value interface{}) []error

func MkLens

func MkLens(d *schema.ResourceData) Lens

type ResourceData

type ResourceData struct{ *schema.ResourceData }

func (*ResourceData) GetBool

func (d *ResourceData) GetBool(key string, onlyIfChanged bool) bool

func (*ResourceData) GetBoolRef

func (d *ResourceData) GetBoolRef(key string, onlyIfChanged bool) *bool

func (*ResourceData) GetInt

func (d *ResourceData) GetInt(key string, onlyIfChanged bool) int

func (*ResourceData) GetList

func (d *ResourceData) GetList(key string) []string

func (*ResourceData) GetSet

func (d *ResourceData) GetSet(key string) []string

func (*ResourceData) GetString

func (d *ResourceData) GetString(key string, onlyIfChanged bool) string

type Schema

type Schema map[string]*schema.Schema

type SupportedRepoClasses added in v6.5.2

type SupportedRepoClasses struct {
	RepoLayoutRef      string
	SupportedRepoTypes map[string]bool
}

Jump to

Keyboard shortcuts

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