configuration

package
v1.3.63 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: MPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const QjwtExtension = ".qjwt"

Variables

This section is empty.

Functions

func KeyForGLClientMap

func KeyForGLClientMap() string

KeyForGLClientMap is used by the GL terraform provider to set the key in the map of clients that it creates. The Metal client will be found using the key returned here.

Types

type Config

type Config struct {

	// Exported fields
	PortalURL string
	Client    *rest.APIClient
	// we will cache this here for the life of the provider
	AvailableResources rest.AvailableResources
	// contains filtered or unexported fields
}

Config holds all the information required to talk to the portal.

func NewConfig

func NewConfig(portalURL string, opts ...CreateOpt) (*Config, error)

func (*Config) GetContext

func (c *Config) GetContext() context.Context

GetContext is used to retrieve the context. If the token retrieve function is nil the context in Config is returned If there is a token retrieve function it is executed to retrieve a GL IAM token, which is placed in the context before it is returned. If we get an error we log it and return the context with the new token.

func (*Config) GetLocationID

func (c *Config) GetLocationID(locationName string) (locationID string, err error)

func (*Config) GetLocationName

func (c *Config) GetLocationName(locationID string) (string, error)

func (*Config) GetStoragePoolID added in v1.3.43

func (c *Config) GetStoragePoolID(storagePoolName string) (string, error)

func (*Config) GetStoragePoolName added in v1.3.43

func (c *Config) GetStoragePoolName(storagePoolID string) (string, error)

func (*Config) GetVolumeCollectionID added in v1.3.45

func (c *Config) GetVolumeCollectionID(vcolName string) (string, error)

GetVolumeCollectionID returns volume collection ID from volume collection name.

func (*Config) GetVolumeCollectionName added in v1.3.45

func (c *Config) GetVolumeCollectionName(vcolID string) (string, error)

GetVolumeCollectionName return the ID of the volume collection.

func (*Config) GetVolumeFlavorName

func (c *Config) GetVolumeFlavorName(flavorID string) (string, error)

func (*Config) IsHosterContext

func (c *Config) IsHosterContext() bool

IsHosterContext determines whether the provider configuration is project scope or hoster scope when GL IAM token is used. Project operations with Metal token not supported yet via Terraform, so 'false' is returned in this case. The scope determines what Metal APIs are allowed. Project resource create/delete/update requires Hoster scope configuration and, the remaining resources require Project scope configuration Project.

func (*Config) RefreshAvailableResources

func (c *Config) RefreshAvailableResources() error

type CreateOpt

type CreateOpt func(c *Config)

CreateOpt defines a create option.

func WithGLToken

func WithGLToken(g bool) CreateOpt

WithGLToken returns a create option with the provided GreenLake token.

func WithRole added in v1.3.54

func WithRole(r string) CreateOpt

WithRole returns a create option with the provided role.

func WithTRF

WithTRF this create option is for use by the hpegl terraform provider It is used to pass-in a token retrieve function which is used to get a GL IAM token. Behind the scenes tokens are generated and refreshed if they are due to expire

func WithWorkspace added in v1.3.54

func WithWorkspace(w string) CreateOpt

WithWorkspace returns a create option with the provided workspace.

type Qjwt

type Qjwt struct {
	RestURL     string `yaml:"rest_url"`
	OriginalURL string `yaml:"original_url"`
	User        string `yaml:"user"`
	Token       string `yaml:"jwt"`
	MemberID    string `yaml:"member_id"`
	NoTLS       bool   `yaml:"no_tls"`
}

Qjwt declares the contents of the login file.

Jump to

Keyboard shortcuts

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