acloudapi

package
v0.4.4 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	HeaderAccept      = "Accept"
	HeaderContentType = "Content-Type"
	HeaderUserAgent   = "User-Agent"

	ContentTypeApplicationJson = "application/json"

	DefaultPublicAPIUrl = "https://api.avisi.cloud"
	DefaultUserAgent    = "client-go"
	// DefaultRequestTimeout is the default request timeout for API calls
	DefaultRequestTimeout = 15 * time.Second
)
View Source
const (
	MAX_PAGING_LOOPS = 100
)

Variables

View Source
var (
	ErrMaximumPagingLoopsExceeded = fmt.Errorf("exceeded maximum paging loops")
)

Functions

func BoolPointer

func BoolPointer(b bool) *bool

func False

func False() *bool

func FixCluster

func FixCluster(cluster *Cluster, org string)

func FixStatus

func FixStatus(status string) string

func GetClusterOptsToQueryParams

func GetClusterOptsToQueryParams(opts []GetClusterOpts, defaults GetClusterOpts) string

func GetRestyClient

func GetRestyClient(authenticator Authenticator, opts ClientOpts) *resty.Client

func ListScheduledClusterUpgradesOptsToQueryParams added in v0.4.3

func ListScheduledClusterUpgradesOptsToQueryParams(opts []ListScheduledClusterUpgradesOpts, defaults ListScheduledClusterUpgradesOpts) string

func MarshalPagedResultContent

func MarshalPagedResultContent[T any](pagedResult PagedResult) ([]T, error)

func NewDefaultRestyClient

func NewDefaultRestyClient(authenticator Authenticator, opts ClientOpts, client *resty.Client) *resty.Client

func OptionalQueryParams

func OptionalQueryParams(queryParams string) string

func SortClusters

func SortClusters(clusters []Cluster)

SortClusters sorts a slice of clusters on CustomerSlug, EnvironmentSlug and then ClusterSlug

func SortNodePools

func SortNodePools(nodePools []NodePool)

SortNodePools sorts a slice of NodePools by CustomerSlug, EnvironmentSlug, ClusterSlug and then NodePool name

func True

func True() *bool

Types

type APIAddon

type APIAddon struct {
	Enabled      bool              `json:"enabled" yaml:"Enabled"`
	CustomValues map[string]string `json:"customValues,omitempty" yaml:"CustomValues,omitempty"`
}

APIAddon represents an API addon.

type AdminClient

func NewAdminClient

func NewAdminClient(authenticator Authenticator, opts ClientOpts) AdminClient

type AdminClusterAPI

type AdminClusterAPI interface {
	GetCluster(ctx context.Context, clusterIdentity string, opts ...GetClusterOpts) (*Cluster, error)
	ListClusters(ctx context.Context, opts ...GetClusterOpts) ([]Cluster, error)
	UpdateCluster(ctx context.Context, request AdminUpdateClusterRequest) (*Cluster, error)
}

type AdminOrganisation

type AdminOrganisation struct {
	ID                                  string    `json:"id"`
	Name                                string    `json:"name"`
	VatCode                             string    `json:"vatCode"`
	ContactEmail                        string    `json:"contactEmail"`
	BillingEmail                        string    `json:"billingEmail"`
	VatCodeValidated                    bool      `json:"vatCodeValidated"`
	VatCodeValidatedAt                  time.Time `json:"vatCodeValidatedAt"`
	PhoneNumber                         string    `json:"phoneNumber"`
	CreatedAt                           time.Time `json:"createdAt"`
	AcceptedTerms                       bool      `json:"acceptedTerms"`
	AcceptedTermsAt                     time.Time `json:"acceptedTermsAt"`
	RestrictedToAvailableCloudProviders bool      `json:"restrictedToAvailableCloudProviders"`
	StripeCustomer                      string    `json:"stripeCustomer"`
	Slug                                string    `json:"slug"`
}

type AdminOrganisationAPI

type AdminOrganisationAPI interface {
	GetOrganisation(ctx context.Context, organisationIdentity string) (*AdminOrganisation, error)
}

type AdminScheduledClusterUpgradesAPI added in v0.4.3

type AdminScheduledClusterUpgradesAPI interface {
	ListScheduledClusterUpgrades(ctx context.Context, opts ...ListScheduledClusterUpgradesOpts) ([]ScheduledClusterUpgrade, error)
	GetScheduledClusterUpgrade(ctx context.Context, identity string) (*ScheduledClusterUpgrade, error)
	CancelScheduledClusterUpgrade(ctx context.Context, identity string) (*ScheduledClusterUpgrade, error)
	CreateScheduledClusterUpgrade(ctx context.Context, request CreateScheduledClusterUpgradeRequest) (*ScheduledClusterUpgrade, error)
	UpdateScheduledClusterUpgrade(ctx context.Context, request UpdateScheduledClusterUpgradeRequest) (*ScheduledClusterUpgrade, error)
}

type AdminUpdateChannelsAPI added in v0.4.3

type AdminUpdateChannelsAPI interface {
	ListUpdateChannels(ctx context.Context) ([]UpdateChannelResponse, error)
}

type AdminUpdateClusterRequest added in v0.4.3

type AdminUpdateClusterRequest struct {
	ClusterIdentity string `json:"clusterIdentity"`
	Version         string `json:"version"`
}

type Authenticator

type Authenticator interface {
	Authenticate(c *resty.Client, r *resty.Request) error
}

