automation

package
v1.1.9 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2025 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultRequestTimeout is the default timeout for API requests
	DefaultRequestTimeout = 30 * time.Second

	// DefaultOperationTimeout is the default timeout for CRUD operations
	DefaultOperationTimeout = 30 * time.Second
)

Variables

This section is empty.

Functions

func BuildFilter

func BuildFilter(field, value string) string

func BuildTagFilter

func BuildTagFilter(tag, value string) string

func DeleteWithFilter

func DeleteWithFilter[T any](finder func(*FilterOptions) ([]*T, error), deleter func(string) error, filter string, resourceType string) error

generic helper for bulk delete operations

func GetByID

func GetByID[T any](finder func(*FilterOptions) ([]*T, error), id string, resourceType string) (*T, error)

generic helper for GetByID operations

func GetByName

func GetByName[T any](finder func(*FilterOptions) ([]*T, error), name string, resourceType string) (*T, error)

generic helper for GetByName operations

Types

type AutomationError

type AutomationError struct {
	Type      ErrorType
	Resource  string
	Operation string
	Cause     error
}

func NewNotFoundError

func NewNotFoundError(resource, operation string, cause error) *AutomationError

func (*AutomationError) Error

func (e *AutomationError) Error() string

func (*AutomationError) IsNotFound

func (e *AutomationError) IsNotFound() bool

func (*AutomationError) IsRetryable

func (e *AutomationError) IsRetryable() bool

type BaseOptions

type BaseOptions struct {
	Name       string
	Tags       *Tags
	TagContext map[string]interface{}
	Timeout    time.Duration
}

func (*BaseOptions) GetTags

func (bo *BaseOptions) GetTags() *rest_model.Tags

func (*BaseOptions) GetTimeout

func (bo *BaseOptions) GetTimeout() time.Duration

type BaseResourceManager

type BaseResourceManager[T any] struct {
	// contains filtered or unexported fields
}

func NewBaseResourceManager

func NewBaseResourceManager[T any](ziti *ZitiAutomation) *BaseResourceManager[T]

func (*BaseResourceManager[T]) Context

func (brm *BaseResourceManager[T]) Context() context.Context

func (*BaseResourceManager[T]) Edge

type Config

type Config struct {
	ApiEndpoint string
	Username    string
	Password    string `dd:"+secret"`
}

type ConfigManager

type ConfigManager struct {
	*BaseResourceManager[rest_model.ConfigDetail]
}

func NewConfigManager

func NewConfigManager(ziti *ZitiAutomation) *ConfigManager

func (*ConfigManager) Create

func (cm *ConfigManager) Create(opts *ConfigOptions) (string, error)

func (*ConfigManager) Delete

func (cm *ConfigManager) Delete(id string) error

func (*ConfigManager) DeleteWithFilter

func (cm *ConfigManager) DeleteWithFilter(filter string) error

func (*ConfigManager) Find

func (*ConfigManager) GetByID

func (cm *ConfigManager) GetByID(id string) (*rest_model.ConfigDetail, error)

func (*ConfigManager) GetByName

func (cm *ConfigManager) GetByName(name string) (*rest_model.ConfigDetail, error)

func (*ConfigManager) Update

func (cm *ConfigManager) Update(id string, opts *ConfigOptions) error

type ConfigOptions

type ConfigOptions struct {
	BaseOptions
	ConfigTypeID string
	Data         interface{}
}

type ConfigTypeManager

type ConfigTypeManager struct {
	*BaseResourceManager[rest_model.ConfigTypeDetail]
}

func NewConfigTypeManager

func NewConfigTypeManager(ziti *ZitiAutomation) *ConfigTypeManager

func (*ConfigTypeManager) Create

func (ctm *ConfigTypeManager) Create(opts *ConfigTypeOptions) (string, error)

func (*ConfigTypeManager) Delete

func (ctm *ConfigTypeManager) Delete(id string) error

func (*ConfigTypeManager) DeleteWithFilter

func (ctm *ConfigTypeManager) DeleteWithFilter(filter string) error

func (*ConfigTypeManager) EnsureExists

func (ctm *ConfigTypeManager) EnsureExists(name string) (string, error)

func (*ConfigTypeManager) Find

func (*ConfigTypeManager) GetByID

func (*ConfigTypeManager) GetByName

