client

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2025 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoItemFound is returned when trying to find a resource that does not exist.
	ErrNoItemFound = errors.New("no item found")
	// ErrTooManyItemsFound is returned when trying to find a resource but more than one are found.
	ErrTooManyItemsFound = errors.New("expected to find only one item")
)

Functions

func IsForbiddenError

func IsForbiddenError(err error) bool

IsForbiddenError returns true if err is an HTTP 403 error.

func IsNotFoundError

func IsNotFoundError(err error) bool

IsNotFoundError returns true if err is an HTTP 404 error or ErrNoItemFound.

func IsPreconditionFailedError

func IsPreconditionFailedError(err error) bool

IsPreconditionFailedError returns true if err is a PreconditionFailedError.

Types

type Client

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

Client is a wrapper over scaleway-sdk-go to access Scaleway Product APIs in a specific region and project.

func New

func New(region scw.Region, projectID string, secretData map[string][]byte) (*Client, error)

New returns a new Scaleway client based on the provided region and secretData. The secret data must contain a default projectID and credentials.

func (*Client) AddBackendServer

func (c *Client) AddBackendServer(ctx context.Context, zone scw.Zone, backendID, ip string) error

func (*Client) AttachLBPrivateNetwork

func (c *Client) AttachLBPrivateNetwork(ctx context.Context, zone scw.Zone, lbID, privateNetworkID string) error

func (*Client) CreateBackend

func (c *Client) CreateBackend(
	ctx context.Context,
	zone scw.Zone,
	lbID,
	name string,
	servers []string,
	port int32,
) (*lb.Backend, error)

func (*Client) CreateFrontend

func (c *Client) CreateFrontend(
	ctx context.Context,
	zone scw.Zone,
	lbID, name, backendID string,
	port int32,
) (*lb.Frontend, error)

func (*Client) CreateGateway

func (c *Client) CreateGateway(
	ctx context.Context,
	zone scw.Zone,
	name, gwType string,
	tags []string,
	ipID *string,
) (*vpcgw.Gateway, error)

func (*Client) CreateGatewayNetwork

func (c *Client) CreateGatewayNetwork(ctx context.Context, zone scw.Zone, gatewayID, privateNetworkID string) error

func (*Client) CreateIP

func (c *Client) CreateIP(ctx context.Context, zone scw.Zone, ipType instance.IPType, tags []string) (*instance.IP, error)

func (*Client) CreateLB

func (c *Client) CreateLB(
	ctx context.Context,
	zone scw.Zone,
	name, lbType string,
	ipID *string,
	tags []string,
) (*lb.LB, error)

func (*Client) CreateLBACL

func (c *Client) CreateLBACL(
	ctx context.Context,
	zone scw.Zone,
	frontendID, name string,
	index int32,
	action lb.ACLActionType,
	matchedSubnets []string,
) error

func (*Client) CreatePrivateNIC

func (c *Client) CreatePrivateNIC(ctx context.Context, zone scw.Zone, serverID, privateNetworkID string) (*instance.PrivateNIC, error)

func (*Client) CreatePrivateNetwork

func (c *Client) CreatePrivateNetwork(
	ctx context.Context,
	name string,
	vpcID, subnet *string,
	tags []string,
) (*vpc.PrivateNetwork, error)

func (*Client) CreateServer

func (c *Client) CreateServer(
	ctx context.Context,
	zone scw.Zone,
	name, commercialType, imageID string,
	rootVolumeSize scw.Size,
	rootVolumeType instance.VolumeVolumeType,
	publicIPs, tags []string,
) (*instance.Server, error)

func (*Client) DefaultZone

func (c *Client) DefaultZone() scw.Zone

DefaultZone returns the first zone of the region.

func (*Client) DeleteDNSZoneRecords

func (c *Client) DeleteDNSZoneRecords(ctx context.Context, zone, name string) error

func (*Client) DeleteGateway

func (c *Client) DeleteGateway(ctx context.Context, zone scw.Zone, id string, deleteIP bool) error

func (*Client) DeleteIP

func (c *Client) DeleteIP(ctx context.Context, zone scw.Zone, ipID string) error

func (*Client) DeleteInstanceVolume

func (c *Client) DeleteInstanceVolume(ctx context.Context, zone scw.Zone, volumeID string) error

func (*Client) DeleteLB

func (c *Client) DeleteLB(ctx context.Context, zone scw.Zone, id string, releaseIP bool) error

func (*Client) DeleteLBACL

func (c *Client) DeleteLBACL(ctx context.Context, zone scw.Zone, aclID string) error

func (*Client) DeletePrivateNetwork

func (c *Client) DeletePrivateNetwork(ctx context.Context, id string) error

func (*Client) DeleteServer

func (c *Client) DeleteServer(ctx context.Context, zone scw.Zone, serverID string) error

func (*Client) DeleteServerUserData

func (c *Client) DeleteServerUserData(ctx context.Context, zone scw.Zone, serverID, key string) error

func (*Client) DeleteVolume

func (c *Client) DeleteVolume(ctx context.Context, zone scw.Zone, volumeID string) error

func (*Client) DetachVolume

func (c *Client) DetachVolume(ctx context.Context, zone scw.Zone, volumeID string) error

func (*Client) FindBackend

func (c *Client) FindBackend(ctx context.Context, zone scw.Zone, lbID, name string) (*lb.Backend, error)

func (*Client) FindFrontend

func (c *Client) FindFrontend(ctx context.Context, zone scw.Zone, lbID, name string) (*lb.Frontend, error)

func (*Client) FindGatewayIP