func NewPersonalAccessTokenAuthenticator

func NewPersonalAccessTokenAuthenticator(token string) Authenticator

type AvailabilityZone

type AvailabilityZone struct {
	ID         int       `json:"id" yaml:"Id"`
	Name       string    `json:"name" yaml:"Name"`
	Slug       string    `json:"slug" yaml:"Slug"`
	CreatedAt  time.Time `json:"createdAt" yaml:"CreatedAt"`
	ModifiedAt time.Time `json:"modifiedAt" yaml:"ModifiedAt"`
}

type ClientOpts

type ClientOpts struct {
	// Debug is ... TODO
	Debug bool

	// Trace is ... TODO
	Trace bool

	// DebugShowAuthorizationHeader is  ... TODO
	DebugShowAuthorizationHeader bool

	// APIUrl is the URL of the public api
	APIUrl string

	// UserAgent
	UserAgent string

	// CustomResty sets a custom Resty client
	CustomResty *resty.Client

	// CustomDialer sets a custom net.Dialer on the http.Transport
	//
	// note: only used if CustomResty and CustomTransport are not provided
	CustomDialer *net.Dialer

	// CustomTransport set a custom http.Transport on the Resty client
	//
	// note: only used if CustomResty is not provided
	CustomTransport *http.Transport
}

func SetMissingOpts

func SetMissingOpts(opts ClientOpts) ClientOpts

type CloudAccount

type CloudAccount struct {
	Identity                        string            `json:"identity"`
	DisplayName                     string            `json:"displayName"`
	Metadata                        map[string]string `json:"metadata"`
	CloudProfile                    CloudProfile      `json:"cloudProfile"`
	Enabled                         bool              `json:"enabled"`
	PrimaryCloudCredentialsIdentity string            `json:"primaryCloudCredentialsIdentity"`
}

type CloudAccountAPI

type CloudAccountAPI interface {
	GetCloudAccounts(ctx context.Context, organisationSlug string) ([]CloudAccount, error)
}

type CloudAccountReference

type CloudAccountReference struct {
	Identity    string `json:"identity" yaml:"Identity"`
	DisplayName string `json:"displayName" yaml:"DisplayName"`
}

CloudAccountReference represents a reference to a cloud account.

type CloudAccountsAPI

type CloudAccountsAPI interface {
	GetCloudAccounts(ctx context.Context, org string) ([]CloudAccount, error)
	FindCloudAccountByName(ctx context.Context, org, name, cloudProvider string) (*CloudAccount, error)
}

type CloudCredentialsReference

type CloudCredentialsReference struct {
	Identity    string `json:"identity" yaml:"Identity"`
	DisplayName string `json:"displayName" yaml:"DisplayName"`
}

CloudCredentialsReference represents a reference to cloud credentials.

type CloudProfile

type CloudProfile struct {
	Identity      string            `json:"identity"`
	DisplayName   string            `json:"displayName"`
	Metadata      map[string]string `json:"metadata"`
	CloudProvider string            `json:"cloudProvider"`
	Regions       []string          `json:"regions"`
	Enabled       bool              `json:"enabled"`
	Public        bool              `json:"public"`
	Type          string            `json:"type"`

	CloudProviderResponse        CloudProvider `json:"cloudProviderResponse"`
	CloudProviderRegionResponses []Region      `json:"cloudProviderRegionResponses"`
}

type CloudProvider

type CloudProvider struct {
	ID         int       `json:"id" yaml:"Id"`
	Name       string    `json:"name" yaml:"Name"`
	Slug       string    `json:"slug" yaml:"Slug"`
	Available  bool      `json:"available" yaml:"Available"`
	CreatedAt  time.Time `json:"createdAt" yaml:"CreatedAt"`
	ModifiedAt time.Time `json:"modifiedAt" yaml:"ModifiedAt"`
}

type CloudProvidersAPI

type CloudProvidersAPI interface {
	GetCloudProviders(ctx context.Context, organisationSlug string) ([]CloudProvider, error)
	GetRegions(ctx context.Context, organisationSlug, cloudProviderSlug string) ([]Region, error)
	GetAvailabilityZones(ctx context.Context, organisationSlug, cloudProviderSlug, regionSlug string) ([]AvailabilityZone, error)
	GetNodeTypes(ctx context.Context, cloudProviderSlug string) ([]NodeType, error)
}

type Cluster

