juju: github.com/juju/juju/environs/instances Index | Files | Directories

package instances

import "github.com/juju/juju/environs/instances"

Index

Package Files

image.go instance.go instancetype.go

func CpuPower Uses

func CpuPower(power uint64) *uint64

type ByName Uses

type ByName []InstanceType

func (ByName) Len Uses

func (bt ByName) Len() int

func (ByName) Less Uses

func (bt ByName) Less(i, j int) bool

func (ByName) Swap Uses

func (bt ByName) Swap(i, j int)

type Image Uses

type Image struct {
    Id   string
    Arch string
    // The type of virtualisation supported by this image.
    VirtType string
}

Image holds the attributes that vary amongst relevant images for a given series in a given region.

func ImageMetadataToImages Uses

func ImageMetadataToImages(inputs []*imagemetadata.ImageMetadata) []Image

ImageMetadataToImages converts an array of ImageMetadata pointers (as returned by imagemetadata.Fetch) to an array of Image objects (as required by instances.FindInstanceSpec).

type Instance Uses

type Instance interface {
    // Id returns a provider-generated identifier for the Instance.
    Id() instance.Id

    // Status returns the provider-specific status for the instance.
    Status(context.ProviderCallContext) instance.Status

    // Addresses returns a list of hostnames or ip addresses
    // associated with the instance.
    Addresses(context.ProviderCallContext) (corenetwork.ProviderAddresses, error)
}

Instance represents the the realization of a machine in state.

type InstanceConstraint Uses

type InstanceConstraint struct {
    Region      string
    Series      string
    Arches      []string
    Constraints constraints.Value

    // Storage specifies a list of storage types, in order of preference.
    // eg ["ssd", "ebs"] means find images with ssd storage, but if none
    // exist, find those with ebs instead.
    Storage []string
}

InstanceConstraint constrains the possible instances that may be chosen by the environment provider.

func (*InstanceConstraint) String Uses

func (ic *InstanceConstraint) String() string

String returns a human readable form of this InstanceConstraint.

type InstanceFirewaller Uses

type InstanceFirewaller interface {
    // OpenPorts opens the given port ranges on the instance, which
    // should have been started with the given machine id.
    OpenPorts(ctx context.ProviderCallContext, machineId string, rules []network.IngressRule) error

    // ClosePorts closes the given port ranges on the instance, which
    // should have been started with the given machine id.
    ClosePorts(ctx context.ProviderCallContext, machineId string, rules []network.IngressRule) error

    // IngressRules returns the set of ingress rules for the instance,
    // which should have been applied to the given machine id. The
    // rules are returned as sorted by network.SortIngressRules().
    // It is expected that there be only one ingress rule result for a given
    // port range - the rule's SourceCIDRs will contain all applicable source
    // address rules for that port range.
    IngressRules(ctx context.ProviderCallContext, machineId string) ([]network.IngressRule, error)
}

InstanceFirewaller provides instance-level firewall functionality

type InstanceSpec Uses

type InstanceSpec struct {
    InstanceType InstanceType
    Image        Image
    // contains filtered or unexported fields
}

InstanceSpec holds an instance type name and the chosen image info.

func FindInstanceSpec Uses

func FindInstanceSpec(possibleImages []Image, ic *InstanceConstraint, allInstanceTypes []InstanceType) (*InstanceSpec, error)

FindInstanceSpec returns an InstanceSpec satisfying the supplied InstanceConstraint. possibleImages contains a list of images matching the InstanceConstraint. allInstanceTypes provides information on every known available instance type (name, memory, cpu cores etc) on which instances can be run. The InstanceConstraint is used to filter allInstanceTypes and then a suitable image compatible with the matching instance types is returned.

type InstanceType Uses

type InstanceType struct {
    Id       string
    Name     string
    Arches   []string
    CpuCores uint64
    Mem      uint64
    Cost     uint64
    RootDisk uint64
    // These attributes are not supported by all clouds.
    VirtType   *string // The type of virtualisation used by the hypervisor, must match the image.
    CpuPower   *uint64
    Tags       []string
    Deprecated bool
}

InstanceType holds all relevant attributes of the various instance types.

func MatchingInstanceTypes Uses

func MatchingInstanceTypes(allInstanceTypes []InstanceType, region string, cons constraints.Value) ([]InstanceType, error)

MatchingInstanceTypes returns all instance types matching constraints and available in region, sorted by increasing region-specific cost (if known).

type InstanceTypesWithCostMetadata Uses

type InstanceTypesWithCostMetadata struct {
    // InstanceTypes holds the array of InstanceTypes affected by this cost scheme.
    InstanceTypes []InstanceType
    // CostUnit holds the unit in which the InstanceType.Cost is expressed.
    CostUnit string
    // CostCurrency holds the currency in which InstanceType.Cost is expressed.
    CostCurrency string
    // CostDivisor indicates a number that must be applied to InstanceType.Cost to obtain
    // a number that is in CostUnit.
    // If 0 it means that InstanceType.Cost is already expressed in CostUnit.
    CostDivisor uint64
}

InstanceTypesWithCostMetadata holds an array of InstanceType and metadata about their cost.

Directories

PathSynopsis
instancetest

Package instances imports 11 packages (graph) and is imported by 317 packages. Updated 2019-09-28. Refresh now. Tools for package owners.