func (ctm *ConfigTypeManager) GetByName(name string) (*rest_model.ConfigTypeDetail, error)

type ConfigTypeOptions

type ConfigTypeOptions struct {
	BaseOptions
	Schema interface{}
}

type EdgeRouterPolicyManager

type EdgeRouterPolicyManager struct {
	*BaseResourceManager[rest_model.EdgeRouterPolicyDetail]
}

func NewEdgeRouterPolicyManager

func NewEdgeRouterPolicyManager(ziti *ZitiAutomation) *EdgeRouterPolicyManager

func (*EdgeRouterPolicyManager) Create

func (*EdgeRouterPolicyManager) Delete

func (erpm *EdgeRouterPolicyManager) Delete(id string) error

func (*EdgeRouterPolicyManager) DeleteWithFilter

func (erpm *EdgeRouterPolicyManager) DeleteWithFilter(filter string) error

func (*EdgeRouterPolicyManager) Find

func (*EdgeRouterPolicyManager) GetByID

func (*EdgeRouterPolicyManager) GetByName

type EdgeRouterPolicyOptions

type EdgeRouterPolicyOptions struct {
	BaseOptions
	IdentityRoles   []string
	EdgeRouterRoles []string
	Semantic        rest_model.Semantic
}

type ErrorType

type ErrorType int
const (
	ErrorTypeNotFound ErrorType = iota
	ErrorTypePermission
	ErrorTypeValidation
	ErrorTypeNetwork
	ErrorTypeInternal
)

type FilterOptions

type FilterOptions struct {
	Filter  string
	Limit   int64
	Offset  int64
	Timeout time.Duration
}

func (*FilterOptions) GetLimit

func (fo *FilterOptions) GetLimit() int64

func (*FilterOptions) GetTimeout

func (fo *FilterOptions) GetTimeout() time.Duration

type IResourceManager

type IResourceManager[T any, CreateOpts any] interface {
	Create(opts CreateOpts) (string, error)
	Delete(id string) error
	Find(opts *FilterOptions) ([]*T, error)
	GetByID(id string) (*T, error)
	GetByName(name string) (*T, error)
}

type IdentityManager

type IdentityManager struct {
	*BaseResourceManager[rest_model.IdentityDetail]
}

func NewIdentityManager

func NewIdentityManager(ziti *ZitiAutomation) *IdentityManager

func (*IdentityManager) Create

func (im *IdentityManager) Create(opts *IdentityOptions) (string, error)

func (*IdentityManager) Delete

func (im *IdentityManager) Delete(id string) error

func (*IdentityManager) DeleteWithFilter

func (im *IdentityManager) DeleteWithFilter(filter string) error

func (*IdentityManager) Enroll

func (im *IdentityManager) Enroll(id string) (*ziti.Config, error)

func (*IdentityManager) Find

func (*IdentityManager) GetByID

func (*IdentityManager) GetByName

func (im *IdentityManager) GetByName(name string) (*rest_model.IdentityDetail, error)

type IdentityOptions

type IdentityOptions struct {
	BaseOptions
	Type           rest_model.IdentityType
	IsAdmin        bool
	RoleAttributes []string
}

type ServiceEdgeRouterPolicyManager

type ServiceEdgeRouterPolicyManager struct {
	*BaseResourceManager[rest_model.ServiceEdgeRouterPolicyDetail]
}

func NewServiceEdgeRouterPolicyManager

func NewServiceEdgeRouterPolicyManager(ziti *ZitiAutomation) *ServiceEdgeRouterPolicyManager

func (*ServiceEdgeRouterPolicyManager) Create

func (*ServiceEdgeRouterPolicyManager) Delete

func (serpm *ServiceEdgeRouterPolicyManager) Delete(id string) error

func (*ServiceEdgeRouterPolicyManager) DeleteWithFilter

func (serpm *ServiceEdgeRouterPolicyManager) DeleteWithFilter(filter string) error

func (*ServiceEdgeRouterPolicyManager) Find

func (*ServiceEdgeRouterPolicyManager) GetByID

func (*ServiceEdgeRouterPolicyManager) GetByName

type ServiceEdgeRouterPolicyOptions

type ServiceEdgeRouterPolicyOptions struct {
	BaseOptions
	ServiceRoles    []string
	EdgeRouterRoles []string
	Semantic        rest_model.Semantic
}