type Cluster struct {
	Name                    string                     `json:"name" yaml:"Name"`
	Identity                string                     `json:"identity" yaml:"Identity"`
	EnvironmentIdentity     string                     `json:"environmentIdentity" yaml:"EnvironmentIdentity"`
	EnvironmentSlug         string                     `json:"environmentSlug" yaml:"EnvironmentSlug"`
	CustomerIdentity        string                     `json:"customerIdentity" yaml:"CustomerIdentity"`
	CustomerSlug            string                     `json:"customerSlug" yaml:"CustomerSlug"`
	Slug                    string                     `json:"slug" yaml:"Slug"`
	CNI                     string                     `json:"cni" yaml:"CNI"`
	Description             string                     `json:"description" yaml:"Description,omitempty"`
	CloudProvider           string                     `json:"cloudProvider" yaml:"CloudProvider"`
	CloudAccount            *CloudAccountReference     `json:"cloudAccount" yaml:"CloudAccount,omitempty"`
	CloudCredentials        *CloudCredentialsReference `json:"cloudCredentials" yaml:"CloudCredentials,omitempty"`
	Region                  string                     `json:"region" yaml:"Region"`
	Version                 string                     `json:"version" yaml:"Version"`
	UpdateChannel           *UpdateChannelResponse     `json:"updateChannel" yaml:"UpdateChannel,omitempty"`
	AutoUpgrade             bool                       `json:"autoUpgrade" yaml:"AutoUpgrade"`
	HighlyAvailable         bool                       `json:"highlyAvailable" yaml:"HighlyAvailable"`
	EnableNetworkEncryption bool                       `json:"enableNetworkEncryption" yaml:"EnableNetworkEncryption"`
	// Deprecated: replaced by PodSecurityStandardsProfile which offers support for selecting a specific default PSS profile. This setting does not do anything since Kubernetes v1.23
	EnablePodSecurityStandards   bool                   `json:"enablePodSecurityStandards" yaml:"EnablePodSecurityStandards"`
	PodSecurityStandardsProfile  string                 `json:"podSecurityStandardsProfile" yaml:"PodSecurityStandardsProfile"`
	EnableMultiAvailAbilityZones bool                   `json:"enableMultiAvailabilityZones" yaml:"EnableMultiAvailabilityZones"`
	EnableNATGateway             bool                   `json:"enableNATGateway" yaml:"EnableNATGateway"`
	Status                       string                 `json:"status" yaml:"Status,omitempty"`
	DesiredStatus                string                 `json:"desiredStatus" yaml:"-"` // TODO: hidden for now in yaml since it is confusing
	ProvisionStatus              ClusterProvisionStatus `json:"provisionStatus" yaml:"ProvisionStatus"`
	CreatedAt                    time.Time              `json:"createdAt" yaml:"CreatedAt"`
	ModifiedAt                   time.Time              `json:"modifiedAt" yaml:"ModifiedAt"`
	DeletedAt                    *time.Time             `json:"deletedAt" yaml:"DeletedAt,omitempty"`
	Memory                       int                    `json:"memory" yaml:"Memory"`
	CPU                          int                    `json:"cpu" yaml:"CPU"`
	IPWhitelist                  []IpWhitelistResponse  `json:"ipWhitelist" yaml:"IPWhitelist,omitempty"`
	AmeOIDC                      bool                   `json:"ameOIDC" yaml:"AmeOIDC"`
	DeleteProtection             bool                   `json:"deleteProtection" yaml:"DeleteProtection"`
	Addons                       map[string]APIAddon    `json:"addons" yaml:"Addons,omitempty"`
	ObservabilityTenant          *ObservabilityTenant   `json:"observabilityTenant,omitempty" yaml:"ObservabilityTenant,omitempty"`
	EnvironmentPrometheusRules   bool                   `json:"environmentPrometheusRules" yaml:"EnvironmentPrometheusRules"`
	MaintenanceSchedule          *MaintenanceSchedule   `json:"maintenanceSchedule,omitempty" yaml:"MaintenanceSchedule,omitempty"`
}

Cluster represents the Cluster resource in the Avisi Cloud API

func (Cluster) FullIdentifier

func (c Cluster) FullIdentifier() string

FullIdentifier returns the cluster identifier including its cluster-identity in the form of {organisation-slug}/{environment-slug}/{cluster-slug} ({cluster-identity})

func (Cluster) Identifier

func (c Cluster) Identifier() string

Identifier returns the cluster identifier in the form of {organisation-slug}/{environment-slug}/{cluster-slug}

type ClusterAPI

type ClusterAPI interface {
	GetClusters(ctx context.Context, opts ...GetClusterOpts) ([]Cluster, error)
	GetClustersByOrg(ctx context.Context, organisationSlug string, opts ...GetClusterOpts) ([]Cluster, error)
	GetClustersByOrgAndEnv(ctx context.Context, organisationSlug, environmentSlug string, opts ...GetClusterOpts) ([]Cluster, error)

	GetCluster(ctx context.Context, organisationSlug, environmentSlug, cluster string, opts ...GetClusterOpts) (*Cluster, error)
	GetClusterOIDCConfig(ctx context.Context, organisationSlug, environmentSlug, clusterSlug string) (*ClusterMetadataResponse, error)

	CreateCluster(ctx context.Context, organisationSlug, environmentSlug string, create CreateCluster) (*Cluster, error)
	UpdateCluster(ctx context.Context, organisationSlug, environmentSlug, clusterSlug string, update UpdateCluster) (*Cluster, error)
	DeleteCluster(ctx context.Context, organisationSlug, environmentSlug, clusterSlug string, update UpdateCluster) error
}

type ClusterMetadataResponse

type ClusterMetadataResponse struct {
	Endpoint      string `json:"endpoint" yaml:"Endpoint"`
	CACertificate string `json:"caCertificate" yaml:"CaCertificate"`
	ClientID      string `json:"clientId" yaml:"ClientId"`
	ClientSecret  string `json:"clientSecret" yaml:"ClientSecret"`
	IssuerUrl     string `json:"issuerUrl" yaml:"IssuerUrl"`
}

type ClusterProvisionStatus

type ClusterProvisionStatus string

ClusterProvisionStatus represents the status of a cluster provision process.

