Documentation ¶
Index ¶
- Constants
- Variables
- func ClearLegacyID(v any) *string
- func Clone[T Settings](v T) (T, error)
- func FillDemoValues(settings Settings) []string
- func FindByName[T Settings](service RService[T], name string) (stub *api.Stub, err error)
- func FromJSON[T Settings](data []byte, v T) error
- func GetEnv(names ...string) string
- func GetFlawedReasons(settings any) []string
- func GetIntEnv(name string, def, min, max int) int
- func GetLegacyID(v any) *string
- func GetRestoreOnDelete(v any) *string
- func GetScope(settings Settings) string
- func HijackDuplicate(resourceNames ...string) bool
- func IsValidUUID(u string) bool
- func JoinID(id string, context string) string
- func LegacyID(id string) string
- func Name(v any, id string) string
- func NewSettings[T Settings](service RService[T]) T
- func Path(s string) func(args ...string) string
- func ReadUTF(reader io.Reader) (string, error)
- func RefersToMissingID(v any) bool
- func RejectDuplicate(resourceNames ...string) bool
- func SetID(settings Settings, id string)
- func SetLegacyID(id string, converter func(string) string, v any)
- func SetRestoreOnDelete(restore string, v any)
- func SetScope(settings Settings, scope string)
- func SplitID(id string) (string, string, bool)
- func SupportsFlawedReasons(settings any) bool
- func ToJSON[T Settings](v T) ([]byte, error)
- func UUIDToLong(uid uuid.UUID) (int64, error)
- func Validate(settings Settings) []string
- type CRUDService
- type ContextCreator
- type ContextDeleter
- type ContextGetter
- type ContextKey
- type ContextUpdater
- type Credentials
- type DemoSettings
- type ErrorSettings
- type GenericCRUDService
- func (me *GenericCRUDService[T]) Create(v Settings) (*api.Stub, error)
- func (me *GenericCRUDService[T]) CreateWithContext(ctx context.Context, v Settings) (*api.Stub, error)
- func (me *GenericCRUDService[T]) Delete(id string) error
- func (me *GenericCRUDService[T]) DeleteWithContext(ctx context.Context, id string) error
- func (me *GenericCRUDService[T]) Get(id string, v Settings) error
- func (me *GenericCRUDService[T]) GetWithContext(ctx context.Context, id string, v Settings) error
- func (me *GenericCRUDService[T]) List() (api.Stubs, error)
- func (me *GenericCRUDService[T]) Name() string
- func (me *GenericCRUDService[T]) NoCache() bool
- func (me *GenericCRUDService[T]) SchemaID() string
- func (me *GenericCRUDService[T]) Update(id string, v Settings) error
- func (me *GenericCRUDService[T]) UpdateWithContext(ctx context.Context, id string, v Settings) error
- func (me *GenericCRUDService[T]) Validate(v Settings) error
- type GenericRService
- type LegacyIDAware
- type Loader
- type NoCacheService
- type ObjectID
- type RService
- type RegexValidator
- type ScopeAware
- type Service
- type ServiceOptions
- func (me *ServiceOptions[T]) Hijack(fn func(err error, service RService[T], v T) (*api.Stub, error)) *ServiceOptions[T]
- func (me *ServiceOptions[T]) NoValidator() *ServiceOptions[T]
- func (me *ServiceOptions[T]) WithAfterCreate(fn func(client rest.Client, stub *api.Stub) (*api.Stub, error)) *ServiceOptions[T]
- func (me *ServiceOptions[T]) WithCompleteGet(fn func(client rest.Client, id string, v T) error) *ServiceOptions[T]
- func (me *ServiceOptions[T]) WithCreateConfirm(confirm int) *ServiceOptions[T]
- func (me *ServiceOptions[T]) WithCreateRetry(fn func(v T, err error) T) *ServiceOptions[T]
- func (me *ServiceOptions[T]) WithDeleteRetry(deleteRetry func(id string, err error) (bool, error)) *ServiceOptions[T]
- func (me *ServiceOptions[T]) WithDuplicates(fnDuplicates func(service RService[T], v T) (*api.Stub, error)) *ServiceOptions[T]
- func (me *ServiceOptions[T]) WithMutex(lock func(), unlock func()) *ServiceOptions[T]
- func (me *ServiceOptions[T]) WithOnBeforeUpdate(fn func(id string, v T) error) *ServiceOptions[T]
- func (me *ServiceOptions[T]) WithOnChanged(onChanged func(rest.Client, string, T) error) *ServiceOptions[T]
- func (me *ServiceOptions[T]) WithStubs(stubs api.RecordStubs) *ServiceOptions[T]
- type Settings
- type Storer
- type Validator
Constants ¶
View Source
const ContextKeyStateConfig = ContextKey("state-config")
View Source
const DYNATRACE_DUPLICATE_HIJACK = "DYNATRACE_DUPLICATE_HIJACK"
View Source
const DYNATRACE_DUPLICATE_REJECT = "DYNATRACE_DUPLICATE_REJECT"
View Source
const VALUE_ALL = "ALL"
Variables ¶
View Source
var LegacyLongDecode = func(id string) string { key := LegacyObjIDDecode(id) if len(key) == 0 { return key } uid, err := uuid.Parse(key) if err != nil { return err.Error() } result, err := UUIDToLong(uid) if err != nil { return err.Error() } return fmt.Sprintf("%v", result) }
Functions ¶
func ClearLegacyID ¶
func FillDemoValues ¶
func FindByName ¶
func GetFlawedReasons ¶
func GetLegacyID ¶
func GetRestoreOnDelete ¶ added in v1.22.0
func HijackDuplicate ¶ added in v1.23.0
func IsValidUUID ¶
func NewSettings ¶
func RefersToMissingID ¶ added in v1.42.0
func RejectDuplicate ¶ added in v1.23.0
func SetRestoreOnDelete ¶ added in v1.22.0
func SupportsFlawedReasons ¶
Types ¶
type CRUDService ¶
type CRUDService[T Settings] interface { List() (api.Stubs, error) Get(id string, v T) error SchemaID() string Create(v T) (*api.Stub, error) Update(id string, v T) error Delete(id string) error Name() string }
func NewCRUDService ¶
func NewCRUDService[T Settings](credentials *Credentials, schemaID string, options *ServiceOptions[T]) CRUDService[T]
type ContextCreator ¶ added in v1.45.0
type ContextDeleter ¶ added in v1.47.0
type ContextGetter ¶ added in v1.45.0
type ContextKey ¶ added in v1.45.0
type ContextKey string
type ContextUpdater ¶ added in v1.45.0
type Credentials ¶
type Credentials struct { URL string Token string IAM struct { ClientID string AccountID string ClientSecret string } Automation struct { ClientID string ClientSecret string TokenURL string EnvironmentURL string } Cluster struct { URL string Token string } }
func CreateCredentials ¶
func CreateCredentials() (*Credentials, error)
func CreateExportCredentials ¶ added in v1.22.0
func CreateExportCredentials() (*Credentials, error)
type DemoSettings ¶
type DemoSettings interface {
FillDemoValues() []string
}
type ErrorSettings ¶
type ErrorSettings struct {
Error error
}
func (*ErrorSettings) FillDemoValues ¶
func (me *ErrorSettings) FillDemoValues() []string
func (*ErrorSettings) MarshalHCL ¶
func (me *ErrorSettings) MarshalHCL(properties hcl.Properties) error
func (*ErrorSettings) UnmarshalHCL ¶
func (me *ErrorSettings) UnmarshalHCL(decoder hcl.Decoder) error
type GenericCRUDService ¶
type GenericCRUDService[T Settings] struct { Service CRUDService[T] }
func (*GenericCRUDService[T]) Create ¶
func (me *GenericCRUDService[T]) Create(v Settings) (*api.Stub, error)
func (*GenericCRUDService[T]) CreateWithContext ¶ added in v1.45.0
func (*GenericCRUDService[T]) Delete ¶
func (me *GenericCRUDService[T]) Delete(id string) error
func (*GenericCRUDService[T]) DeleteWithContext ¶ added in v1.47.0
func (me *GenericCRUDService[T]) DeleteWithContext(ctx context.Context, id string) error
func (*GenericCRUDService[T]) Get ¶
func (me *GenericCRUDService[T]) Get(id string, v Settings) error
func (*GenericCRUDService[T]) GetWithContext ¶ added in v1.45.0
func (*GenericCRUDService[T]) Name ¶ added in v1.28.0
func (me *GenericCRUDService[T]) Name() string
func (*GenericCRUDService[T]) NoCache ¶
func (me *GenericCRUDService[T]) NoCache() bool
func (*GenericCRUDService[T]) SchemaID ¶
func (me *GenericCRUDService[T]) SchemaID() string
func (*GenericCRUDService[T]) Update ¶
func (me *GenericCRUDService[T]) Update(id string, v Settings) error
func (*GenericCRUDService[T]) UpdateWithContext ¶ added in v1.45.0
func (*GenericCRUDService[T]) Validate ¶
func (me *GenericCRUDService[T]) Validate(v Settings) error
type GenericRService ¶
func (*GenericRService[T]) NoCache ¶
func (me *GenericRService[T]) NoCache() bool
func (*GenericRService[T]) SchemaID ¶
func (me *GenericRService[T]) SchemaID() string
type LegacyIDAware ¶
type NoCacheService ¶
type NoCacheService interface {
NoCache() bool
}
type ObjectID ¶
type RegexValidator ¶
type RegexValidator interface {
Validate() []string
}
type ScopeAware ¶ added in v1.19.0
type Service ¶
type Service[T Settings] interface { List() (api.Stubs, error) Get(id string, v T) error Create(v T) (*api.Stub, error) Update(id string, v T) error Delete(id string) error Validate(v T) error SchemaID() string Name() string }
func StaticService ¶
type ServiceOptions ¶
type ServiceOptions[T Settings] struct { Get func(args ...string) string List func(args ...string) string CreateURL func(v T) string ValidateURL func(v T) string UpdateURL func(id string, v T) string DeleteURL func(id string) string Stubs api.RecordStubs CompleteGet func(client rest.Client, id string, v T) error CreateRetry func(v T, err error) T OnAfterCreate func(client rest.Client, stub *api.Stub) (*api.Stub, error) DeleteRetry func(id string, err error) (bool, error) CreateConfirm int OnChanged func(rest.Client, string, T) error OnBeforeUpdate func(id string, v T) error HasNoValidator bool Name func(id string, v T) (string, error) HijackOnCreate func(err error, service RService[T], v T) (*api.Stub, error) Lock func() Unlock func() Duplicates func(service RService[T], v T) (*api.Stub, error) }
func DefaultServiceOptions ¶
func DefaultServiceOptions[T Settings](basePath string) *ServiceOptions[T]
func (*ServiceOptions[T]) Hijack ¶
func (me *ServiceOptions[T]) Hijack(fn func(err error, service RService[T], v T) (*api.Stub, error)) *ServiceOptions[T]
func (*ServiceOptions[T]) NoValidator ¶
func (me *ServiceOptions[T]) NoValidator() *ServiceOptions[T]
func (*ServiceOptions[T]) WithAfterCreate ¶ added in v1.36.0
func (me *ServiceOptions[T]) WithAfterCreate(fn func(client rest.Client, stub *api.Stub) (*api.Stub, error)) *ServiceOptions[T]
func (*ServiceOptions[T]) WithCompleteGet ¶ added in v1.36.0
func (me *ServiceOptions[T]) WithCompleteGet(fn func(client rest.Client, id string, v T) error) *ServiceOptions[T]
func (*ServiceOptions[T]) WithCreateConfirm ¶ added in v1.22.0
func (me *ServiceOptions[T]) WithCreateConfirm(confirm int) *ServiceOptions[T]
func (*ServiceOptions[T]) WithCreateRetry ¶
func (me *ServiceOptions[T]) WithCreateRetry(fn func(v T, err error) T) *ServiceOptions[T]
func (*ServiceOptions[T]) WithDeleteRetry ¶
func (me *ServiceOptions[T]) WithDeleteRetry(deleteRetry func(id string, err error) (bool, error)) *ServiceOptions[T]
func (*ServiceOptions[T]) WithDuplicates ¶ added in v1.23.0
func (me *ServiceOptions[T]) WithDuplicates(fnDuplicates func(service RService[T], v T) (*api.Stub, error)) *ServiceOptions[T]
func (*ServiceOptions[T]) WithMutex ¶
func (me *ServiceOptions[T]) WithMutex(lock func(), unlock func()) *ServiceOptions[T]
func (*ServiceOptions[T]) WithOnBeforeUpdate ¶
func (me *ServiceOptions[T]) WithOnBeforeUpdate(fn func(id string, v T) error) *ServiceOptions[T]
func (*ServiceOptions[T]) WithOnChanged ¶
func (me *ServiceOptions[T]) WithOnChanged(onChanged func(rest.Client, string, T) error) *ServiceOptions[T]
func (*ServiceOptions[T]) WithStubs ¶
func (me *ServiceOptions[T]) WithStubs(stubs api.RecordStubs) *ServiceOptions[T]
Source Files ¶
Click to show internal directories.
Click to hide internal directories.