Documentation ¶
Overview ¶
Package registry provides some functions to interact with the BOSH Registry (http://bosh.io/docs/bosh-components.html#registry)
Index ¶
- func PublicKeyFile(file string) (ssh.AuthMethod, error)
- func SSHDownload(ip, srcFile string, destination io.Writer, sshPath string) error
- type AgentOptions
- type AgentSettings
- func (as AgentSettings) AsJSONString() (s string, err error)
- func (as AgentSettings) AttachPersistentDisk(diskID string, path string) AgentSettings
- func (as AgentSettings) ConfigureNetworks(networksSettings NetworksSettings) AgentSettings
- func (as AgentSettings) DetachPersistentDisk(diskID string) AgentSettings
- type AgentSettingsMetaData
- type BlobstoreOptions
- type BlobstoreSettings
- type Client
- type ClientOptions
- type ClientTLSOptions
- type DisksSettings
- type EnvSettings
- type FSClient
- func (c FSClient) Delete(instanceID string) error
- func (c FSClient) Download(ipAddress string, sourcePath string, sshPath string) ([]byte, error)
- func (c FSClient) Fetch(ipAddress string, sshPath string) (AgentSettings, error)
- func (c FSClient) RunCommand(ipAddress string, commands []string, sshPath string) error
- func (c FSClient) UploadFile(ipAddress string, agentSettings AgentSettings, sshPath string) error
- func (c FSClient) UploadRootKeyPair(ipAddress string, sshPath string) error
- type InstanceMetadata
- type MetadataEntry
- type NetworkSetting
- type NetworksSettings
- type PersistentSettings
- type SSHKeys
- type UserData
- type UserDataDNSItems
- type UserDataRegistryEndpoint
- type UserDataServerName
- type VMSettings
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PublicKeyFile ¶
func PublicKeyFile(file string) (ssh.AuthMethod, error)
Types ¶
type AgentOptions ¶
type AgentOptions struct { // Mbus URI Mbus string // List of NTP servers Ntp []string // Blobstore options Blobstore BlobstoreOptions }
AgentOptions are the agent options passed to the the BOSH Agent (http://bosh.io/docs/bosh-components.html#agent).
func (AgentOptions) MBusPort ¶
func (o AgentOptions) MBusPort() (int, error)
MBusPort extracts the port number from the Mbus URI
func (AgentOptions) Validate ¶
func (o AgentOptions) Validate() error
Validate validates the Agent options.
type AgentSettings ¶
type AgentSettings struct { // Agent ID AgentID string `json:"agent_id"` // Blobstore settings Blobstore BlobstoreSettings `json:"blobstore"` // Disks settings Disks DisksSettings `json:"disks"` // Environment settings Env EnvSettings `json:"env"` // Mbus URI Mbus string `json:"mbus"` // Networks settings Networks NetworksSettings `json:"networks"` // List of NTP servers Ntp []string `json:"ntp"` // VM settings VM VMSettings `json:"vm"` // public key PublicKey string `json:"public_key"` //user-data Server UserDataServerName `json:"server"` Registry UserDataRegistryEndpoint `json:"registry"` DNS UserDataDNSItems `json:"dns,omitempty"` }
AgentSettings are the Agent settings for a particular VM.
func NewAgentSettings ¶
func NewAgentSettings(agentID string, vmCID string, networksSettings NetworksSettings, env EnvSettings, agentOptions AgentOptions, publickey string, userdata UserData) AgentSettings
NewAgentSettings creates new agent settings for a VM.
func (AgentSettings) AsJSONString ¶
func (as AgentSettings) AsJSONString() (s string, err error)
AsJSONString returns the agent settings as a JSON string
func (AgentSettings) AttachPersistentDisk ¶
func (as AgentSettings) AttachPersistentDisk(diskID string, path string) AgentSettings
AttachPersistentDisk updates the agent settings in order to add an attached persistent disk.
func (AgentSettings) ConfigureNetworks ¶
func (as AgentSettings) ConfigureNetworks(networksSettings NetworksSettings) AgentSettings
ConfigureNetworks updates the agent settings with the networks settings.
func (AgentSettings) DetachPersistentDisk ¶
func (as AgentSettings) DetachPersistentDisk(diskID string) AgentSettings
DetachPersistentDisk updates the agent settings in order to delete an attached persistent disk.
type AgentSettingsMetaData ¶
type AgentSettingsMetaData struct {
Settings AgentSettings
}
func (AgentSettingsMetaData) Key ¶
func (asm AgentSettingsMetaData) Key() string
func (AgentSettingsMetaData) Value ¶
func (asm AgentSettingsMetaData) Value() string
type BlobstoreOptions ¶
type BlobstoreOptions struct { // Blobstore provider Provider string // Blobstore options Options map[string]interface{} }
BlobstoreOptions are the blobstore options passed to the BOSH Agent (http://bosh.io/docs/bosh-components.html#agent).
func (BlobstoreOptions) Validate ¶
func (o BlobstoreOptions) Validate() error
Validate validates the Blobstore options.
type BlobstoreSettings ¶
type BlobstoreSettings struct { // Blobstore provider Provider string `json:"provider"` // Blobstore options Options map[string]interface{} `json:"options"` }
BlobstoreSettings are the Blobstore settings for a particular VM.
type Client ¶
type Client interface { Delete(instanceID string) error Fetch(ipAddress string, sshPath string) (AgentSettings, error) UploadFile(ipAddress string, agentSettings AgentSettings, sshPath string) error RunCommand(ipAddress string, command []string, sshPath string) error UploadRootKeyPair(ipAddress string, sshPath string) error }
Client represents a BOSH Registry Client.
type ClientOptions ¶
type ClientOptions struct { // BOSH Registry protocol Protocol string `json:"protocol,omitempty"` // BOSH Registry hostname Host string `json:"host,omitempty"` // BOSH Registry port Port int `json:"port,omitempty"` // BOSH Registry username Username string `json:"username,omitempty"` // BOSH Registry password Password string `json:"password,omitempty"` // BOSH Registry TLS options (only when using protocol https) TLS ClientTLSOptions `json:"tls,omitempty"` }
ClientOptions are the options used to create a BOSH Registry client.
func (ClientOptions) Endpoint ¶
func (o ClientOptions) Endpoint() string
Endpoint returns the BOSH Registry endpoint.
func (ClientOptions) EndpointWithCredentials ¶
func (o ClientOptions) EndpointWithCredentials() string
EndpointWithCredentials returns the BOSH Registry endpoint including credentials.
func (ClientOptions) Validate ¶
func (o ClientOptions) Validate() error
Validate validates the Client options.
type ClientTLSOptions ¶
type ClientTLSOptions struct { // If the Client must skip the verification of the server certificates InsecureSkipVerify bool `json:"insecure_skip_verify,omitempty"` // Certificate file (PEM format) CertFile string `json:"certfile,omitempty"` // Private key file (PEM format) KeyFile string `json:"keyfile,omitempty"` // Roor CA certificate file (PEM format) CACertFile string `json:"cacertfile,omitempty"` }
ClientTLSOptions are the TLS options used to create a BOSH Registry client.
func (ClientTLSOptions) Validate ¶
func (o ClientTLSOptions) Validate() error
Validate validates the TLS options.
type DisksSettings ¶
type DisksSettings struct { // System disk System string `json:"system"` // Ephemeral disk Ephemeral string `json:"ephemeral"` // Persistent disk Persistent map[string]PersistentSettings `json:"persistent"` }
DisksSettings are the Disks settings for a particular VM.
type EnvSettings ¶
type EnvSettings map[string]interface{}
EnvSettings are the Environment settings for a particular VM.
type FSClient ¶
type FSClient struct {
// contains filtered or unexported fields
}
func NewFSClient ¶
func NewFSClient( options ClientOptions, logger boshlog.Logger, ) FSClient
func (FSClient) Fetch ¶
func (c FSClient) Fetch(ipAddress string, sshPath string) (AgentSettings, error)
Fetch gets the agent settings for a given instance ID.
func (FSClient) RunCommand ¶
func (FSClient) UploadFile ¶
func (c FSClient) UploadFile(ipAddress string, agentSettings AgentSettings, sshPath string) error
Update updates the agent settings for a given instance ID. If there are not already agent settings for the instance, it will create ones.
type InstanceMetadata ¶
type InstanceMetadata []MetadataEntry
func (InstanceMetadata) AsMap ¶
func (md InstanceMetadata) AsMap() map[string]string
type MetadataEntry ¶
func NewAgentSettingsMetadata ¶
func NewAgentSettingsMetadata(settings AgentSettings) MetadataEntry
func NewSSHKeys ¶
func NewSSHKeys(in []string) MetadataEntry
func NewUserData ¶
func NewUserData(name string, registryEndpoint string, dnsNames []string, networks NetworksSettings) MetadataEntry
type NetworkSetting ¶
type NetworkSetting struct { Type string `json:"type"` IP string `json:"ip"` Netmask string `json:"netmask"` Gateway string `json:"gateway"` Resolved bool `json:"resolved"` UseDHCP bool `json:"use_dhcp"` Default []string `json:"default"` DNS []string `json:"dns"` Mac string `json:"mac"` Preconfigured bool `json:"preconfigured"` }
NetworkSetting is a setting for one interface for a particular VM
type NetworksSettings ¶
type NetworksSettings map[string]NetworkSetting
NetworksSettings are the Networks settings for a particular VM.
type PersistentSettings ¶
type PersistentSettings struct { // Persistent disk ID ID string `json:"id"` // Persistent disk path Path string `json:"path"` }
PersistentSettings are the Persistent Disk settings for a particular VM.
type UserData ¶
type UserData struct { Server UserDataServerName `json:"server"` Registry UserDataRegistryEndpoint `json:"registry"` DNS UserDataDNSItems `json:"dns,omitempty"` Networks NetworksSettings `json:"networks"` PublicKey string `json:"public_key"` }
UserData is CPI representation of user data expected by bosh-agent. Bosh agent picks reads UserData from the metadata service configured on the agent. It mirrors https://godoc.org/github.com/cloudfoundry/bosh-agent/infrastructure#UserDataContentsType
func NewUserDataObject ¶
func NewUserDataObject(name string, registryEndpoint string, dnsNames []string, networks NetworksSettings) UserData
func (UserData) AsJSONString ¶
type UserDataDNSItems ¶
type UserDataDNSItems struct {
NameServer []string `json:"nameserver,omitempty"`
}
type UserDataRegistryEndpoint ¶
type UserDataRegistryEndpoint struct {
Endpoint string `json:"endpoint"`
}
type UserDataServerName ¶
type UserDataServerName struct {
Name string `json:"name"`
}
type VMSettings ¶
type VMSettings struct { // VM name Name string `json:"name"` }
VMSettings are the VM settings for a particular VM.