const (
	UNKNOWN                        ClusterProvisionStatus = "UNKNOWN"
	ACCEPTED                       ClusterProvisionStatus = "ACCEPTED"
	OIDC_PROVISIONED               ClusterProvisionStatus = "OIDC_PROVISIONED"
	CLUSTER_PROVISIONED            ClusterProvisionStatus = "CLUSTER_PROVISIONED"
	INITIAL_NODE_POOLS_PROVISIONED ClusterProvisionStatus = "INITIAL_NODE_POOLS_PROVISIONED"
	INITIAL_ADDONS_PROVISIONED     ClusterProvisionStatus = "INITIAL_ADDONS_PROVISIONED"
	DONE                           ClusterProvisionStatus = "DONE"
)

type ClusterVersion

type ClusterVersion struct {
	Version string `json:"version" yaml:"Version"`
}

type ClusterVersionAPI

type ClusterVersionAPI interface {
	GetClusterVersions(ctx context.Context) ([]ClusterVersion, error)
}

type CreateCluster

type CreateCluster struct {
	Name                 string `json:"name" yaml:"Name"`
	EnvironmentID        string `json:"environmentId" yaml:"EnvironmentId"`
	Description          string `json:"description,omitempty" yaml:"Description,omitempty"`
	CloudAccountIdentity string `json:"cloudAccountIdentity" yaml:"CloudAccountIdentity"`
	Region               string `json:"region" yaml:"Region"`

	Version       string `json:"version,omitempty" yaml:"Version,omitempty"`
	UpdateChannel string `json:"updateChannel,omitempty" yaml:"UpdateChannel,omitempty"`
	CNI           string `json:"cni,omitempty" yaml:"CNI,omitempty"`

	EnableNATGateway             bool   `json:"enableNATGateway" yaml:"EnableNATGateway"`
	EnableNetworkEncryption      bool   `json:"enableNetworkEncryption" yaml:"EnableNetworkEncryption"`
	EnablePodSecurityStandards   bool   `json:"enablePodSecurityStandards" yaml:"EnablePodSecurityStandards"`
	PodSecurityStandardsProfile  string `json:"podSecurityStandardsProfile,omitempty" yaml:"PodSecurityStandardsProfile,omitempty"`
	EnableMultiAvailabilityZones bool   `json:"enableMultiAvailabilityZones" yaml:"EnableMultiAvailabilityZones"`
	EnableAutoUpgrade            bool   `json:"enableAutoUpgrade" yaml:"EnableAutoUpgrade"`
	EnableHighAvailability       bool   `json:"enableHighAvailability" yaml:"EnableHighAvailability"`

	ServiceSubnet    string `json:"serviceSubnet,omitempty" yaml:"ServiceSubnet,omitempty"`
	ClusterPodSubnet string `json:"clusterPodSubnet,omitempty" yaml:"ClusterPodSubnet,omitempty"`

	NodePools   []NodePools         `json:"nodePools" yaml:"NodePools"`
	IPWhitelist []IPWhitelistEntry  `json:"ipWhitelist,omitempty" yaml:"IpWhitelist,omitempty"`
	Addons      map[string]APIAddon `json:"addons,omitempty" yaml:"Addons,omitempty"`
}

CreateCluster represents the configuration for creating a cluster.

type CreateEnvironment

type CreateEnvironment struct {
	Name        string `json:"name" yaml:"Name"`
	Purpose     string `json:"purpose" yaml:"Purpose"`
	Type        string `json:"type" yaml:"Type"`
	Description string `json:"description" yaml:"Description"`
}

type CreateNodePool

type CreateNodePool struct {
	Name                string            `json:"name" yaml:"Name"`
	AvailabilityZone    string            `json:"availabilityZone,omitempty" yaml:"AvailabilityZone,omitempty"`
	NodeSize            string            `json:"nodeSize" yaml:"NodeSize"`
	MinSize             int               `json:"minSize" yaml:"MinSize"`
	MaxSize             int               `json:"maxSize" yaml:"MaxSize"`
	AutoScaling         bool              `json:"autoScaling" yaml:"AutoScaling"`
	NodeAutoReplacement bool              `json:"enableNodeAutoReplacement" yaml:"EnableNodeAutoReplacement"`
	Annotations         map[string]string `json:"annotations" yaml:"Annotations"`
	Labels              map[string]string `json:"labels" yaml:"Labels"`
	Taints              []NodeTaint       `json:"taints" yaml:"Taints"`
}

CreateNodePool represents the configuration for creating a node pool.

type CreateScheduledClusterUpgradeRequest added in v0.4.3

type CreateScheduledClusterUpgradeRequest struct {
	ClusterIdentity    string    `json:"clusterIdentity"`
	WindowStart        time.Time `json:"windowStart"`
	WindowEnd          time.Time `json:"windowEnd"`
	FromClusterVersion string    `json:"fromClusterVersion"`
	ToClusterVersion   string    `json:"toClusterVersion"`
}

type CreateSilence added in v0.2.2

type CreateSilence struct {
	Matchers []SilenceMatcher `json:"matchers" yaml:"Matchers"`
	StartsAt time.Time        `json:"startsAt" yaml:"StartsAt"`
	EndsAt   time.Time        `json:"endsAt" yaml:"EndsAt"`
	Comment  string           `json:"comment" yaml:"Comment"`
}

type Environment

