machinepolicies

package
v2.62.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteByID

func DeleteByID(client newclient.Client, spaceID string, ID string) error

DeleteByID deletes a machine policy based on the provided ID.

func FromTimeSpan

func FromTimeSpan(timeSpan string) time.Duration

func Get

func Get(client newclient.Client, spaceID string, machinePoliciesQuery MachinePoliciesQuery) (*resources.Resources[*MachinePolicy], error)

Get returns a collection of machine policies based on the criteria defined by its input query parameter. If an error occurs, an empty collection is returned along with the associated error.

func ToTimeSpan

func ToTimeSpan(duration time.Duration) string

Types

type MachineCleanupPolicy

type MachineCleanupPolicy struct {
	DeleteMachinesBehavior        string        `json:"DeleteMachinesBehavior" validate:"required,oneof=DeleteUnavailableMachines DoNotDelete"`
	DeleteMachinesElapsedTimeSpan time.Duration `json:"DeleteMachinesElapsedTimeSpan,omitempty"`
}

func NewMachineCleanupPolicy

func NewMachineCleanupPolicy() *MachineCleanupPolicy

func (*MachineCleanupPolicy) MarshalJSON

func (m *MachineCleanupPolicy) MarshalJSON() ([]byte, error)

MarshalJSON returns a machine policy as its JSON encoding.

func (*MachineCleanupPolicy) UnmarshalJSON

func (m *MachineCleanupPolicy) UnmarshalJSON(data []byte) error

UnmarshalJSON sets this Kubernetes endpoint to its representation in JSON.

func (*MachineCleanupPolicy) Validate

func (m *MachineCleanupPolicy) Validate() error

Validate checks the state of the machine policy and returns an error if invalid.

type MachineConnectivityPolicy

type MachineConnectivityPolicy struct {
	MachineConnectivityBehavior string `json:"MachineConnectivityBehavior" validate:"oneof=ExpectedToBeOnline MayBeOfflineAndCanBeSkipped"`
}

func NewMachineConnectivityPolicy

func NewMachineConnectivityPolicy() *MachineConnectivityPolicy

type MachineHealthCheckPolicy

type MachineHealthCheckPolicy struct {
	BashHealthCheckPolicy       *MachineScriptPolicy `json:"BashHealthCheckPolicy" validate:"required"`
	HealthCheckCron             string               `json:"HealthCheckCron,omitempty"`
	HealthCheckCronTimezone     string               `json:"HealthCheckCronTimezone" validate:"required"`
	HealthCheckInterval         time.Duration        `json:"HealthCheckInterval,omitempty"`
	HealthCheckType             string               `json:"HealthCheckType" validate:"required,oneof=OnlyConnectivity RunScript"`
	PowerShellHealthCheckPolicy *MachineScriptPolicy `json:"PowerShellHealthCheckPolicy" validate:"required"`
}

func NewMachineHealthCheckPolicy

func NewMachineHealthCheckPolicy() *MachineHealthCheckPolicy

func (*MachineHealthCheckPolicy) MarshalJSON

func (m *MachineHealthCheckPolicy) MarshalJSON() ([]byte, error)

MarshalJSON returns a machine health check policy as its JSON encoding.

func (*MachineHealthCheckPolicy) UnmarshalJSON

func (m *MachineHealthCheckPolicy) UnmarshalJSON(data []byte) error

UnmarshalJSON sets this machine health check policy to its representation in JSON.

func (*MachineHealthCheckPolicy) Validate

func (m *MachineHealthCheckPolicy) Validate() error

Validate checks the state of the machine health check policy and returns an error if invalid.

type MachinePoliciesQuery

type MachinePoliciesQuery struct {
	IDs         []string `uri:"ids,omitempty" url:"ids,omitempty"`
	PartialName string   `uri:"partialName,omitempty" url:"partialName,omitempty"`
	Skip        int      `uri:"skip,omitempty" url:"skip,omitempty"`
	Take        int      `uri:"take,omitempty" url:"take,omitempty"`
}

type MachinePolicy