func (c *Client) FindGatewayIP(ctx context.Context, zone scw.Zone, ip string) (*vpcgw.IP, error)

func (*Client) FindGateways

func (c *Client) FindGateways(ctx context.Context, tags []string) ([]*vpcgw.Gateway, error)

func (*Client) FindIPs

func (c *Client) FindIPs(ctx context.Context, zone scw.Zone, tags []string) ([]*instance.IP, error)

func (*Client) FindImage

func (c *Client) FindImage(ctx context.Context, zone scw.Zone, name string) (*instance.Image, error)

FindImage finds an existing Instance image by name. It returns ErrNoItemFound if no matching image is found.

func (*Client) FindInstanceVolume

func (c *Client) FindInstanceVolume(ctx context.Context, zone scw.Zone, tags []string) (*instance.Volume, error)

func (*Client) FindLB

func (c *Client) FindLB(ctx context.Context, zone scw.Zone, tags []string) (*lb.LB, error)

func (*Client) FindLBACLByName

func (c *Client) FindLBACLByName(ctx context.Context, zone scw.Zone, frontendID, name string) (*lb.ACL, error)

func (*Client) FindLBIP

func (c *Client) FindLBIP(ctx context.Context, zone scw.Zone, ip string) (*lb.IP, error)

func (*Client) FindLBPrivateNetwork

func (c *Client) FindLBPrivateNetwork(
	ctx context.Context,
	zone scw.Zone,
	lbID, privateNetworkID string,
) (*lb.PrivateNetwork, error)

func (*Client) FindLBs

func (c *Client) FindLBs(ctx context.Context, tags []string) ([]*lb.LB, error)

func (*Client) FindPrivateNICIPs

func (c *Client) FindPrivateNICIPs(ctx context.Context, privateNICID string) ([]*ipam.IP, error)

func (*Client) FindPrivateNetwork

func (c *Client) FindPrivateNetwork(ctx context.Context, tags []string, vpcID *string) (*vpc.PrivateNetwork, error)

FindPrivateNetwork finds an existing Private Network by tags. It returns ErrNoItemFound if no matching Private Network is found.

func (*Client) FindServer

func (c *Client) FindServer(ctx context.Context, zone scw.Zone, tags []string) (*instance.Server, error)

FindServer finds an existing Instance server by tags. It returns ErrNoItemFound if no matching server is found.

func (*Client) FindVolume

func (c *Client) FindVolume(ctx context.Context, zone scw.Zone, tags []string) (*block.Volume, error)

func (*Client) GetAllServerUserData

func (c *Client) GetAllServerUserData(ctx context.Context, zone scw.Zone, serverID string) (map[string]io.Reader, error)

func (*Client) GetControlPlaneZones

func (c *Client) GetControlPlaneZones() []scw.Zone

GetControlPlaneZones returns the availables zone for the control plane machines.

func (*Client) GetLocalImageByLabel

func (c *Client) GetLocalImageByLabel(
	ctx context.Context,
	zone scw.Zone,
	commercialType,
	imageLabel string,
	imageType marketplace.LocalImageType,
) (*marketplace.LocalImage, error)

func (*Client) GetZoneOrDefault

func (c *Client) GetZoneOrDefault(zone *string) (scw.Zone, error)

GetZoneOrDefault dereferences and parses the provided zone, or returns the default zone.

func (*Client) ListDNSZoneRecords

func (c *Client) ListDNSZoneRecords(ctx context.Context, zone, name string) ([]*domain.Record, error)

func (*Client) ListLBACLs

func (c *Client) ListLBACLs(ctx context.Context, zone scw.Zone, frontendID string) ([]*lb.ACL, error)

func (*Client) MigrateLB

func (c *Client) MigrateLB(ctx context.Context, zone scw.Zone, id string, newType string) (*lb.LB, error)

func (*Client) RemoveBackendServer

func (c *Client) RemoveBackendServer(ctx context.Context, zone scw.Zone, backendID, ip string) error

func (*Client) ServerAction

func (c *Client) ServerAction(ctx context.Context, zone scw.Zone, serverID string, action instance.ServerAction) error

func (*Client) SetBackendServers

func (c *Client) SetBackendServers(
	ctx context.Context,
	zone scw.Zone,
	backendID string,
	servers []string,
) (*lb.Backend, error)

func (*Client) SetDNSZoneRecords

func (c *Client) SetDNSZoneRecords(ctx context.Context, zone, name string, ips []string) error

func (*Client) SetLBACLs

func (c *Client) SetLBACLs(ctx context.Context, zone scw.Zone, frontendID string, acls []*lb.ACLSpec) error

func (*Client) SetServerUserData

func (c *Client) SetServerUserData(ctx context.Context, zone scw.Zone, serverID, key, content string) error

func (*Client) UpdateInstanceVolumeTags

func (c *Client) UpdateInstanceVolumeTags(ctx context.Context, zone scw.Zone, volumeID string, tags []string) error

func (*Client) UpdateLBACL

func (c *Client) UpdateLBACL(
	ctx context.Context,
	zone scw.Zone,
	aclID, name string,
	index int32,
	action lb.ACLActionType,
	matchedSubnets []string,
) error

func (*Client) UpdateVolumeIOPS

func (c *Client) UpdateVolumeIOPS(ctx context.Context, zone scw.Zone, volumeID string, iops int64) error

func (*Client) UpdateVolumeTags

func (c *Client) UpdateVolumeTags(ctx context.Context, zone scw.Zone, volumeID string, tags []string) error

Jump to

Keyboard shortcuts

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