type Environment struct {
	ID               int        `json:"id" yaml:"Id"`
	Name             string     `json:"name" yaml:"Name"`
	Purpose          string     `json:"purpose" yaml:"Purpose"`
	Type             string     `json:"type" yaml:"Type"`
	Description      string     `json:"description" yaml:"Description"`
	CreatedAt        time.Time  `json:"createdAt" yaml:"CreatedAt"`
	ModifiedAt       time.Time  `json:"modifiedAt" yaml:"ModifiedAt"`
	DeletedAt        *time.Time `json:"deletedAt" yaml:"DeletedAt"`
	TotalClusters    int        `json:"totalClusters" yaml:"TotalClusters"`
	TotalCPU         int        `json:"totalCpu" yaml:"TotalCpu"`
	TotalMemory      int        `json:"totalMemory" yaml:"TotalMemory"`
	Slug             string     `json:"slug" yaml:"Slug"`
	OrganisationSlug string     `json:"organisationSlug" yaml:"OrganisationSlug"`
}

type EnvironmentsAPI

type EnvironmentsAPI interface {
	GetEnvironment(ctx context.Context, org, env string) (*Environment, error)
	CreateEnvironment(ctx context.Context, createEnvironment CreateEnvironment, org string) (*Environment, error)
	UpdateEnvironment(ctx context.Context, updateEnvironment UpdateEnvironment, org, env string) (*Environment, error)
	DeleteEnvironment(ctx context.Context, org, env string) error
	GetEnvironments(ctx context.Context, organisationSlug string) ([]Environment, error)
}

type Error

type Error struct {
	Message string `json:"message"`
}

type GetClusterOpts

type GetClusterOpts struct {
	IncludeDetails *bool
	ShowCompute    *bool
	HideDeleted    *bool // admin-api only
}

type IPWhitelistEntry

type IPWhitelistEntry struct {
	Cidr        string `json:"cidr" yaml:"Cidr"`
	Description string `json:"description,omitempty" yaml:"Description,omitempty"`
}

IPWhitelistEntry represents an entry in the IP whitelist.

type IpWhitelistResponse

type IpWhitelistResponse struct {
	Cidr        string `json:"cidr" yaml:"Cidr"`
	Description string `json:"description" yaml:"Description"`
}

IpWhitelistResponse represents the response structure for IP whitelist information.

type ListScheduledClusterUpgradesOpts added in v0.4.3

type ListScheduledClusterUpgradesOpts struct {
	ClusterIdentities []string
	Statuses          []ScheduledClusterUpgradeStatus
}

type MaintenanceSchedule added in v0.4.3

type MaintenanceSchedule struct {
	Identity           string              `json:"identity" yaml:"Identity"`
	Name               string              `json:"name" yaml:"nName"`
	MaintenanceWindows []MaintenanceWindow `json:"windows" yaml:"MaintenanceWindows"`
}

type MaintenanceWindow added in v0.4.3

type MaintenanceWindow struct {
	Day       string `json:"day" yaml:"Day"`
	StartTime string `json:"startTime" yaml:"StartTime"`
	Duration  int    `json:"duration" yaml:"duration"`
}

func (MaintenanceWindow) String added in v0.4.3

func (m MaintenanceWindow) String() string

type Membership

type Membership struct {
	Email string `json:"email" yaml:"Email"`
	ID    string `json:"id" yaml:"Id"`
	Name  string `json:"name" yaml:"Name"`
	Slug  string `json:"slug" yaml:"Slug"`
}

type MembershipsAPI

type MembershipsAPI interface {
	GetMemberships(ctx context.Context) ([]Membership, error)
}

type NodeJoinConfigVersions added in v0.2.1

type NodeJoinConfigVersions struct {
	CloudInit  string `json:"cloudInit" yaml:"CloudInit"`
	Kubernetes string `json:"kubernetes" yaml:"Kubernetes"`
	Containerd string `json:"containerd" yaml:"Containerd"`
	Crictl     string `json:"crictl" yaml:"Crictl"`
}

NodeJoinConfigVersions represents the versions of various components used in the node join configuration. Only used for Bring Your Own Node cluster node pools.

type NodePool

type NodePool struct {
	ID                  int               `json:"id" yaml:"ID"`
	Identity            string            `json:"identity" yaml:"Identity"`
	Name                string            `json:"name" yaml:"Name"`
	AvailabilityZone    string            `json:"availabilityZone" yaml:"AvailabilityZone,omitempty"`
	NodeSize            string            `json:"nodeSize" yaml:"NodeSize"`
	AutoScaling         bool              `json:"autoScaling" yaml:"AutoScaling"`
	MinSize             int               `json:"minSize" yaml:"MinSize"`
	MaxSize             int               `json:"maxSize" yaml:"MaxSize"`
	NodeAutoReplacement bool              `json:"enableNodeAutoReplacement" yaml:"EnableNodeAutoReplacement"`
	Annotations         map[string]string `json:"annotations" yaml:"Annotations"`
	Labels              map[string]string `json:"labels" yaml:"Labels"`
	Taints              []NodeTaint       `json:"taints" yaml:"Taints"`
	Status              string            `json:"status" yaml:"Status,omitempty"`
	CreatedAt           time.Time         `json:"createdAt" yaml:"CreatedAt,omitempty"`
	ModifiedAt          time.Time         `json:"modifiedAt" yaml:"ModifiedAt,omitempty"`
	DeletedAt           *time.Time        `json:"deletedAt" yaml:"DeletedAt,omitempty"`

	ClusterIdentity string  `json:"clusterIdentity" yaml:"ClusterIdentity,omitempty"` // adds a reference to Cluster
	Cluster         Cluster `json:"-" yaml:"-"`                                       // adds a reference to Cluster for in-code
}

NodePool represents a pool of nodes in a cluster.

func (NodePool) FullIdentifier