type MachinePolicy struct {
	ConnectionConnectTimeout                      time.Duration              `json:"ConnectionConnectTimeout" validate:"required,min=10s"`
	ConnectionRetryCountLimit                     int32                      `json:"ConnectionRetryCountLimit" validate:"required,gte=2"`
	ConnectionRetrySleepInterval                  time.Duration              `json:"ConnectionRetrySleepInterval" validate:"required"`
	ConnectionRetryTimeLimit                      time.Duration              `json:"ConnectionRetryTimeLimit" validate:"required,min=10s"`
	Description                                   string                     `json:"Description,omitempty"`
	IsDefault                                     bool                       `json:"IsDefault"`
	MachineCleanupPolicy                          *MachineCleanupPolicy      `json:"MachineCleanupPolicy"`
	MachineConnectivityPolicy                     *MachineConnectivityPolicy `json:"MachineConnectivityPolicy"`
	MachineHealthCheckPolicy                      *MachineHealthCheckPolicy  `json:"MachineHealthCheckPolicy"`
	MachineUpdatePolicy                           *MachineUpdatePolicy       `json:"MachineUpdatePolicy"`
	Name                                          string                     `json:"Name" validate:"required,notblank"`
	PollingRequestMaximumMessageProcessingTimeout time.Duration              `json:"PollingRequestMaximumMessageProcessingTimeout,omitempty"`
	PollingRequestQueueTimeout                    time.Duration              `json:"PollingRequestQueueTimeout" validate:"required"`
	SpaceID                                       string                     `json:"SpaceId,omitempty"`

	resources.Resource
}

func Add

func Add(client newclient.Client, machinePolicy *MachinePolicy) (*MachinePolicy, error)

Add creates a new machine policy.

func GetAll added in v2.34.0

func GetAll(client newclient.Client, spaceID string) ([]*MachinePolicy, error)

GetAll returns all machine policies. If none can be found or an error occurs, it returns an empty collection.

func GetByID

func GetByID(client newclient.Client, spaceID string, id string) (*MachinePolicy, error)

GetByID returns the machine policy that matches the input ID. If one cannot be found, it returns nil and an error.

func NewMachinePolicy

func NewMachinePolicy(name string) *MachinePolicy

func Update

func Update(client newclient.Client, machinePolicy *MachinePolicy) (*MachinePolicy, error)

Update modifies a machine policy based on the one provided as input.

func (*MachinePolicy) MarshalJSON

func (m *MachinePolicy) MarshalJSON() ([]byte, error)

MarshalJSON returns a machine policy as its JSON encoding.

func (*MachinePolicy) UnmarshalJSON

func (m *MachinePolicy) UnmarshalJSON(data []byte) error

UnmarshalJSON sets this Kubernetes endpoint to its representation in JSON.

func (*MachinePolicy) Validate

func (m *MachinePolicy) Validate() error

Validate checks the state of the machine policy and returns an error if invalid.

type MachineScriptPolicy

type MachineScriptPolicy struct {
	RunType    string  `json:"RunType" validate:"required,oneof=InheritFromDefault Inline OnlyConnectivity"`
	ScriptBody *string `json:"ScriptBody"`
}

func NewMachineScriptPolicy

func NewMachineScriptPolicy() *MachineScriptPolicy

type MachineUpdatePolicy

type MachineUpdatePolicy struct {
	CalamariUpdateBehavior        string `json:"CalamariUpdateBehavior" validate:"required,oneof=UpdateAlways UpdateOnDeployment UpdateOnNewMachine"`
	TentacleUpdateAccountID       string `json:"TentacleUpdateAccountId,omitempty"`
	TentacleUpdateBehavior        string `json:"TentacleUpdateBehavior" validate:"required,oneof=NeverUpdate Update"`
	KubernetesAgentUpdateBehavior string `json:"KubernetesAgentUpdateBehavior" validate:"required,oneof=NeverUpdate Update"`
}

func NewMachineUpdatePolicy

func NewMachineUpdatePolicy() *MachineUpdatePolicy

Jump to

Keyboard shortcuts

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