oci

package
v0.0.0-...-b0bff92 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2021 License: AGPL-3.0 Imports: 52 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultConfigFolder is the default folder in which the OCI cli will
	// store its config files and keys
	DefaultConfigFolder = ".oci"

	// FallbackConfigFolder is the fallback config folder. Users that installed
	// an earlier version of the oracle CLI tool will have this folder instead of
	// ~/.oci
	FallbackConfigFolder = ".oraclebmc"
)
View Source
const (
	BareMetal      InstanceType = "metal"
	VirtualMachine InstanceType = "vm"
	GPUMachine     InstanceType = "gpu"

	// ImageTypeVM should be run on a virtual instance
	ImageTypeVM ImageType = "vm"
	// ImageTypeBM should be run on bare metal
	ImageTypeBM ImageType = "metal"
	// ImageTypeGPU should be run on an instance with attached GPUs
	ImageTypeGPU ImageType = "gpu"
	// ImageTypeGeneric should work on any type of instance (bare metal or virtual)
	ImageTypeGeneric ImageType = "generic"
)
View Source
const (
	// MinVolumeSizeMB is the minimum size in MB for a volume or boot disk
	MinVolumeSizeMB = 51200

	// MaxVolumeSizeMB is the maximum size in MB for a volume or boot disk
	MaxVolumeSizeMB = 16777216
)
View Source
const (
	// DefaultAddressSpace is the subnet to use for the default juju VCN
	// An individual subnet will be created from this class, for each
	// availability domain.
	DefaultAddressSpace = "10.0.0.0/16"
	AllowAllPrefix      = "0.0.0.0/0"

	SubnetPrefixLength = "24"

	VcnNamePrefix         = "juju-vcn"
	SecListNamePrefix     = "juju-seclist"
	InternetGatewayPrefix = "juju-ig"
	RouteTablePrefix      = "juju-rt"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AvailabilityZone

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

AvailabilityZone implements common.AvailabilityZone

func NewAvailabilityZone

func NewAvailabilityZone(name string) AvailabilityZone

NewAvailabilityZone returns a new availability zone

func (AvailabilityZone) Available

func (a AvailabilityZone) Available() bool

Available is specified on the common.AvailabilityZone interface

func (AvailabilityZone) Name

func (a AvailabilityZone) Name() string

Name is specified on the common.AvailabilityZone interface

type ComputeClient

type ComputeClient interface {
	ListVnicAttachments(ctx context.Context, compartmentID, instID *string) ([]ociCore.VnicAttachment, error)
	TerminateInstance(ctx context.Context, request ociCore.TerminateInstanceRequest) (ociCore.TerminateInstanceResponse, error)
	GetInstance(ctx context.Context, request ociCore.GetInstanceRequest) (ociCore.GetInstanceResponse, error)
	LaunchInstance(ctx context.Context, request ociCore.LaunchInstanceRequest) (ociCore.LaunchInstanceResponse, error)
	ListInstances(ctx context.Context, compartmentID *string) ([]ociCore.Instance, error)
	ListShapes(ctx context.Context, compartmentID, imageID *string) ([]ociCore.Shape, error)
	ListImages(ctx context.Context, compartmentID *string) ([]ociCore.Image, error)
	ListVolumeAttachments(ctx context.Context, compartmentID, instID *string) ([]ociCore.VolumeAttachment, error)
	GetVolumeAttachment(ctx context.Context, request ociCore.GetVolumeAttachmentRequest) (ociCore.GetVolumeAttachmentResponse, error)
	DetachVolume(ctx context.Context, request ociCore.DetachVolumeRequest) (ociCore.DetachVolumeResponse, error)
	AttachVolume(ctx context.Context, request ociCore.AttachVolumeRequest) (ociCore.AttachVolumeResponse, error)
}

type Environ

type Environ struct {
	environs.NoSpaceDiscoveryEnviron

	Compute    ComputeClient
	Networking NetworkingClient
	Storage    StorageClient
	Firewall   FirewallClient
	Identity   IdentityClient
	// contains filtered or unexported fields
}

func (*Environ) AdoptResources

func (e *Environ) AdoptResources(ctx envcontext.ProviderCallContext, controllerUUID string, fromVersion version.Number) error

AdoptResources implements environs.Environ.

func (*Environ) AllInstances

func (e *Environ) AllInstances(ctx envcontext.ProviderCallContext) ([]instances.Instance, error)

AllInstances implements environs.InstanceBroker.

func (*Environ) AllRunningInstances

func (e *Environ) AllRunningInstances(ctx envcontext.ProviderCallContext) ([]instances.Instance, error)

AllRunningInstances implements environs.InstanceBroker.

func (*Environ) AllocateContainerAddresses

func (e *Environ) AllocateContainerAddresses(
	ctx envcontext.ProviderCallContext,
	hostInstanceID instance.Id,
	containerTag names.MachineTag,
	preparedInfo network.InterfaceInfos,
) (network.InterfaceInfos, error)

func (*Environ) AreSpacesRoutable

func (e *Environ) AreSpacesRoutable(ctx envcontext.ProviderCallContext, space1, space2 *environs.ProviderSpaceInfo) (bool, error)

func (*Environ) AvailabilityZones

AvailabilityZones is defined in the common.ZonedEnviron interface

func (*Environ) Bootstrap

Bootstrap implements environs.Environ.

func (*Environ) ClosePorts

func (e *Environ) ClosePorts(ctx context.ProviderCallContext, rules firewall.IngressRules) error

func (*Environ) Config

func (e *Environ) Config() *config.Config

Config implements environs.ConfigGetter.

func (*Environ) ConstraintsValidator

func (e *Environ) ConstraintsValidator(ctx envcontext.ProviderCallContext) (constraints.Validator, error)

ConstraintsValidator implements environs.Environ.

func (*Environ) ControllerInstances

func (e *Environ) ControllerInstances(ctx envcontext.ProviderCallContext, controllerUUID string) ([]instance.Id, error)

ControllerInstances implements environs.Environ.

func (*Environ) Create

Create implements environs.Environ.

func (*Environ) DeriveAvailabilityZones

func (e *Environ) DeriveAvailabilityZones(ctx envcontext.ProviderCallContext, args environs.StartInstanceParams) ([]string, error)

DeriveAvailabilityZones implements common.ZonedEnviron.

func (*Environ) Destroy

func (e *Environ) Destroy(ctx envcontext.ProviderCallContext) error

Destroy implements environs.Environ.

func (*Environ) DestroyController

func (e *Environ) DestroyController(ctx envcontext.ProviderCallContext, controllerUUID string) error

DestroyController implements environs.Environ.

func (*Environ) IngressRules

func (*Environ) InstanceAvailabilityZoneNames

func (e *Environ) InstanceAvailabilityZoneNames(ctx envcontext.ProviderCallContext, ids []instance.Id) (map[instance.Id]string, error)

InstanceAvailabilityZoneNames implements common.ZonedEnviron.

func (*Environ) InstanceTypes

InstanceTypes implements environs.InstancePrechecker.

func (*Environ) Instances

func (e *Environ) Instances(ctx envcontext.ProviderCallContext, ids []instance.Id) ([]instances.Instance, error)

Instances implements environs.Environ.

func (*Environ) NetworkInterfaces

func (e *Environ) NetworkInterfaces(ctx envcontext.ProviderCallContext, ids []instance.Id) ([]network.InterfaceInfos, error)

func (*Environ) OpenPorts

func (e *Environ) OpenPorts(ctx context.ProviderCallContext, rules firewall.IngressRules) error

func (*Environ) PrecheckInstance

PrecheckInstance implements environs.InstancePrechecker.

func (*Environ) PrepareForBootstrap

func (e *Environ) PrepareForBootstrap(ctx environs.BootstrapContext, controllerName string) error

PrepareForBootstrap implements environs.Environ.

func (*Environ) Provider

func (e *Environ) Provider() environs.EnvironProvider

Provider implements environs.Environ.

func (*Environ) ReleaseContainerAddresses

func (e *Environ) ReleaseContainerAddresses(ctx envcontext.ProviderCallContext, interfaces []network.ProviderInterfaceInfo) error

func (*Environ) SSHAddresses

func (*Environ) SetConfig

func (e *Environ) SetConfig(cfg *config.Config) error

SetConfig implements environs.Environ.

func (*Environ) StartInstance

StartInstance implements environs.InstanceBroker.

func (*Environ) StopInstances

func (e *Environ) StopInstances(ctx envcontext.ProviderCallContext, ids ...instance.Id) error

StopInstances implements environs.InstanceBroker.

func (*Environ) StorageProvider

func (e *Environ) StorageProvider(t storage.ProviderType) (storage.Provider, error)

StorageProvider implements storage.ProviderRegistry.

func (*Environ) StorageProviderTypes

func (e *Environ) StorageProviderTypes() ([]storage.ProviderType, error)

StorageProviderTypes implements storage.ProviderRegistry.

func (*Environ) Subnets

func (e *Environ) Subnets(
	ctx envcontext.ProviderCallContext, id instance.Id, subnets []network.Id,
) ([]network.SubnetInfo, error)

Subnets is defined on the environs.Networking interface.

func (*Environ) SuperSubnets

func (e *Environ) SuperSubnets(ctx envcontext.ProviderCallContext) ([]string, error)

func (*Environ) SupportsContainerAddresses

func (e *Environ) SupportsContainerAddresses(ctx envcontext.ProviderCallContext) (bool, error)

func (*Environ) SupportsSpaces

func (e *Environ) SupportsSpaces(envcontext.ProviderCallContext) (bool, error)

type EnvironProvider

type EnvironProvider struct{}

EnvironProvider type implements environs.EnvironProvider interface

func (EnvironProvider) CloudSchema

func (e EnvironProvider) CloudSchema() *jsonschema.Schema

CloudSchema implements environs.EnvironProvider.

func (*EnvironProvider) ConfigDefaults

func (o *EnvironProvider) ConfigDefaults() schema.Defaults

ConfigDefaults implements config.ConfigSchemaSource

func (*EnvironProvider) ConfigSchema

func (o *EnvironProvider) ConfigSchema() schema.Fields

ConfigSchema implements config.ConfigSchemaSource

func (EnvironProvider) CredentialSchemas

func (e EnvironProvider) CredentialSchemas() map[cloud.AuthType]cloud.CredentialSchema

CredentialSchemas implements environs.ProviderCredentials.

func (EnvironProvider) DetectCredentials

func (e EnvironProvider) DetectCredentials(cloudName string) (*cloud.CloudCredential, error)

DetectCredentials implements environs.ProviderCredentials. Configuration options for the OCI SDK are detailed here: https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/sdkconfig.htm

func (EnvironProvider) FinalizeCredential

FinalizeCredential implements environs.ProviderCredentials.

func (*EnvironProvider) Open

Open implements environs.EnvironProvider.

func (*EnvironProvider) Ping

func (e *EnvironProvider) Ping(ctx context.ProviderCallContext, endpoint string) error

Ping implements environs.EnvironProvider.

func (EnvironProvider) PrepareConfig

func (e EnvironProvider) PrepareConfig(args environs.PrepareConfigParams) (*config.Config, error)

PrepareConfig implements environs.EnvironProvider.

func (*EnvironProvider) Schema

func (o *EnvironProvider) Schema() environschema.Fields

Schema implements environs.ProviderSchema

func (EnvironProvider) Validate

func (e EnvironProvider) Validate(cfg, old *config.Config) (valid *config.Config, err error)

Validate implements config.Validator.

func (EnvironProvider) Version

func (e EnvironProvider) Version() int

Version implements environs.EnvironProvider.

type FirewallClient

type FirewallClient interface {
	CreateSecurityList(ctx context.Context, request ociCore.CreateSecurityListRequest) (ociCore.CreateSecurityListResponse, error)
	ListSecurityLists(ctx context.Context, compartmentID, vcnID *string) ([]ociCore.SecurityList, error)
	DeleteSecurityList(ctx context.Context, request ociCore.DeleteSecurityListRequest) (ociCore.DeleteSecurityListResponse, error)
	GetSecurityList(ctx context.Context, request ociCore.GetSecurityListRequest) (ociCore.GetSecurityListResponse, error)
}

type IdentityClient

type IdentityClient interface {
	ListAvailabilityDomains(ctx context.Context, request ociIdentity.ListAvailabilityDomainsRequest) (ociIdentity.ListAvailabilityDomainsResponse, error)
}

type ImageCache

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

ImageCache holds a cache of all provider images for a fixed amount of time before it becomes stale

func (*ImageCache) ImageMap

func (i *ImageCache) ImageMap() map[string][]InstanceImage

func (ImageCache) ImageMetadata

func (i ImageCache) ImageMetadata(series string, defaultVirtType string) []*imagemetadata.ImageMetadata

ImageMetadata returns an array of imagemetadata.ImageMetadata for all images that are currently in cache, matching the provided series If defaultVirtType is specified, all generic images will inherit the value of defaultVirtType.

func (*ImageCache) SetImages

func (i *ImageCache) SetImages(images map[string][]InstanceImage)

func (*ImageCache) SetLastRefresh

func (i *ImageCache) SetLastRefresh(t time.Time)

SetLastRefresh sets the lastRefresh attribute of ImageCache This is used mostly for testing purposes

func (ImageCache) SupportedShapes

func (i ImageCache) SupportedShapes(series string) []instances.InstanceType

SupportedShapes returns the InstanceTypes available for images matching the supplied series

type ImageType

type ImageType string

type ImageVersion

type ImageVersion struct {
	TimeStamp time.Time
	Revision  int
}

func NewImageVersion

func NewImageVersion(img ociCore.Image) (ImageVersion, error)

type InstanceImage

type InstanceImage struct {
	// ImageType determines which type of image this is. Valid values are:
	// vm, baremetal and generic
	ImageType ImageType
	// Id is the provider ID of the image
	Id string
	// Series is the series as known by juju
	Series string
	// Version is the version of the image
	Version ImageVersion
	// Raw stores the core.Image object
	Raw ociCore.Image

	// CompartmentId is the compartment Id where this image is available
	CompartmentId *string

	// InstanceTypes holds a list of shapes compatible with this image
	InstanceTypes []instances.InstanceType
}

InstanceImage aggregates information pertinent to provider supplied images (eg: shapes it ca run on, type of instance it can run on, etc)

func NewInstanceImage

func NewInstanceImage(img ociCore.Image, compartmentID *string) (imgType InstanceImage, err error)

func (*InstanceImage) SetInstanceTypes

func (i *InstanceImage) SetInstanceTypes(types []instances.InstanceType)

type InstanceType

type InstanceType string

type NetworkingClient

type NetworkingClient interface {
	CreateVcn(ctx context.Context, request ociCore.CreateVcnRequest) (ociCore.CreateVcnResponse, error)
	DeleteVcn(ctx context.Context, request ociCore.DeleteVcnRequest) (ociCore.DeleteVcnResponse, error)
	ListVcns(ctx context.Context, compartmentID *string) ([]ociCore.Vcn, error)
	GetVcn(ctx context.Context, request ociCore.GetVcnRequest) (ociCore.GetVcnResponse, error)

	CreateSubnet(ctx context.Context, request ociCore.CreateSubnetRequest) (ociCore.CreateSubnetResponse, error)
	ListSubnets(ctx context.Context, compartmentID, vcnID *string) ([]ociCore.Subnet, error)
	DeleteSubnet(ctx context.Context, request ociCore.DeleteSubnetRequest) (ociCore.DeleteSubnetResponse, error)
	GetSubnet(ctx context.Context, request ociCore.GetSubnetRequest) (ociCore.GetSubnetResponse, error)

	CreateInternetGateway(ctx context.Context, request ociCore.CreateInternetGatewayRequest) (ociCore.CreateInternetGatewayResponse, error)
	GetInternetGateway(ctx context.Context, request ociCore.GetInternetGatewayRequest) (ociCore.GetInternetGatewayResponse, error)
	ListInternetGateways(ctx context.Context, compartmentID, vcnID *string) ([]ociCore.InternetGateway, error)
	DeleteInternetGateway(ctx context.Context, request ociCore.DeleteInternetGatewayRequest) (ociCore.DeleteInternetGatewayResponse, error)

	CreateRouteTable(ctx context.Context, request ociCore.CreateRouteTableRequest) (ociCore.CreateRouteTableResponse, error)
	GetRouteTable(ctx context.Context, request ociCore.GetRouteTableRequest) (ociCore.GetRouteTableResponse, error)
	DeleteRouteTable(ctx context.Context, request ociCore.DeleteRouteTableRequest) (ociCore.DeleteRouteTableResponse, error)
	ListRouteTables(ctx context.Context, compartmentID, vcnID *string) ([]ociCore.RouteTable, error)

	GetVnic(ctx context.Context, request ociCore.GetVnicRequest) (ociCore.GetVnicResponse, error)
}

type OCIRenderer

type OCIRenderer struct{}

OCIRenderer implements the renderers.ProviderRenderer interface

func (OCIRenderer) Render

func (OCIRenderer) Render(cfg cloudinit.CloudConfig, os jujuos.OSType) ([]byte, error)

Renderer is defined in the renderers.ProviderRenderer interface

type ShapeSpec

type ShapeSpec struct {
	// Cpus is the number of CPU cores available to the instance
	Cpus int
	// Gpus is the number of GPUs available to this instance
	Gpus int
	// Memory is the amount of RAM available to the instance in MB
	Memory int
	// Bandwidth is the network bandwidth in Gbps. Where there are multiple physical NICs, the speed of the fastest is used.
	Bandwidth float32
	Type      InstanceType
	Tags      []string
}

ShapeSpec holds information about a shapes resource allocation

type StorageAPI

type StorageAPI interface{}

type StorageClient

type StorageClient interface {
	CreateVolume(ctx context.Context, request ociCore.CreateVolumeRequest) (ociCore.CreateVolumeResponse, error)
	ListVolumes(ctx context.Context, compartmentID *string) ([]ociCore.Volume, error)
	GetVolume(ctx context.Context, request ociCore.GetVolumeRequest) (ociCore.GetVolumeResponse, error)
	DeleteVolume(ctx context.Context, request ociCore.DeleteVolumeRequest) (ociCore.DeleteVolumeResponse, error)
	UpdateVolume(ctx context.Context, request ociCore.UpdateVolumeRequest) (ociCore.UpdateVolumeResponse, error)
}

Directories

Path Synopsis
Package testing is a generated GoMock package.
Package testing is a generated GoMock package.

Jump to

Keyboard shortcuts

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