api

package
v22.11.9 Latest Latest
Warning

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

Go to latest
Published: May 30, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FullStack

type FullStack interface {
	Stack
	ReservedForProviderUse
}

FullStack is the interface that MUST actually implement all the providers; don't do it, and we can encounter runtime panics

type ReservedForProviderUse

type ReservedForProviderUse interface {
	ListImages(ctx context.Context, all bool) ([]*abstract.Image, fail.Error)                   // lists available OS images
	ListTemplates(ctx context.Context, all bool) ([]*abstract.HostTemplate, fail.Error)         // lists available host templates
	GetRawConfigurationOptions(ctx context.Context) (stacks.ConfigurationOptions, fail.Error)   // Returns a read-only struct containing configuration options
	GetRawAuthenticationOptions(ctx context.Context) (stacks.AuthenticationOptions, fail.Error) // Returns a read-only struct containing authentication options
}

ReservedForProviderUse is an interface about the methods only available to providers internally

type Stack

type Stack interface {
	TerraformStack

	GetStackName() (string, fail.Error)

	GetType() (string, fail.Error)

	// ListAvailabilityZones lists the usable Availability Zones
	ListAvailabilityZones(ctx context.Context) (map[string]bool, fail.Error)

	// ListRegions returns a list with the regions available
	ListRegions(ctx context.Context) ([]string, fail.Error)

	// InspectImage returns the Image referenced by id
	InspectImage(ctx context.Context, id string) (*abstract.Image, fail.Error)

	// InspectTemplate returns the Template referenced by id
	InspectTemplate(ctx context.Context, id string) (*abstract.HostTemplate, fail.Error)

	// CreateKeyPair creates and import a key pair
	CreateKeyPair(ctx context.Context, name string) (*abstract.KeyPair, fail.Error)
	// InspectKeyPair returns the key pair identified by id
	InspectKeyPair(ctx context.Context, id string) (*abstract.KeyPair, fail.Error)
	// ListKeyPairs lists available key pairs
	ListKeyPairs(ctx context.Context) ([]*abstract.KeyPair, fail.Error)
	// DeleteKeyPair deletes the key pair identified by id
	DeleteKeyPair(ctx context.Context, id string) fail.Error

	// ListSecurityGroups lists the security groups
	ListSecurityGroups(ctx context.Context, networkRef string) ([]*abstract.SecurityGroup, fail.Error)
	// CreateSecurityGroup creates a security group
	CreateSecurityGroup(ctx context.Context, networkRef, name, description string, rules abstract.SecurityGroupRules) (*abstract.SecurityGroup, fail.Error)
	// InspectSecurityGroup returns information about a security group
	InspectSecurityGroup(ctx context.Context, sgParam stacks.SecurityGroupParameter) (*abstract.SecurityGroup, fail.Error)
	// ClearSecurityGroup removes rules from group
	ClearSecurityGroup(ctx context.Context, sgParam stacks.SecurityGroupParameter) (*abstract.SecurityGroup, fail.Error)
	// DeleteSecurityGroup deletes a security group and all its rules
	DeleteSecurityGroup(context.Context, *abstract.SecurityGroup) fail.Error
	// AddRuleToSecurityGroup adds a rule to an existing security group
	AddRuleToSecurityGroup(ctx context.Context, sgParam stacks.SecurityGroupParameter, rule *abstract.SecurityGroupRule) (*abstract.SecurityGroup, fail.Error)
	// DeleteRuleFromSecurityGroup deletes a rule identified by ID from a security group
	DeleteRuleFromSecurityGroup(ctx context.Context, sgParam stacks.SecurityGroupParameter, rule *abstract.SecurityGroupRule) (*abstract.SecurityGroup, fail.Error)
	// GetDefaultSecurityGroupName returns the name of the default security group automatically bound to new host
	GetDefaultSecurityGroupName(ctx context.Context) (string, fail.Error)

	// CreateNetwork creates a network named name
	CreateNetwork(ctx context.Context, req abstract.NetworkRequest) (*abstract.Network, fail.Error)
	// InspectNetwork returns the network identified by id
	InspectNetwork(ctx context.Context, id string) (*abstract.Network, fail.Error)
	// InspectNetworkByName returns the network identified by name
	InspectNetworkByName(ctx context.Context, name string) (*abstract.Network, fail.Error)
	// ListNetworks lists all networks
	ListNetworks(ctx context.Context) ([]*abstract.Network, fail.Error)
	// DeleteNetwork deletes the network identified by id
	DeleteNetwork(ctx context.Context, id string) fail.Error
	// HasDefaultNetwork tells if the stack has a default network (defined in tenant settings)
	HasDefaultNetwork(ctx context.Context) (bool, fail.Error)
	// GetDefaultNetwork returns the abstract.Network used as default Network
	GetDefaultNetwork(ctx context.Context) (*abstract.Network, fail.Error)

	// CreateSubnet creates a subnet in an existing network
	CreateSubnet(ctx context.Context, req abstract.SubnetRequest) (*abstract.Subnet, fail.Error)
	// InspectSubnet returns the network identified by id
	InspectSubnet(ctx context.Context, id string) (*abstract.Subnet, fail.Error)
	// InspectSubnetByName returns the network identified by 'name'
	InspectSubnetByName(ctx context.Context, networkID, name string) (*abstract.Subnet, fail.Error)
	// ListSubnets lists all subnets of a network (or all subnets if no networkRef is provided)
	ListSubnets(ctx context.Context, networkID string) ([]*abstract.Subnet, fail.Error)
	// DeleteSubnet deletes the subnet identified by id
	DeleteSubnet(ctx context.Context, id string) fail.Error

	// CreateVIP ...
	CreateVIP(ctx context.Context, networkID, subnetID, name string, securityGroups []string) (*abstract.VirtualIP, fail.Error)
	// AddPublicIPToVIP adds a public IP to VIP
	AddPublicIPToVIP(context.Context, *abstract.VirtualIP) fail.Error
	// BindHostToVIP makes the host passed as parameter an allowed "target" of the VIP
	BindHostToVIP(context.Context, *abstract.VirtualIP, string) fail.Error
	// UnbindHostFromVIP removes the bind between the VIP and a host
	UnbindHostFromVIP(context.Context, *abstract.VirtualIP, string) fail.Error
	// DeleteVIP deletes the port corresponding to the VIP
	DeleteVIP(context.Context, *abstract.VirtualIP) fail.Error

	// CreateHost creates a host that fulfills the request
	CreateHost(ctx context.Context, request abstract.HostRequest, extra interface{}) (*abstract.HostFull, *userdata.Content, fail.Error)
	// ClearHostStartupScript clears the Startup Script of the Host (if the stack can do it)
	ClearHostStartupScript(context.Context, stacks.HostParameter) fail.Error

	ChangeSecurityGroupSecurity(context.Context, bool, bool, string, string) fail.Error

	// InspectHost returns the information of the Host identified by id
	InspectHost(context.Context, stacks.HostParameter) (*abstract.HostFull, fail.Error)

	// GetHostState returns the current state of the host identified by id
	GetHostState(context.Context, stacks.HostParameter) (hoststate.Enum, fail.Error)
	// ListHosts lists all hosts
	ListHosts(context.Context, bool) (abstract.HostList, fail.Error)
	// DeleteHost deletes the host identified by id
	DeleteHost(context.Context, stacks.HostParameter) fail.Error
	// StopHost stops the host identified by id
	StopHost(ctx context.Context, host stacks.HostParameter, gracefully bool) fail.Error
	// StartHost starts the host identified by id
	StartHost(context.Context, stacks.HostParameter) fail.Error
	// RebootHost reboots a host
	RebootHost(context.Context, stacks.HostParameter) fail.Error
	// WaitHostReady waits until host defined in hostParam is reachable by SSH
	WaitHostReady(ctx context.Context, hostParam stacks.HostParameter, timeout time.Duration) (*abstract.HostCore, fail.Error)
	// BindSecurityGroupToHost attaches a security group to a host
	BindSecurityGroupToHost(ctx context.Context, sgParam stacks.SecurityGroupParameter, hostParam stacks.HostParameter) fail.Error
	// UnbindSecurityGroupFromHost detaches a security group from a host
	UnbindSecurityGroupFromHost(ctx context.Context, sgParam stacks.SecurityGroupParameter, hostParam stacks.HostParameter) fail.Error

	// CreateVolume creates a block volume
	CreateVolume(ctx context.Context, request abstract.VolumeRequest) (*abstract.Volume, fail.Error)
	// InspectVolume returns the volume identified by id
	InspectVolume(ctx context.Context, id string) (*abstract.Volume, fail.Error)
	// ListVolumes list available volumes
	ListVolumes(context.Context) ([]*abstract.Volume, fail.Error)
	// DeleteVolume deletes the volume identified by id
	DeleteVolume(ctx context.Context, id string) fail.Error

	// CreateVolumeAttachment attaches a volume to a host
	CreateVolumeAttachment(ctx context.Context, request abstract.VolumeAttachmentRequest) (string, fail.Error)
	// InspectVolumeAttachment returns the volume attachment identified by id
	InspectVolumeAttachment(ctx context.Context, serverID, id string) (*abstract.VolumeAttachment, fail.Error)
	// ListVolumeAttachments lists available volume attachment
	ListVolumeAttachments(ctx context.Context, serverID string) ([]*abstract.VolumeAttachment, fail.Error)
	// DeleteVolumeAttachment deletes the volume attachment identified by id
	DeleteVolumeAttachment(ctx context.Context, serverID, id string) fail.Error

	// Timings ...
	Timings() (temporal.Timings, fail.Error)

	// UpdateTags updates provider's tags
	UpdateTags(ctx context.Context, kind abstract.Enum, id string, lmap map[string]string) fail.Error

	// DeleteTags removes provider's tags
	DeleteTags(ctx context.Context, kind abstract.Enum, id string, keys []string) fail.Error
}

