Documentation ¶
Index ¶
- Constants
- func CheckRequiredParameters(param string, badValue interface{}) (bool, error)
- func CoalesceObj(val interface{}, fallback func() interface{}) interface{}
- func CoalesceStr(val string, fallback string) string
- func GetDefaultHttpClient(logger *log.Logger) *retryablehttp.Client
- func GetEnv(key, fallback string) string
- func HasField(i interface{}, fieldName string) bool
- func MapToStringSlice(m map[string]string, separator string) []string
- func MustSetField(i interface{}, fieldName string, value interface{})
- func RandStringBytes(n int) string
- func RequiredFieldsCheck(obj interface{}, fields []string) (bool, error)
- func RequiredFieldsSet(obj interface{}, defaultValues map[string]interface{}) (bool, error)
- func RequiredFieldsSetWithDefaultValues(obj interface{}, fieldValues map[string]interface{}) (bool, error)
- func RequiredStringFieldsSet(obj interface{}, fields []string) (bool, error)
- func RequiredValueOptionsSet(obj interface{}, fieldValuesMap map[string][]interface{}) (bool, error)
- func RequiredValuesSet(obj interface{}, fieldValues map[string]interface{}) (bool, error)
- func TrimFileExtension(fileName string) string
- func TryGetFieldValue(i interface{}, fieldName string) (interface{}, bool)
- func TrySetField(i interface{}, fieldName string, value interface{}) (bool, error)
Constants ¶
View Source
const ( DefaultCDApiUrl = "/api" DefaultCacApiUrl = "/api/setup-as-code/yaml" DefaultNGApiUrl = "/ng/api" BaseUrl = "https://app.harness.io/gateway" GraphQLInvalidTokenErrorCode = "INVALID_TOKEN" )
Variables ¶
This section is empty.
Functions ¶
func CheckRequiredParameters ¶
func CoalesceObj ¶
func CoalesceObj(val interface{}, fallback func() interface{}) interface{}
func CoalesceStr ¶
func GetDefaultHttpClient ¶
func MustSetField ¶
func MustSetField(i interface{}, fieldName string, value interface{})
func RandStringBytes ¶
func RequiredFieldsCheck ¶
func RequiredFieldsSet ¶
func RequiredFieldsSetWithDefaultValues ¶
func RequiredFieldsSetWithDefaultValues(obj interface{}, fieldValues map[string]interface{}) (bool, error)
Takes an object with a list of field names and their default values. Returns true if the all of the fields are set with a non-default value. Example usage:
if ok, err := utils.RequiredFieldsSetWithDefaultValues(obj, map[string]interface{}{ "field1": "default1", "field2": "default2", }) if !ok { panic(err) }
func RequiredStringFieldsSet ¶
func RequiredValueOptionsSet ¶
func RequiredValuesSet ¶
func TrimFileExtension ¶
func TryGetFieldValue ¶
func TrySetField ¶
Types ¶
This section is empty.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.