client

package
v2.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UserAgent = "gardener-extension-provider-stackit"
)

Variables

This section is empty.

Functions

func GetStatusCode

func GetStatusCode(err error) int

GetStatusCode returns the attached error code if the given error implements StatusCodeError or 0 otherwise.

func IgnoreNotFoundError

func IgnoreNotFoundError(err error) error

IgnoreNotFoundError ignore not found error

func IsConflict added in v2.5.0

func IsConflict(err error) bool

func IsConflictError

func IsConflictError(err error) bool

func IsNotFound

func IsNotFound(err error) bool

Types

type DNSClient

type DNSClient interface {
	ListZones(ctx context.Context) ([]DNSZone, error)
	CreateOrUpdateRecordSet(ctx context.Context, zoneID, name, recordType string, records []string, ttl int64) error
	DeleteRecordSet(ctx context.Context, zoneID, name, recordType string) error
}

func NewDNSClient

func NewDNSClient(ctx context.Context, endpoints stackitv1alpha1.APIEndpoints, credentials *stackit.Credentials) (DNSClient, error)

type DNSZone

type DNSZone struct {
	ID      string
	DNSName string
}

type Error

type Error struct {
	Message    string
	Resource   string
	Name       string
	StatusCode int
}

Error is an error returned by SDK helper functions in this package.

func NewNotFoundError

func NewNotFoundError(resource, name string) *Error

func (*Error) Error

func (e *Error) Error() string

func (*Error) GetStatusCode

func (e *Error) GetStatusCode() int

type Factory

type Factory interface {
	// DNS returns a STACKIT DNS service client.
	DNS(context.Context, client.Client, corev1.SecretReference) (DNSClient, error)

	// LoadBalancing returns a STACKIT load balancing service client.
	LoadBalancing(context.Context, client.Client, corev1.SecretReference) (LoadBalancingClient, error)

	// IaaS returns a STACKIT IaaS service client.
	IaaS(context.Context, client.Client, corev1.SecretReference) (IaaSClient, error)
}

Factory produces clients for various STACKIT services.

func New

func New(region string, cluster *extensionscontroller.Cluster) Factory

type IaaSClient

type IaaSClient interface {
	ProjectID() string

	// Network
	CreateIsolatedNetwork(ctx context.Context, payload iaas.CreateIsolatedNetworkPayload) (*iaas.Network, error)
	GetNetworkById(ctx context.Context, id string) (*iaas.Network, error)
	GetNetworkByName(ctx context.Context, name string) ([]iaas.Network, error)
	UpdateNetwork(ctx context.Context, networkId string, payload iaas.PartialUpdateNetworkPayload) (*iaas.Network, error)
	DeleteNetwork(ctx context.Context, networkID string) error

	CreateSecurityGroup(ctx context.Context, payload iaas.CreateSecurityGroupPayload) (*iaas.SecurityGroup, error)
	DeleteSecurityGroup(ctx context.Context, securityGroupId string) error
	GetSecurityGroupByName(ctx context.Context, name string) ([]iaas.SecurityGroup, error)
	GetSecurityGroupById(ctx context.Context, securityGroupId string) (*iaas.SecurityGroup, error)

	CreateSecurityGroupRule(ctx context.Context, securityGroupId string, wantedRule iaas.SecurityGroupRule) (*iaas.SecurityGroupRule, error)
	ReconcileSecurityGroupRules(ctx context.Context, log logr.Logger, securityGroup *iaas.SecurityGroup, wantedRules []iaas.SecurityGroupRule) error
	UpdateSecurityGroupRules(ctx context.Context, group *iaas.SecurityGroup, desiredRules []iaas.SecurityGroupRule, allowDelete func(rule *iaas.SecurityGroupRule) bool) (modified bool, err error)

	CreateServer(ctx context.Context, payload iaas.CreateServerPayload) (*iaas.Server, error)
	DeleteServer(ctx context.Context, serverId string) error
	GetServerByName(ctx context.Context, name string) ([]iaas.Server, error)

	CreatePublicIp(ctx context.Context, payload iaas.CreatePublicIPPayload) (*iaas.PublicIp, error)
	DeletePublicIp(ctx context.Context, publicIpId string) error
	GetPublicIpByLabels(ctx context.Context, selector stackit.LabelSelector) ([]iaas.PublicIp, error)
	AddPublicIpToServer(ctx context.Context, serverId, publicIpId string) error

	GetKeypair(ctx context.Context, name string) (*iaas.Keypair, error)
	CreateKeypair(ctx context.Context, name, publicKey string) (*iaas.Keypair, error)
	DeleteKeypair(ctx context.Context, name string) error
}

func NewIaaSClient

func NewIaaSClient(region string, endpoints stackitv1alpha1.APIEndpoints, credentials *stackit.Credentials) (IaaSClient, error)

type LoadBalancingClient

type LoadBalancingClient interface {
	ListLoadBalancers(ctx context.Context) ([]loadbalancer.LoadBalancer, error)
	DeleteLoadBalancer(ctx context.Context, lbName string) error
	GetLoadBalancer(ctx context.Context, id string) (*loadbalancer.LoadBalancer, error)
}

func NewLoadBalancingClient

func NewLoadBalancingClient(ctx context.Context, region string, endpoints stackitv1alpha1.APIEndpoints, credentials *stackit.Credentials) (LoadBalancingClient, error)

type StatusCodeError

type StatusCodeError interface {
	error
	GetStatusCode() int
}

StatusCodeError is a common interface implemented by Error and the SDK's GenericOpenAPIError.

Directories

Path Synopsis
Package client is a generated GoMock package.
Package client is a generated GoMock package.
dns
Package dns is a generated GoMock package.
Package dns is a generated GoMock package.
iaas
Package iaas is a generated GoMock package.
Package iaas is a generated GoMock package.
loadbalancer
Package loadbalancer is a generated GoMock package.
Package loadbalancer is a generated GoMock package.

Jump to

Keyboard shortcuts

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