Stack is the interface to cloud stack

type StackProxy

type StackProxy struct {
	FullStack
	Name string
}

StackProxy ...

func (StackProxy) AddPublicIPToVIP

func (s StackProxy) AddPublicIPToVIP(ctx context.Context, ip *abstract.VirtualIP) (ferr fail.Error)

func (StackProxy) AddRuleToSecurityGroup

func (s StackProxy) AddRuleToSecurityGroup(ctx context.Context, sgParam stacks.SecurityGroupParameter, rule *abstract.SecurityGroupRule) (_ *abstract.SecurityGroup, ferr fail.Error)

func (StackProxy) BindHostToVIP

func (s StackProxy) BindHostToVIP(ctx context.Context, ip *abstract.VirtualIP, s2 string) (ferr fail.Error)

func (StackProxy) BindSecurityGroupToHost

func (s StackProxy) BindSecurityGroupToHost(ctx context.Context, sgParam stacks.SecurityGroupParameter, hostParam stacks.HostParameter) (ferr fail.Error)

func (StackProxy) ChangeSecurityGroupSecurity

func (s StackProxy) ChangeSecurityGroupSecurity(ctx context.Context, b bool, b2 bool, net string, s2 string) fail.Error

func (StackProxy) ClearHostStartupScript

func (s StackProxy) ClearHostStartupScript(ctx context.Context, parameter stacks.HostParameter) (ferr fail.Error)