func (n NodePool) FullIdentifier() string

type NodePoolJoinConfig added in v0.2.1

type NodePoolJoinConfig struct {
	Versions                NodeJoinConfigVersions `json:"versions" yaml:"Versions"`
	CloudInitUserDataBase64 string                 `json:"cloudInitUserDataBase64" yaml:"CloudInitUserDataBase64"`
	InstallScriptBase64     string                 `json:"installScriptBase64" yaml:"InstallScriptBase64"`
	UpgradeScriptBase64     string                 `json:"upgradeScriptBase64" yaml:"UpgradeScriptBase64"`
	JoinCommand             string                 `json:"joinCommand" yaml:"JoinCommand"`
	KubeletConfigBase64     string                 `json:"kubeletConfigBase64" yaml:"KubeletConfigBase64"`
}

NodePoolJoinConfig represents the configuration for joining a node pool. Only used for Bring Your Own Node cluster node pools.

type NodePools

type NodePools struct {
	Name             string `json:"name" yaml:"Name"`
	AutoScaling      bool   `json:"autoScaling" yaml:"AutoScaling"`
	MinSize          int    `json:"minSize" yaml:"MinSize"`
	MaxSize          int    `json:"maxSize" yaml:"MaxSize"`
	NodeSize         string `json:"nodeSize" yaml:"NodeSize"`
	AvailabilityZone string `json:"availabilityZone,omitempty" yaml:"AvailabilityZone,omitempty"`
}

NodePools is used by CreateCluster

type NodePoolsAPI

type NodePoolsAPI interface {
	GetNodePools(ctx context.Context) ([]NodePool, error)
	GetNodePoolsByOrg(ctx context.Context, organisationSlug string) ([]NodePool, error)
	GetNodePoolsByCluster(ctx context.Context, cluster Cluster) ([]NodePool, error)
	GetNodePoolsByClusters(ctx context.Context, clusters []Cluster) ([]NodePool, error)
	GetNodePoolJoinConfig(ctx context.Context, cluster Cluster, nodePool NodePool) (*NodePoolJoinConfig, error)
	CreateNodePool(ctx context.Context, cluster Cluster, create CreateNodePool) (*NodePool, error)
	UpdateNodePool(ctx context.Context, cluster Cluster, nodePoolID int, update CreateNodePool) (*NodePool, error)
	DeleteNodePool(ctx context.Context, cluster Cluster, nodePoolID int) error
}

type NodeTaint

type NodeTaint struct {
	Key    string `json:"key" yaml:"Key"`       // Key is the key of the taint.
	Value  string `json:"value" yaml:"Value"`   // Value is the value of the taint.
	Effect string `json:"effect" yaml:"Effect"` // Effect is the effect of the taint.
}

NodeTaint represents a taint applied to a Kubernetes node.

type NodeType

type NodeType struct {
	Type   string `json:"type" yaml:"Type"`
	CPU    int    `json:"cpu" yaml:"Cpu"`
	Memory int    `json:"memory" yaml:"Memory"`
}

type ObservabilityAPI

type ObservabilityAPI interface {
	GetObservabilityTenants(ctx context.Context, org string) ([]ObservabilityTenant, error)
	GetObservabilityTenantBySlug(ctx context.Context, org, slug string) (*ObservabilityTenant, error)
	GetObservabilityOrganisationAlerts(ctx context.Context, org string) ([]ObservabilityAlert, error)
	GetObservabilityTenantAlerts(ctx context.Context, org, slug string) ([]ObservabilityAlert, error)
	GetObservabilityTenantAlertmanagerConfiguration(ctx context.Context, org, slug string) (*ObservabilityAlertmanager, error)
	AddObservabilityTenantPrometheusRules(ctx context.Context, org, slug string, rules []PrometheusRules, force bool) error
	OverwriteObservabilityTenantPrometheusRules(ctx context.Context, org, slug string, rules []PrometheusRules) error
	DeleteObservabilityTenantPrometheusRules(ctx context.Context, org, slug string, names []string) error

	GetSilences(ctx context.Context, org, observabilityTenantSlug string) ([]Silence, error)
	CreateSilence(ctx context.Context, createSilence CreateSilence, org, observabilityTenantSlug string) (*Silence, error)
	ExpireSilence(ctx context.Context, org, observabilityTenantSlug, silenceID string) error
}

type ObservabilityAlert

type ObservabilityAlert struct {
	Labels      map[string]string `json:"labels" yaml:"Labels"`
	Annotations map[string]string `json:"annotations" yaml:"Annotations"`
	ActiveAt    time.Time         `json:"activeAt" yaml:"ActiveAt"`
	State       string            `json:"state" yaml:"State"`
	Value       string            `json:"value" yaml:"Value"`
}

type ObservabilityAlertmanager

type ObservabilityAlertmanager struct {
	Rules              map[string]string `json:"ruleFiles" yaml:"Rules"`
	Templates          map[string]string `json:"templateFiles" yaml:"Templates"`
	AlertManagerConfig string            `json:"alertManagerConfig" yaml:"Alertmanager"`
}

type ObservabilityAlertmanagerAndPrometheusrulesResponse

type ObservabilityAlertmanagerAndPrometheusrulesResponse struct {
	Rules              map[string]string `json:"ruleFiles" yaml:"Rules"`
	Templates          map[string]string `json:"templateFiles" yaml:"Templates"`
	AlertManagerConfig string            `json:"alertManagerConfig" yaml:"Alertmanager"`
}

