Documentation
¶
Index ¶
- func FromIntIPversion(v int) IPVersion.Enum
- func ParseBadRequest(badRequestError string) map[string]string
- func ParseNeutronError(neutronError string) map[string]string
- func ProviderErrorToString(err error) string
- func ToGopherIPversion(v IPVersion.Enum) gc.IPVersion
- func VerifyEndpoints(service *Client) (bool, error)
- type AuthOptions
- type CfgOptions
- type Client
- func (client *Client) Build(params map[string]interface{}) (api.ClientAPI, error)
- func (client *Client) CreateGateway(req model.GatewayRequest) (*model.Host, error)
- func (client *Client) CreateHost(request model.HostRequest) (*model.Host, error)
- func (client *Client) CreateKeyPair(name string) (*model.KeyPair, error)
- func (client *Client) CreateNetwork(req model.NetworkRequest) (*model.Network, error)
- func (client *Client) CreateVolume(request model.VolumeRequest) (*model.Volume, error)
- func (client *Client) CreateVolumeAttachment(request model.VolumeAttachmentRequest) (string, error)
- func (client *Client) DeleteGateway(id string) error
- func (client *Client) DeleteHost(id string) error
- func (client *Client) DeleteKeyPair(id string) error
- func (client *Client) DeleteNetwork(id string) error
- func (client *Client) DeleteVolume(id string) error
- func (client *Client) DeleteVolumeAttachment(serverID, vaID string) error
- func (client *Client) GetAuthOpts() (model.Config, error)
- func (client *Client) GetCfgOpts() (model.Config, error)
- func (client *Client) GetHost(hostParam interface{}) (*model.Host, error)
- func (client *Client) GetHostByName(name string) (*model.Host, error)
- func (client *Client) GetHostState(hostParam interface{}) (HostState.Enum, error)
- func (client *Client) GetImage(id string) (*model.Image, error)
- func (client *Client) GetKeyPair(id string) (*model.KeyPair, error)
- func (client *Client) GetNetwork(id string) (*model.Network, error)
- func (client *Client) GetNetworkByName(name string) (*model.Network, error)
- func (client *Client) GetTemplate(id string) (*model.HostTemplate, error)
- func (client *Client) GetVolume(id string) (*model.Volume, error)
- func (client *Client) GetVolumeAttachment(serverID, id string) (*model.VolumeAttachment, error)
- func (client *Client) ListAvailabilityZones(all bool) (map[string]bool, error)
- func (client *Client) ListHosts() ([]*model.Host, error)
- func (client *Client) ListImages(all bool) ([]model.Image, error)
- func (client *Client) ListKeyPairs() ([]model.KeyPair, error)
- func (client *Client) ListNetworks() ([]*model.Network, error)
- func (client *Client) ListRouters() ([]Router, error)
- func (client *Client) ListTemplates(all bool) ([]model.HostTemplate, error)
- func (client *Client) ListVolumeAttachments(serverID string) ([]model.VolumeAttachment, error)
- func (client *Client) ListVolumes() ([]model.Volume, error)
- func (client *Client) RebootHost(id string) error
- func (client *Client) StartHost(id string) error
- func (client *Client) StopHost(id string) error
- func (client *Client) WaitHostReady(hostParam interface{}, timeout time.Duration) (*model.Host, error)
- type Router
- type RouterRequest
- type Subnet
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseBadRequest ¶
ParseBadRequest parses BadRequest JSON error and returns fields
func ParseNeutronError ¶
ParseNeutronError parses neutron json error and returns fields
func ProviderErrorToString ¶
ProviderErrorToString creates an error string from openstack api error
func ToGopherIPversion ¶
ToGopherIPversion ...
Types ¶
type AuthOptions ¶
type AuthOptions struct {
// IdentityEndpoint specifies the HTTP endpoint that is required to work with
// the Identity API of the appropriate version. While it's ultimately needed by
// all of the identity services, it will often be populated by a provider-level
// function.
IdentityEndpoint string
// Username is required if using Identity V2 API. Consult with your provider's
// control panel to discover your account's username. In Identity V3, either
// UserID or a combination of Username and DomainID or DomainName are needed.
Username, UserID string
// Exactly one of Password or APIKey is required for the Identity V2 and V3
// APIs. Consult with your provider's control panel to discover your account's
// preferred method of authentication.
Password, APIKey string
// At most one of DomainID and DomainName must be provided if using Username
// with Identity V3. Otherwise, either are optional.
DomainID, DomainName string
// The TenantID and TenantName fields are optional for the Identity V2 API.
// Some providers allow you to specify a TenantName instead of the TenantId.
// Some require both. Your provider's authentication policies will determine
// how these fields influence authentication.
TenantID, TenantName string
// AllowReauth should be set to true if you grant permission for Gophercloud to
// cache your credentials in memory, and to allow Gophercloud to attempt to
// re-authenticate automatically if/when your token expires. If you set it to
// false, it will not cache these settings, but re-authentication will not be
// possible. This setting defaults to false.
//
// NOTE: The reauth function will try to re-authenticate endlessly if left unchecked.
// The way to limit the number of attempts is to provide a custom HTTP client to the provider client
// and provide a transport that implements the RoundTripper interface and stores the number of failed retries.
// For an example of this, see here: https://github.com/gophercloud/rack/blob/1.0.0/auth/clients.go#L311
AllowReauth bool
// TokenID allows users to authenticate (possibly as another user) with an
// authentication token ID.
TokenID string
//Openstack region (data center) where the infrstructure will be created
Region string
//FloatingIPPool name of the floating IP pool
//Necessary only if UseFloatingIP is true
FloatingIPPool string
}
AuthOptions fields are the union of those recognized by each identity implementation and provider.
type CfgOptions ¶
type CfgOptions struct {
// Name of the provider (external) network
ProviderNetwork string
// DNSList list of DNS
DNSList []string
// UseFloatingIP indicates if floating IP are used (optional)
UseFloatingIP bool
// UseLayer3Networking indicates if layer 3 networking features (router) can be used
// if UseFloatingIP is true UseLayer3Networking must be true
UseLayer3Networking bool
// AutoHostNetworkInterfaces indicates if network interfaces are configured automatically by the provider or needs a post configuration
AutoHostNetworkInterfaces bool
// VolumeSpeeds map volume types with volume speeds
VolumeSpeeds map[string]VolumeSpeed.Enum
// // ObjectStorageType type of Object Storage (ex: swift or s3)
// ObjectStorageType string
// MetadataBucket contains the name of the bucket storing metadata
MetadataBucket string
DefaultImage string
}
CfgOptions configuration options
type Client ¶
type Client struct {
Opts *AuthOptions
Cfg *CfgOptions
Provider *gc.ProviderClient
Compute *gc.ServiceClient
Network *gc.ServiceClient
Volume *gc.ServiceClient
SecurityGroup *secgroups.SecurityGroup
ProviderNetworkID string
}
Client is the implementation of the openstack driver regarding to the api.ClientAPI
func AuthenticatedClient ¶
func AuthenticatedClient(opts AuthOptions, cfg CfgOptions) (*Client, error)
AuthenticatedClient returns an authenticated client
func (*Client) CreateGateway ¶
CreateGateway creates a public Gateway for a private network
func (*Client) CreateHost ¶
CreateHost creates an host satisfying request
func (*Client) CreateKeyPair ¶
CreateKeyPair creates and import a key pair
func (*Client) CreateNetwork ¶
CreateNetwork creates a network named name
func (*Client) CreateVolume ¶
CreateVolume creates a block volume - name is the name of the volume - size is the size of the volume in GB - volumeType is the type of volume to create, if volumeType is empty the driver use a default type
func (*Client) CreateVolumeAttachment ¶
func (client *Client) CreateVolumeAttachment(request model.VolumeAttachmentRequest) (string, error)
CreateVolumeAttachment attaches a volume to an host - 'name' of the volume attachment - 'volume' to attach - 'host' on which the volume is attached
func (*Client) DeleteGateway ¶
DeleteGateway delete the public gateway of a private network
func (*Client) DeleteHost ¶
DeleteHost deletes the host identified by id
func (*Client) DeleteKeyPair ¶
DeleteKeyPair deletes the key pair identified by id
func (*Client) DeleteNetwork ¶
DeleteNetwork deletes the network identified by id
func (*Client) DeleteVolume ¶
DeleteVolume deletes the volume identified by id
func (*Client) DeleteVolumeAttachment ¶
DeleteVolumeAttachment deletes the volume attachment identifed by id
func (*Client) GetAuthOpts ¶
GetAuthOpts returns the auth options
func (*Client) GetCfgOpts ¶
GetCfgOpts return configuration parameters
func (*Client) GetHostByName ¶
GetHostByName returns the host using the name passed as parameter
func (*Client) GetHostState ¶
GetHostState returns the current state of host identified by id hostParam can be a string or an instance of *model.Host; any other type will panic
func (*Client) GetKeyPair ¶
GetKeyPair returns the key pair identified by id
func (*Client) GetNetwork ¶
GetNetwork returns the network identified by id
func (*Client) GetNetworkByName ¶
GetNetworkByName ...
func (*Client) GetTemplate ¶
func (client *Client) GetTemplate(id string) (*model.HostTemplate, error)
GetTemplate returns the Template referenced by id
func (*Client) GetVolumeAttachment ¶
func (client *Client) GetVolumeAttachment(serverID, id string) (*model.VolumeAttachment, error)
GetVolumeAttachment returns the volume attachment identified by id
func (*Client) ListAvailabilityZones ¶
ListAvailabilityZones lists the usable AvailabilityZones
func (*Client) ListImages ¶
ListImages lists available OS images
func (*Client) ListKeyPairs ¶
ListKeyPairs lists available key pairs
func (*Client) ListNetworks ¶
ListNetworks lists available networks
func (*Client) ListRouters ¶
ListRouters lists available routers
func (*Client) ListTemplates ¶
func (client *Client) ListTemplates(all bool) ([]model.HostTemplate, error)
ListTemplates lists available Host templates Host templates are sorted using Dominant Resource Fairness Algorithm
func (*Client) ListVolumeAttachments ¶
func (client *Client) ListVolumeAttachments(serverID string) ([]model.VolumeAttachment, error)
ListVolumeAttachments lists available volume attachment
func (*Client) ListVolumes ¶
ListVolumes returns the list of all volumes known on the current tenant
func (*Client) RebootHost ¶
RebootHost reboots inconditionnaly the host identified by id
type Router ¶
type Router struct {
ID string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
//NetworkID is the Network ID which the router gateway is connected to.
NetworkID string `json:"network_id,omitempty"`
}
Router represents a router
type RouterRequest ¶
type RouterRequest struct {
Name string `json:"name,omitempty"`
//NetworkID is the Network ID which the router gateway is connected to.
NetworkID string `json:"network_id,omitempty"`
}
RouterRequest represents a router request
type Subnet ¶
type Subnet struct {
ID string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
//IPVersion is IPv4 or IPv6 (see IPVersion)
IPVersion IPVersion.Enum `json:"ip_version,omitempty"`
//Mask mask in CIDR notation
Mask string `json:"mask,omitempty"`
//NetworkID id of the parent network
NetworkID string `json:"network_id,omitempty"`
}
Subnet define a sub network