metadata

package
v0.0.0-...-7df4f84 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: Apache-2.0 Imports: 12 Imported by: 3

Documentation

Index

Constants

View Source
const (
	ENDPOINT           = "http://100.100.100.200"
	DNS_NAMESERVERS    = "dns-conf/nameservers"
	EIPV4              = "eipv4"
	HOSTNAME           = "hostname"
	IMAGE_ID           = "image-id"
	INSTANCE_ID        = "instance-id"
	MAC                = "mac"
	NETWORK_TYPE       = "network-type"
	NTP_CONF_SERVERS   = "ntp-conf/ntp-servers"
	OWNER_ACCOUNT_ID   = "owner-account-id"
	PRIVATE_IPV4       = "private-ipv4"
	REGION             = "region-id"
	SERIAL_NUMBER      = "serial-number"
	SOURCE_ADDRESS     = "source-address"
	VPC_CIDR_BLOCK     = "vpc-cidr-block"
	VPC_ID             = "vpc-id"
	VSWITCH_CIDR_BLOCK = "vswitch-cidr-block"
	VSWITCH_ID         = "vswitch-id"
	ZONE               = "zone-id"
	RAM_SECURITY       = "Ram/security-credentials"
)

const vars

Variables

This section is empty.

Functions

This section is empty.

Types

type Attempt

type Attempt struct {
	// contains filtered or unexported fields
}

Attempt struct

func (*Attempt) HasNext

func (a *Attempt) HasNext() bool

HasNext returns whether another attempt will be made if the current one fails. If it returns true, the following call to Next is guaranteed to return true.

func (*Attempt) Next

func (a *Attempt) Next() bool

Next waits until it is time to perform the next attempt or returns false if it is time to stop trying.

type AttemptStrategy

type AttemptStrategy struct {
	Total time.Duration // total duration of attempt.
	Delay time.Duration // interval between each try in the burst.
	Min   int           // minimum number of retries; overrides Total
}

AttemptStrategy represents a strategy for waiting for an action to complete successfully. This is an internal type used by the implementation of other packages.

func (AttemptStrategy) Start

func (s AttemptStrategy) Start() *Attempt

Start begins a new sequence of attempts for the given strategy.

type IMetaDataRequest

type IMetaDataRequest interface {
	Version(version string) IMetaDataRequest
	ResourceType(rtype string) IMetaDataRequest
	Resource(resource string) IMetaDataRequest
	SubResource(sub string) IMetaDataRequest
	Url() (string, error)
	Do(api interface{}) error
}

IMetaDataRequest interface

type MetaData

type MetaData struct {
	// contains filtered or unexported fields
}

MetaData wrap http client

func NewMetaData

func NewMetaData(client *http.Client) *MetaData

NewMetaData returns MetaData

func NewMockMetaData

func NewMockMetaData(client *http.Client, sendRequest requestMock) *MetaData

NewMockMetaData returns mock MetaData

func (*MetaData) DNSNameServers

func (m *MetaData) DNSNameServers() ([]string, error)

DNSNameServers returns dns servers

func (*MetaData) EIPv4

func (m *MetaData) EIPv4() (string, error)

EIPv4 returns eip

func (*MetaData) HostName

func (m *MetaData) HostName() (string, error)

HostName returns host name

func (*MetaData) ImageID

func (m *MetaData) ImageID() (string, error)

ImageID returns image id

func (*MetaData) InstanceID

func (m *MetaData) InstanceID() (string, error)

InstanceID returns instance Id

func (*MetaData) Mac

func (m *MetaData) Mac() (string, error)

Mac returns mac address

func (*MetaData) NTPConfigServers

func (m *MetaData) NTPConfigServers() ([]string, error)

NTPConfigServers returns ntp servers

func (*MetaData) NetworkType

func (m *MetaData) NetworkType() (string, error)

NetworkType returns network type

func (*MetaData) New

func (m *MetaData) New() *MetaDataRequest

New returns MetaDataRequest

func (*MetaData) OwnerAccountID

func (m *MetaData) OwnerAccountID() (string, error)

OwnerAccountID returns owner account id

func (*MetaData) PrivateIPv4

func (m *MetaData) PrivateIPv4() (string, error)

PrivateIPv4 returns private ipv4 ip address

func (*MetaData) RamRoleToken

func (m *MetaData) RamRoleToken(role string) (RoleAuth, error)

RamRoleToken returns ram role token

func (*MetaData) Region

func (m *MetaData) Region() (string, error)

Region returns region

func (*MetaData) RoleName

func (m *MetaData) RoleName() (string, error)

RoleName returns role name

func (*MetaData) SerialNumber

func (m *MetaData) SerialNumber() (string, error)

SerialNumber returns serial number

func (*MetaData) SourceAddress

func (m *MetaData) SourceAddress() (string, error)

SourceAddress returns source address

func (*MetaData) VpcCIDRBlock

func (m *MetaData) VpcCIDRBlock() (string, error)

VpcCIDRBlock returns vpc cidr block

func (*MetaData) VpcID

func (m *MetaData) VpcID() (string, error)

VpcID returns vpc id

func (*MetaData) VswitchCIDRBlock

func (m *MetaData) VswitchCIDRBlock() (string, error)

VswitchCIDRBlock returns vswitch cidr block

func (*MetaData) VswitchID

func (m *MetaData) VswitchID() (string, error)

VswitchID returns vswitch id

func (*MetaData) Zone

func (m *MetaData) Zone() (string, error)

Zone returns zone id

type MetaDataRequest

type MetaDataRequest struct {
	// contains filtered or unexported fields
}

MetaDataRequest struct

func (*MetaDataRequest) Decode

func (vpc *MetaDataRequest) Decode(data string, api interface{}) error

Decode returns decoded content

func (*MetaDataRequest) Do

func (vpc *MetaDataRequest) Do(api interface{}) (err error)

Do try to do MetaDataRequest

func (*MetaDataRequest) Resource

func (vpc *MetaDataRequest) Resource(resource string) IMetaDataRequest

Resource sets resource

func (*MetaDataRequest) ResourceType

func (vpc *MetaDataRequest) ResourceType(rtype string) IMetaDataRequest

ResourceType sets resource type

func (*MetaDataRequest) SubResource

func (vpc *MetaDataRequest) SubResource(sub string) IMetaDataRequest

SubResource set sub resource

func (*MetaDataRequest) Url

func (vpc *MetaDataRequest) Url() (string, error)

Url returns url

func (*MetaDataRequest) Version

func (vpc *MetaDataRequest) Version(version string) IMetaDataRequest

Version sets version

type ResultList

type ResultList struct {
	// contains filtered or unexported fields
}

ResultList struct

type RoleAuth

type RoleAuth struct {
	AccessKeyId     string
	AccessKeySecret string
	Expiration      time.Time
	SecurityToken   string
	LastUpdated     time.Time
	Code            string
}

RoleAuth struct

type TimeoutError

type TimeoutError interface {
	error
	Timeout() bool // Is the error a timeout?
}

TimeoutError interface

Jump to

Keyboard shortcuts

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