func (StackProxy) ClearSecurityGroup

func (s StackProxy) ClearSecurityGroup(ctx context.Context, sgParam stacks.SecurityGroupParameter) (_ *abstract.SecurityGroup, ferr fail.Error)

func (StackProxy) CreateHost

func (s StackProxy) CreateHost(ctx context.Context, request abstract.HostRequest, extra interface{}) (_ *abstract.HostFull, _ *userdata.Content, ferr fail.Error)

func (StackProxy) CreateKeyPair

func (s StackProxy) CreateKeyPair(ctx context.Context, name string) (_ *abstract.KeyPair, ferr fail.Error)

func (StackProxy) CreateNetwork

func (s StackProxy) CreateNetwork(ctx context.Context, req abstract.NetworkRequest) (_ *abstract.Network, ferr fail.Error)

func (StackProxy) CreateSecurityGroup

func (s StackProxy) CreateSecurityGroup(ctx context.Context, networkRef, name, description string, rules abstract.SecurityGroupRules) (_ *abstract.SecurityGroup, ferr fail.Error)

func (StackProxy) CreateSubnet

func (s StackProxy) CreateSubnet(ctx context.Context, req abstract.SubnetRequest) (_ *abstract.Subnet, ferr fail.Error)

func (StackProxy) CreateVIP

func (s StackProxy) CreateVIP(ctx context.Context, networkID, subnetID, name string, securityGroups []string) (_ *abstract.VirtualIP, ferr fail.Error)

func (StackProxy) CreateVolume

func (s StackProxy) CreateVolume(ctx context.Context, request abstract.VolumeRequest) (_ *abstract.Volume, ferr fail.Error)

func (StackProxy) CreateVolumeAttachment

func (s StackProxy) CreateVolumeAttachment(ctx context.Context, request abstract.VolumeAttachmentRequest) (_ string, ferr fail.Error)

func (StackProxy) DeleteHost

func (s StackProxy) DeleteHost(ctx context.Context, parameter stacks.HostParameter) (ferr fail.Error)

