openstack

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2024 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Overview

Package openstack implements the fetcher interface to fetch instances from Openstack resource manager

Index

Constants

View Source
const (
	NOSTATE = iota
	RUNNING

	PAUSED
	SHUTDOWN

	CRASHED
	SUSPENDED
)
View Source
const RFC3339MilliNoZ = "2006-01-02T15:04:05.999999"

Variables

This section is empty.

Functions

func New

func New(cluster models.Cluster, logger log.Logger) (resource.Fetcher, error)

New returns a new openstackManager that returns compute instances.

Types

type AttachedVolume

type AttachedVolume struct {
	ID string `json:"id"`
}

type Fault

type Fault struct {
	Code    int       `json:"code"`
	Created time.Time `json:"created"`
	Details string    `json:"details"`
	Message string    `json:"message"`
}

type Flavor

type Flavor struct {
	// ID is the flavor's unique ID.
	ID string `json:"id"`

	// Disk is the amount of root disk, measured in GB.
	Disk int `json:"disk"`

	// RAM is the amount of memory, measured in MB.
	RAM int `json:"ram"`

	// Name is the name of the flavor.
	Name string `json:"original_name"`

	// RxTxFactor describes bandwidth alterations of the flavor.
	RxTxFactor float64 `json:"rxtx_factor"`

	// Swap is the amount of swap space, measured in MB.
	Swap int `json:"-"`

	// VCPUs indicates how many (virtual) CPUs are available for this flavor.
	VCPUs int `json:"vcpus"`

	// IsPublic indicates whether the flavor is public.
	IsPublic bool `json:"os-flavor-access:is_public"`

	// Ephemeral is the amount of ephemeral disk space, measured in GB.
	Ephemeral int `json:"OS-FLV-EXT-DATA:ephemeral"`

	// Description is a free form description of the flavor. Limited to
	// 65535 characters in length. Only printable characters are allowed.
	// New in version 2.55
	Description string `json:"description"`

	// Properties is a dictionary of the flavor’s extra-specs key-and-value
	// pairs. This will only be included if the user is allowed by policy to
	// index flavor extra_specs
	// New in version 2.61
	ExtraSpecs map[string]string `json:"extra_specs"`
}

Flavor represent (virtual) hardware configurations for server resources in a region.

func (*Flavor) UnmarshalJSON

func (r *Flavor) UnmarshalJSON(b []byte) error

type FlavorsResponse

type FlavorsResponse struct {
	Flavors []Flavor `json:"flavors"`
}

type JSONRFC3339MilliNoZ

type JSONRFC3339MilliNoZ time.Time

func (*JSONRFC3339MilliNoZ) UnmarshalJSON

func (jt *JSONRFC3339MilliNoZ) UnmarshalJSON(data []byte) error

type PowerState

type PowerState int

func (PowerState) String

func (r PowerState) String() string

type Project

type Project struct {
	// IsDomain indicates whether the project is a domain.
	IsDomain bool `json:"is_domain"`

	// Description is the description of the project.
	Description string `json:"description"`

	// DomainID is the domain ID the project belongs to.
	DomainID string `json:"domain_id"`

	// Enabled is whether or not the project is enabled.
	Enabled bool `json:"enabled"`

	// ID is the unique ID of the project.
	ID string `json:"id"`

	// Name is the name of the project.
	Name string `json:"name"`

	// ParentID is the parent_id of the project.
	ParentID string `json:"parent_id"`

	// Tags is the list of tags associated with the project.
	Tags []string `json:"tags,omitempty"`
}

Project represents an OpenStack Identity Project.

type ProjectsResponse

type ProjectsResponse struct {
	Projects []Project `json:"projects"`
}

type Server