type ServiceManager

type ServiceManager struct {
	*BaseResourceManager[rest_model.ServiceDetail]
}

func NewServiceManager

func NewServiceManager(ziti *ZitiAutomation) *ServiceManager

func (*ServiceManager) Create

func (sm *ServiceManager) Create(opts *ServiceOptions) (string, error)

func (*ServiceManager) Delete

func (sm *ServiceManager) Delete(id string) error

func (*ServiceManager) DeleteWithFilter

func (sm *ServiceManager) DeleteWithFilter(filter string) error

func (*ServiceManager) Find

func (*ServiceManager) GetByID

func (sm *ServiceManager) GetByID(id string) (*rest_model.ServiceDetail, error)

func (*ServiceManager) GetByName

func (sm *ServiceManager) GetByName(name string) (*rest_model.ServiceDetail, error)

type ServiceOptions

type ServiceOptions struct {
	BaseOptions
	Configs            []string
	EncryptionRequired bool
	TerminatorStrategy string
	RoleAttributes     []string
	MaxIdleTime        *int64
}

type ServicePolicyManager

type ServicePolicyManager struct {
	*BaseResourceManager[rest_model.ServicePolicyDetail]
}

func NewServicePolicyManager

func NewServicePolicyManager(ziti *ZitiAutomation) *ServicePolicyManager

func (*ServicePolicyManager) Create

func (spm *ServicePolicyManager) Create(opts *ServicePolicyOptions) (string, error)

func (*ServicePolicyManager) CreateBind

func (spm *ServicePolicyManager) CreateBind(opts *ServicePolicyOptions) (string, error)

convenience methods for specific policy types

func (*ServicePolicyManager) CreateDial

func (spm *ServicePolicyManager) CreateDial(opts *ServicePolicyOptions) (string, error)

func (*ServicePolicyManager) Delete

func (spm *ServicePolicyManager) Delete(id string) error

func (*ServicePolicyManager) DeleteWithFilter

func (spm *ServicePolicyManager) DeleteWithFilter(filter string) error

func (*ServicePolicyManager) Find

func (*ServicePolicyManager) GetByID

func (*ServicePolicyManager) GetByName

type ServicePolicyOptions

type ServicePolicyOptions struct {
	BaseOptions
	IdentityRoles []string
	ServiceRoles  []string
	PolicyType    rest_model.DialBind
	Semantic      rest_model.Semantic
}

type Tags

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

func NewTags

func NewTags() *Tags

func ZrokAgentRemoteTags

func ZrokAgentRemoteTags(enrollmentToken, envZId string) *Tags

func ZrokShareTags

func ZrokShareTags(shareToken string) *Tags

func ZrokTags

func ZrokTags() *Tags

func (*Tags) ToRestModel

func (t *Tags) ToRestModel() *rest_model.Tags

func (*Tags) WithAgentRemote

func (t *Tags) WithAgentRemote(enrollmentToken, envZId string) *Tags

func (*Tags) WithEmail

func (t *Tags) WithEmail(email string) *Tags

func (*Tags) WithShareToken

func (t *Tags) WithShareToken(token string) *Tags

func (*Tags) WithTag

func (t *Tags) WithTag(key string, value interface{}) *Tags

func (*Tags) WithZrok

func (t *Tags) WithZrok() *Tags

type ZitiAutomation

type ZitiAutomation struct {
	Identities                *IdentityManager
	Services                  *ServiceManager
	Configs                   *ConfigManager
	ConfigTypes               *ConfigTypeManager
	EdgeRouterPolicies        *EdgeRouterPolicyManager
	ServiceEdgeRouterPolicies *ServiceEdgeRouterPolicyManager
	ServicePolicies           *ServicePolicyManager
	// contains filtered or unexported fields
}

func NewZitiAutomation

func NewZitiAutomation(cfg *Config) (*ZitiAutomation, error)

func (*ZitiAutomation) CleanupByTag

func (za *ZitiAutomation) CleanupByTag(tag, value string) error

func (*ZitiAutomation) Edge

func (*ZitiAutomation) IsNotFound

func (za *ZitiAutomation) IsNotFound(err error) bool

func (*ZitiAutomation) ShouldRetry

func (za *ZitiAutomation) ShouldRetry(err error) bool

Jump to

Keyboard shortcuts

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