func (StackProxy) DeleteKeyPair

func (s StackProxy) DeleteKeyPair(ctx context.Context, id string) (ferr fail.Error)

func (StackProxy) DeleteNetwork

func (s StackProxy) DeleteNetwork(ctx context.Context, id string) (ferr fail.Error)

func (StackProxy) DeleteRuleFromSecurityGroup

func (s StackProxy) DeleteRuleFromSecurityGroup(ctx context.Context, sgParam stacks.SecurityGroupParameter, rule *abstract.SecurityGroupRule) (_ *abstract.SecurityGroup, ferr fail.Error)

func (StackProxy) DeleteSecurityGroup

func (s StackProxy) DeleteSecurityGroup(ctx context.Context, group *abstract.SecurityGroup) (ferr fail.Error)

func (StackProxy) DeleteSubnet

func (s StackProxy) DeleteSubnet(ctx context.Context, id string) (ferr fail.Error)

func (StackProxy) DeleteVIP

func (s StackProxy) DeleteVIP(ctx context.Context, ip *abstract.VirtualIP) (ferr fail.Error)

func (StackProxy) DeleteVolume

func (s StackProxy) DeleteVolume(ctx context.Context, id string) (ferr fail.Error)

func (StackProxy) DeleteVolumeAttachment

func (s StackProxy) DeleteVolumeAttachment(ctx context.Context, serverID, id string) (ferr fail.Error)

func (StackProxy) ExportFromState added in v22.11.9

func (s StackProxy) ExportFromState(ctx context.Context, kind abstract.Enum, state *tfjson.State, input any, id string) (_ any, ferr fail.Error)

func (StackProxy) GetDefaultNetwork

func (s StackProxy) GetDefaultNetwork(ctx context.Context) (_ *abstract.Network, ferr fail.Error)

func (StackProxy) GetDefaultSecurityGroupName

func (s StackProxy) GetDefaultSecurityGroupName(ctx context.Context) (_ string, ferr fail.Error)

func (StackProxy) GetHostState

func (s StackProxy) GetHostState(ctx context.Context, parameter stacks.HostParameter) (_ hoststate.Enum, ferr fail.Error)

func (StackProxy) GetRawAuthenticationOptions

func (s StackProxy) GetRawAuthenticationOptions(ctx context.Context) (_ stacks.AuthenticationOptions, ferr fail.Error)

func (StackProxy) GetRawConfigurationOptions

func (s StackProxy) GetRawConfigurationOptions(ctx context.Context) (_ stacks.ConfigurationOptions, ferr fail.Error)

func (StackProxy) GetStackName

func (s StackProxy) GetStackName() (_ string, ferr fail.Error)

func (StackProxy) GetTerraformState added in v22.11.9

func (s StackProxy) GetTerraformState(ctx context.Context) (_ *tfjson.State, ferr fail.Error)

func (StackProxy) GetType added in v22.11.8

func (s StackProxy) GetType() (_ string, ferr fail.Error)

func (StackProxy) HasDefaultNetwork

func (s StackProxy) HasDefaultNetwork(ctx context.Context) (_ bool, ferr fail.Error)

func (StackProxy) InspectHost

func (s StackProxy) InspectHost(ctx context.Context, parameter stacks.HostParameter) (_ *abstract.HostFull, ferr fail.Error)

func (StackProxy) InspectImage

func (s StackProxy) InspectImage(ctx context.Context, id string) (_ *abstract.Image, ferr fail.Error)

func (StackProxy) InspectKeyPair

func (s StackProxy) InspectKeyPair(ctx context.Context, id string) (_ *abstract.KeyPair, ferr fail.Error)

func (StackProxy) InspectNetwork

func (s StackProxy) InspectNetwork(ctx context.Context, id string) (_ *abstract.Network, ferr fail.Error)

func (StackProxy) InspectNetworkByName

func (s StackProxy) InspectNetworkByName(ctx context.Context, name string) (_ *abstract.Network, ferr fail.Error)

func (StackProxy) InspectSecurityGroup

func (s StackProxy) InspectSecurityGroup(ctx context.Context, sgParam stacks.SecurityGroupParameter) (_ *abstract.SecurityGroup, ferr fail.Error)

func (StackProxy) InspectSubnet

func (s StackProxy) InspectSubnet(ctx context.Context, id string) (_ *abstract.Subnet, ferr fail.Error)

func (StackProxy) InspectSubnetByName

func (s StackProxy) InspectSubnetByName(ctx context.Context, networkID, name string) (_ *abstract.Subnet, ferr fail.Error)

