openstackclient

package
v0.33.0 Latest Latest
Warning

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

Go to latest
Published: May 5, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewComputeClient

func NewComputeClient(ctx context.Context, providerClient *gophercloud.ProviderClient, endpointOps gophercloud.EndpointOpts, authConfig AuthConfig) (*gophercloud.ServiceClient, error)

func NewHTTPClient

func NewHTTPClient(tlsCfg *tls.Config) http.Client

func NewProviderClient

func NewProviderClient(ctx context.Context, authConfig AuthConfig, cloudOpts *CloudOpts) (*gophercloud.ProviderClient, gophercloud.EndpointOpts, error)

Types

type AuthConfig

type AuthConfig interface {
	Parse() (gophercloud.AuthOptions, gophercloud.EndpointOpts, *tls.Config, error)
	HTTPOpts() (debug bool, computeApiVersion string)
}

type Client

type Client interface {
	GetImageProperties(ctx context.Context, imageRef string) (*ImageProperties, error)
	GetImageByName(ctx context.Context, imageName string) (string, *ImageProperties, error)
	ShowServerConsoleOutput(ctx context.Context, serverId string) (string, error)
	GetServer(ctx context.Context, serverId string) (*servers.Server, error)
	ListServers(ctx context.Context) ([]servers.Server, error)
	CreateServer(ctx context.Context, spec servers.CreateOptsBuilder, hintOpts servers.SchedulerHintOptsBuilder) (*servers.Server, error)
	DeleteServer(ctx context.Context, serverId string) error
}

func New

func New(ctx context.Context, authConfig AuthConfig, cloudOpts *CloudOpts) (Client, error)

type CloudConfig

type CloudConfig struct {
	ClientConfigFile  string `json:"client-config-file" env:"OS_CLIENT_CONFIG_FILE"`
	Cloud             string `json:"cloud" env:"OS_CLOUD"`
	RegionName        string `json:"region-name" env:"OS_REGION_NAME"`
	EndpointType      string `json:"endpoint-type" env:"OS_ENDPOINT_TYPE"`
	Debug             bool   `json:"debug" env:"OS_DEBUG"`
	ComputeApiVersion string `json:"compute-api-version" env:"OS_COMPUTE_API_VERSION" envDefault:"2.79"`
}

func (*CloudConfig) HTTPOpts

func (cloudConfig *CloudConfig) HTTPOpts() (debug bool, computeApiVersion string)

func (*CloudConfig) Parse

type CloudOpts

type CloudOpts struct {
	AllowReauth bool `envDefault:"true"`
}

type EnvCloudConfig

type EnvCloudConfig struct {
	CloudConfig `embed:"" yaml:",inline"`

	AuthURL                     string `json:"auth-url" env:"OS_AUTH_URL"`
	Username                    string `json:"username" env:"OS_USERNAME"`
	UserID                      string `json:"user-id" env:"OS_USER_ID"`
	Password                    string `json:"password" env:"OS_PASSWORD"`
	Passcode                    string `json:"passcode" env:"OS_PASSCODE"`
	ProjectName                 string `json:"project-name" env:"OS_PROJECT_NAME"`
	ProjectID                   string `json:"project-id" env:"OS_PROJECT_ID"`
	UserDomainName              string `json:"user-domain-name" env:"OS_USER_DOMAIN_NAME"`
	UserDomainID                string `json:"user-domain-id" env:"OS_USER_DOMAIN_ID"`
	ApplicationCredentialID     string `json:"application-credential-id" env:"OS_APPLICATION_CREDENTIAL_ID"`
	ApplicationCredentialName   string `json:"application-credential-name" env:"OS_APPLICATION_CREDENTIAL_NAME"`
	ApplicationCredentialSecret string `json:"application-credential-secret" env:"OS_APPLICATION_CREDENTIAL_SECRET"`
}

func (*EnvCloudConfig) Parse

type ImageProperties

type ImageProperties struct {
	// Architecture that must be supported by the hypervisor.
	Architecture string `json:"architecture,omitempty" mapstructure:"architecture,omitempty"`

	// OSType is the operating system installed on the image.
	OSType string `json:"os_type,omitempty" mapstructure:"os_type,omitempty"`

	// OSDistro is the common name of the operating system distribution in lowercase
	OSDistro string `json:"os_distro,omitempty" mapstructure:"os_distro,omitempty"`

	// OSVersion is the operating system version as specified by the distributor.
	OSVersion string `json:"os_version,omitempty" mapstructure:"os_version,omitempty"`

	// OSAdminUser is the default admin user name for the operating system
	OSAdminUser string `json:"os_admin_user,omitempty" mapstructure:"os_admin_user,omitempty"`
}

Some good known properties useful for setting up ConnectInfo

See also: https://docs.openstack.org/glance/latest/admin/useful-image-properties.html

Jump to

Keyboard shortcuts

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