type ObservabilityTenant

type ObservabilityTenant struct {
	Identity     string     `json:"identity" yaml:"Identity"`
	CustomerSlug string     `json:"customer" yaml:"Customer,omitempty"`
	Name         string     `json:"name" yaml:"Name"`
	Slug         string     `json:"slug" yaml:"Slug"`
	Available    bool       `json:"available" yaml:"Available"`
	IpWhiteList  string     `json:"ipWhiteList" yaml:"IPWhiteList,omitempty"`
	CreatedAt    time.Time  `json:"createdAt" yaml:"CreatedAt"`
	ModifiedAt   time.Time  `json:"modifiedAt" yaml:"ModifiedAt"`
	DeletedAt    *time.Time `json:"DeletedAt" yaml:"DeletedAt,omitempty"`
}

type Organisation

type Organisation struct {
	ID                                  string    `json:"id"`
	Name                                string    `json:"name"`
	VatCode                             string    `json:"vatCode"`
	CompanyName                         string    `json:"companyName"`
	CompanyAddress                      string    `json:"companyAddress"`
	ContactEmail                        string    `json:"contactEmail"`
	BillingEmail                        string    `json:"billingEmail"`
	VatCodeValidated                    bool      `json:"vatCodeValidated"`
	VatCodeValidatedAt                  time.Time `json:"vatCodeValidatedAt"`
	PhoneNumber                         string    `json:"phoneNumber"`
	CreatedAt                           time.Time `json:"createdAt"`
	AcceptedTerms                       bool      `json:"acceptedTerms"`
	AcceptedTermsAt                     time.Time `json:"acceptedTermsAt"`
	RestrictedToAvailableCloudProviders bool      `json:"restrictedToAvailableCloudProviders"`
	Type                                string    `json:"type"`
	Slug                                string    `json:"slug"`
}

type OrganisationAPI

type OrganisationAPI interface {
	GetOrganisation(ctx context.Context, organisationSlug string) (*Organisation, error)
}

type PageGetter

type PageGetter interface {
	Get(ctx context.Context, url string, page int) (PagedResult, error)
}

type Pageable

type Pageable struct {
	Sort       Sort `json:"sort"`
	PageNumber int  `json:"pageNumber"`
	PageSize   int  `json:"pageSize"`
	Offset     int  `json:"offset"`
	Paged      bool `json:"paged"`
	Unpaged    bool `json:"unpaged"`
}

type PagedResult

type PagedResult struct {
	Content          []interface{} `json:"content"`
	Pageable         interface{}   `json:"pageable"`
	Last             bool          `json:"last"`
	TotalPages       int           `json:"totalPages"`
	TotalElements    int           `json:"totalElements"`
	NumberOfElements int           `json:"numberOfElements"`
	Number           int           `json:"number"`
	Sort             Sort          `json:"sort"`
	First            bool          `json:"first"`
	Size             int           `json:"size"`
	Empty            bool          `json:"empty"`
}

type PrometheusRules

type PrometheusRules struct {
	Name    string
	Content []byte
}

type Region

type Region struct {
	ID         int       `json:"id" yaml:"Id"`
	Provider   string    `json:"provider" yaml:"Provider"`
	Name       string    `json:"name" yaml:"Name"`
	Slug       string    `json:"slug" yaml:"Slug"`
	Available  bool      `json:"available" yaml:"Available"`
	Restricted bool      `json:"restricted" yaml:"Restricted"`
	CreatedAt  time.Time `json:"createdAt" yaml:"CreatedAt"`
	ModifiedAt time.Time `json:"modifiedAt" yaml:"ModifiedAt"`
}

type RestyClient

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

func NewRestyClient

func NewRestyClient(authenticator Authenticator, opts ClientOpts) *RestyClient

func (*RestyClient) CheckResponse

func (c *RestyClient) CheckResponse(response *resty.Response, err error) error

func (*RestyClient) GetPaged

func (c *RestyClient) GetPaged(ctx context.Context, url string) (PagedResult, error)

func (*RestyClient) R

func (c *RestyClient) R() *resty.Request

func (*RestyClient) Resty

func (c *RestyClient) Resty() *resty.Client

type RestyPageGetter

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

func (*RestyPageGetter) Get

func (rg *RestyPageGetter) Get(ctx context.Context, url string, page int) (PagedResult, error)

type ScheduledClusterUpgrade added in v0.4.3

type ScheduledClusterUpgrade struct {
	Identity           string                        `json:"identity" yaml:"Identity"`
	ClusterIdentity    string                        `json:"clusterIdentity" yaml:"ClusterIdentity"`
	CreatedAt          time.Time                     `json:"createdAt" yaml:"CreatedAt"`
	ModifiedAt         time.Time                     `json:"modifiedAt" yaml:"ModifiedAt"`
	WindowStart        time.Time                     `json:"windowStart" yaml:"WindowStart"`
	WindowEnd          time.Time                     `json:"windowEnd" yaml:"WindowEnd"`
	FromClusterVersion string                        `json:"fromClusterVersion" yaml:"FromClusterVersion"`
	ToClusterVersion   string                        `json:"toClusterVersion" yaml:"ToClusterVersion"`
	Status             ScheduledClusterUpgradeStatus `json:"status" yaml:"Status"`
	Reason             string                        `json:"reason" yaml:"Reason"`
}

type ScheduledClusterUpgradeStatus added in v0.4.3

