clients

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CredentialAPIKey     = ""
	CredentialProjectID  = ""
	CredentialFacilityID = ""
)

Using these constants causes Credential methods to return the credential configured values

Variables

This section is empty.

Functions

func IsNotFound

func IsNotFound(err error) bool

IsNotFound returns true if error is not found

func LateInitializeBoolPtr

func LateInitializeBoolPtr(in *bool, from *bool) *bool

LateInitializeBoolPtr returns in if it's non-nil, otherwise returns from

func LateInitializeIntPtr

func LateInitializeIntPtr(in *int, from *int) *int

LateInitializeIntPtr returns in if it's non-nil, otherwise returns from

func LateInitializeString

func LateInitializeString(in string, from *string) string

LateInitializeString returns `from` if `in` is empty and in other cases it returns `in`.

func LateInitializeStringPtr

func LateInitializeStringPtr(in *string, from *string) *string

LateInitializeStringPtr returns `from` if `in` is empty and in other cases it returns `in`.

Types

type Client

type Client struct {
	*Credentials

	Client *packngo.Client
}

Client is a structure that embeds Credentials for the purposes of defaulting to those credential supplied values during Equinix Metal API usage. This allows for the Device resource to not require a ProjectID, for example, since the provider was configured with a ProjectID.

func NewClient

func NewClient(ctx context.Context, credentials []byte) (*Client, error)

NewClient returns an Equinix Metal Client configured with credentials

type Credentials

type Credentials struct {
	APIKey     string `json:"apiKey"`
	ProjectID  string `json:"projectID"`
	FacilityID string `json:"facilityID"`
}

Credentials is a common credential format used by various Equinix Metal Kubernetes providers

func (*Credentials) GetAPIKey

func (c *Credentials) GetAPIKey(apiKey string) string

GetAPIKey returns the supplied APIKey or the APIKey included with the Client credentials (if any)

func (*Credentials) GetFacilityID

func (c *Credentials) GetFacilityID(facilityID string) string

GetFacilityID returns the supplied FacilityID or the FacilityID included with the Client credentials (if any)

func (*Credentials) GetProjectID

func (c *Credentials) GetProjectID(projectID string) string

GetProjectID returns the supplied ProjectID or the ProjectID included with the Client credentials (if any)

func (*Credentials) SetAPIKey

func (c *Credentials) SetAPIKey(apiKey string)

SetAPIKey sets the default APIKey for the client

func (*Credentials) SetFacilityID

func (c *Credentials) SetFacilityID(facilityID string)

SetFacilityID sets the default FacilityID for the client

func (*Credentials) SetProjectID

func (c *Credentials) SetProjectID(projectID string)

SetProjectID sets the default ProjectID for the client

type DefaultGetter

type DefaultGetter interface {
	GetProjectID(string) string
	GetFacilityID(string) string
}

DefaultGetter provides setters for common Equinix Metal client properties

type DefaultSetter

type DefaultSetter interface {
	SetProjectID(string)
	SetFacilityID(string)
}

DefaultSetter provides setters for common Equinix Metal client properties

type Defaulter

type Defaulter interface {
	DefaultGetter
	DefaultSetter
}

Defaulter provides getter and setters for common Equinix Metal client properties

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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