func (StackProxy) InspectTemplate

func (s StackProxy) InspectTemplate(ctx context.Context, id string) (_ *abstract.HostTemplate, ferr fail.Error)

func (StackProxy) InspectVolume

func (s StackProxy) InspectVolume(ctx context.Context, id string) (_ *abstract.Volume, ferr fail.Error)

func (StackProxy) InspectVolumeAttachment

func (s StackProxy) InspectVolumeAttachment(ctx context.Context, serverID, id string) (_ *abstract.VolumeAttachment, ferr fail.Error)

func (StackProxy) ListAvailabilityZones

func (s StackProxy) ListAvailabilityZones(ctx context.Context) (_ map[string]bool, ferr fail.Error)

func (StackProxy) ListHosts

func (s StackProxy) ListHosts(ctx context.Context, b bool) (_ abstract.HostList, ferr fail.Error)

func (StackProxy) ListImages

func (s StackProxy) ListImages(ctx context.Context, all bool) (_ []*abstract.Image, ferr fail.Error)

func (StackProxy) ListKeyPairs

func (s StackProxy) ListKeyPairs(ctx context.Context) (_ []*abstract.KeyPair, ferr fail.Error)

func (StackProxy) ListNetworks

func (s StackProxy) ListNetworks(ctx context.Context) (_ []*abstract.Network, ferr fail.Error)

func (StackProxy) ListRegions

func (s StackProxy) ListRegions(ctx context.Context) (_ []string, ferr fail.Error)

func (StackProxy) ListSecurityGroups

func (s StackProxy) ListSecurityGroups(ctx context.Context, networkRef string) (_ []*abstract.SecurityGroup, ferr fail.Error)

func (StackProxy) ListSubnets

func (s StackProxy) ListSubnets(ctx context.Context, networkID string) (_ []*abstract.Subnet, ferr fail.Error)

func (StackProxy) ListTemplates

func (s StackProxy) ListTemplates(ctx context.Context, all bool) (_ []*abstract.HostTemplate, ferr fail.Error)

func (StackProxy) ListVolumeAttachments

func (s StackProxy) ListVolumeAttachments(ctx context.Context, serverID string) (_ []*abstract.VolumeAttachment, ferr fail.Error)

func (StackProxy) ListVolumes

func (s StackProxy) ListVolumes(ctx context.Context) (_ []*abstract.Volume, ferr fail.Error)

func (StackProxy) RebootHost

func (s StackProxy) RebootHost(ctx context.Context, parameter stacks.HostParameter) (ferr fail.Error)

func (StackProxy) Render added in v22.11.9

func (s StackProxy) Render(ctx context.Context, kind abstract.Enum, workDir string, options map[string]any) (_ []abstract.RenderedContent, ferr fail.Error)

func (StackProxy) StartHost

func (s StackProxy) StartHost(ctx context.Context, parameter stacks.HostParameter) (ferr fail.Error)

func (StackProxy) StopHost

func (s StackProxy) StopHost(ctx context.Context, host stacks.HostParameter, gracefully bool) (ferr fail.Error)

func (StackProxy) UnbindHostFromVIP

func (s StackProxy) UnbindHostFromVIP(ctx context.Context, ip *abstract.VirtualIP, s2 string) (ferr fail.Error)

func (StackProxy) UnbindSecurityGroupFromHost

func (s StackProxy) UnbindSecurityGroupFromHost(ctx context.Context, sgParam stacks.SecurityGroupParameter, hostParam stacks.HostParameter) (ferr fail.Error)

func (StackProxy) WaitHostReady

func (s StackProxy) WaitHostReady(ctx context.Context, hostParam stacks.HostParameter, timeout time.Duration) (_ *abstract.HostCore, ferr fail.Error)

type TerraformStack added in v22.11.9

type TerraformStack interface {
	// Render renders the Terraform template of the type kind into the workDir directory
	Render(ctx context.Context, kind abstract.Enum, workDir string, options map[string]any) ([]abstract.RenderedContent, fail.Error)

	// GetTerraformState returns the Terraform state of the stack
	GetTerraformState(ctx context.Context) (*tfjson.State, fail.Error)

	// ExportFromState extracts from the terraform state the information about the resource identified by id
	ExportFromState(ctx context.Context, kind abstract.Enum, state *tfjson.State, input any, id string) (any, fail.Error)
}

TerraformStack is the interface that all terraform drivers should implement

Jump to

Keyboard shortcuts

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