type ScheduledClusterUpgradeStatus string
const (
	Scheduled         ScheduledClusterUpgradeStatus = "SCHEDULED"
	ScheduledNotified ScheduledClusterUpgradeStatus = "SCHEDULED_NOTIFIED"
	Updated           ScheduledClusterUpgradeStatus = "UPDATED"
	Succeeded         ScheduledClusterUpgradeStatus = "SUCCEEDED"
	Cancelled         ScheduledClusterUpgradeStatus = "CANCELLED"
	Superseded        ScheduledClusterUpgradeStatus = "SUPERSEDED"
	Failed            ScheduledClusterUpgradeStatus = "FAILED"
	Missed            ScheduledClusterUpgradeStatus = "MISSED"
)

type ServiceLevelAgreement

type ServiceLevelAgreement struct {
	Slug        string    `json:"slug" yaml:"Slug"`
	Name        string    `json:"name" yaml:"Name"`
	Value       int       `json:"value" yaml:"Value"`
	AutoUpgrade bool      `json:"autoUpgrade" yaml:"AutoUpgrade"`
	CreatedAt   time.Time `json:"createdAt" yaml:"CreatedAt"`
	ModifiedAt  time.Time `json:"modifiedAt" yaml:"ModifiedAt"`
}

type Silence added in v0.2.2

type Silence struct {
	Id        string           `json:"id" yaml:"Id"`
	Matchers  []SilenceMatcher `json:"matchers" yaml:"Matchers"`
	StartsAt  time.Time        `json:"startsAt" yaml:"StartsAt"`
	EndsAt    time.Time        `json:"endsAt" yaml:"EndsAt"`
	CreatedBy string           `json:"createdBy" yaml:"CreatedBy"`
	Comment   string           `json:"comment" yaml:"Comment"`
	Status    SilenceStatus    `json:"status" yaml:"Status"`
}

type SilenceMatcher added in v0.2.2

type SilenceMatcher struct {
	Name    string `json:"name" yaml:"Name"`
	Value   string `json:"value" yaml:"Value"`
	IsRegex bool   `json:"isRegex" yaml:"IsRegex"`
	IsEqual bool   `json:"isEqual" yaml:"IsEqual"`
}

type SilenceStatus added in v0.2.2

type SilenceStatus struct {
	State string `json:"state" yaml:"State"`
}

type Sort

type Sort struct {
	Sorted   bool `json:"sorted"`
	Unsorted bool `json:"unsorted"`
	Empty    bool `json:"empty"`
}

type UpdateChannelAPI

type UpdateChannelAPI interface {
	GetUpdateChannels(ctx context.Context, org string) ([]UpdateChannelResponse, error)
}

type UpdateChannelResponse

type UpdateChannelResponse struct {
	Name                     string `json:"name" yaml:"Name"`
	Available                bool   `json:"available" yaml:"Available"`
	KubernetesClusterVersion string `json:"kubernetesClusterVersion" yaml:"Version"`
}

type UpdateCluster

type UpdateCluster struct {
	Status                  string  `json:"status,omitempty" yaml:"Status,omitempty"`
	Version                 string  `json:"version,omitempty" yaml:"Version,omitempty"`
	CNI                     *string `json:"cni,omitempty" yaml:"CNI,omitempty"`
	UpdateChannel           string  `json:"updateChannel,omitempty" yaml:"UpdateChannel,omitempty"`
	EnableNetworkProxy      *bool   `json:"enableNetworkProxy,omitempty" yaml:"EnableNetworkProxy,omitempty"`
	EnableNetworkEncryption *bool   `json:"enableNetworkEncryption,omitempty" yaml:"EnableNetworkEncryption,omitempty"`
	EnableAutoUpgrade       *bool   `json:"enableAutoUpgrade,omitempty" yaml:"EnableAutoUpgrade,omitempty"`
	EnableHighAvailability  *bool   `json:"enableHighAvailability,omitempty" yaml:"EnableHighAvailability,omitempty"`
	// Deprecated: replaced by PodSecurityStandardsProfile which offers support for selecting a specific default PSS profile. This setting does not do anything since Kubernetes v1.23
	EnablePodSecurityStandards  *bool               `json:"enablePodSecurityStandards,omitempty" yaml:"EnablePodSecurityStandards,omitempty"`
	PodSecurityStandardsProfile *string             `json:"podSecurityStandardsProfile,omitempty" yaml:"PodSecurityStandardsProfile,omitempty"`
	DeleteProtection            *bool               `json:"deleteProtection,omitempty" yaml:"DeleteProtection,omitempty"`
	IPWhitelist                 []string            `json:"ipWhitelist,omitempty" yaml:"IpWhitelist,omitempty"`
	Addons                      map[string]APIAddon `json:"addons,omitempty" yaml:"Addons,omitempty"`
}

UpdateCluster represents the data structure for updating a cluster.

type UpdateEnvironment

type UpdateEnvironment struct {
	Name        string `json:"name" yaml:"Name"`
	Purpose     string `json:"purpose" yaml:"Purpose"`
	Type        string `json:"type" yaml:"Type"`
	Description string `json:"description" yaml:"Description"`
}

type UpdateScheduledClusterUpgradeRequest added in v0.4.3

type UpdateScheduledClusterUpgradeRequest struct {
	Identity string                        `json:"identity"`
	Status   ScheduledClusterUpgradeStatus `json:"status"`
	Reason   string                        `json:"reason" yaml:"Reason"`
}

Jump to

Keyboard shortcuts

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