type Server struct {
	// ID uniquely identifies this server amongst all other servers,
	// including those not accessible to the current tenant.
	ID string `json:"id"`

	// TenantID identifies the tenant owning this server resource.
	TenantID string `json:"tenant_id"`

	// UserID uniquely identifies the user account owning the tenant.
	UserID string `json:"user_id"`

	// Name contains the human-readable name for the server.
	Name string `json:"name"`

	// Updated and Created contain ISO-8601 timestamps of when the state of the
	// server last changed, and when it was created.
	UpdatedAt time.Time `json:"updated"`
	CreatedAt time.Time `json:"created"`

	// HostID is the host where the server is located in the cloud.
	HostID string `json:"hostid"`

	// Status contains the current operational status of the server,
	// such as IN_PROGRESS or ACTIVE.
	Status string `json:"status"`

	// Flavor refers to a JSON object, which itself indicates the hardware
	// configuration of the deployed server.
	Flavor Flavor `json:"flavor"`

	// Metadata includes a list of all user-specified key-value pairs attached
	// to the server.
	Metadata map[string]string `json:"metadata"`

	// AttachedVolumes includes the volume attachments of this instance
	AttachedVolumes []AttachedVolume `json:"os-extended-volumes:volumes_attached"`

	// Fault contains failure information about a server.
	Fault Fault `json:"fault"`

	// Tags is a slice/list of string tags in a server.
	// The requires microversion 2.26 or later.
	Tags []string `json:"tags"`

	// ServerGroups is a slice of strings containing the UUIDs of the
	// server groups to which the server belongs. Currently this can
	// contain at most one entry.
	// New in microversion 2.71
	ServerGroups []string `json:"server_groups"`

	// Host is the host/hypervisor that the instance is hosted on.
	Host string `json:"OS-EXT-SRV-ATTR:host"`

	// InstanceName is the name of the instance.
	InstanceName string `json:"OS-EXT-SRV-ATTR:instance_name"`

	// HypervisorHostname is the hostname of the host/hypervisor that the
	// instance is hosted on.
	HypervisorHostname string `json:"OS-EXT-SRV-ATTR:hypervisor_hostname"`

	// ReservationID is the reservation ID of the instance.
	// This requires microversion 2.3 or later.
	ReservationID string `json:"OS-EXT-SRV-ATTR:reservation_id"`

	// LaunchIndex is the launch index of the instance.
	// This requires microversion 2.3 or later.
	LaunchIndex int `json:"OS-EXT-SRV-ATTR:launch_index"`

	TaskState  string     `json:"OS-EXT-STS:task_state"`
	VMState    string     `json:"OS-EXT-STS:vm_state"`
	PowerState PowerState `json:"OS-EXT-STS:power_state"`

	LaunchedAt   time.Time `json:"-"`
	TerminatedAt time.Time `json:"-"`

	// AvailabilityZone is the availability zone the server is in.
	AvailabilityZone string `json:"OS-EXT-AZ:availability_zone"`
}

Server represents a server/instance in the OpenStack cloud.

func (*Server) UnmarshalJSON

func (r *Server) UnmarshalJSON(b []byte) error

type ServersResponse

type ServersResponse struct {
	Servers []Server `json:"servers"`
}

type Timespan

type Timespan time.Duration

Timespan is a custom type to format time.Duration.

func (Timespan) Format

func (t Timespan) Format(format string) string

Format formats the time.Duration.

type User

type User struct {
	// DefaultProjectID is the ID of the default project of the user.
	DefaultProjectID string `json:"default_project_id"`

	// Description is the description of the user.
	Description string `json:"description"`

	// DomainID is the domain ID the user belongs to.
	DomainID string `json:"domain_id"`

	// Enabled is whether or not the user is enabled.
	Enabled bool `json:"enabled"`

	// ID is the unique ID of the user.
	ID string `json:"id"`

	// Links contains referencing links to the user.
	Links map[string]any `json:"links"`

	// Name is the name of the user.
	Name string `json:"name"`
}

User represents a User in the OpenStack Identity Service.

type UsersResponse

type UsersResponse struct {
	Users []User `json:"users"`
}

Jump to

Keyboard shortcuts

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