Documentation ¶
Index ¶
- Constants
- func ClearAuthEnvUsername()
- func ErrorIfAcmeNotComplete(acme *brightbox.LoadBalancerAcme) error
- func ErrorIfNotComplete(lb *brightbox.LoadBalancer, cipId, name string) error
- func ErrorIfNotErased(lb *brightbox.LoadBalancer) error
- func GetAuthEnvTokenHandler(t *testing.T) *httptest.Server
- func IsUpdateLoadBalancerRequired(lb *brightbox.LoadBalancer, newDetails brightbox.LoadBalancerOptions) bool
- func MapProviderIDToServerID(providerID string) string
- func MapServerIDToProviderID(serverID string) string
- func MapZoneHandleToRegion(zoneHandle string) (string, error)
- func ResetAuthEnvironment()
- func SetAuthEnvAPIURL(value string)
- func SetAuthEnvAccount()
- func SetAuthEnvClientID()
- func SetAuthEnvPassword()
- func SetAuthEnvUsername()
- type Cloud
- func (c *Cloud) AllocateCloudIP(name string) (*brightbox.CloudIP, error)
- func (c *Cloud) CloudClient() (CloudAccess, error)
- func (c *Cloud) CreateFirewallPolicy(group *brightbox.ServerGroup) (*brightbox.FirewallPolicy, error)
- func (c *Cloud) CreateFirewallRule(newDetails *brightbox.FirewallRuleOptions) (*brightbox.FirewallRule, error)
- func (c *Cloud) CreateLoadBalancer(newDetails *brightbox.LoadBalancerOptions) (*brightbox.LoadBalancer, error)
- func (c *Cloud) CreateServer(newDetails *brightbox.ServerOptions) (*brightbox.Server, error)
- func (c *Cloud) CreateServerGroup(name string) (*brightbox.ServerGroup, error)
- func (c *Cloud) DestroyCloudIP(id string) error
- func (c *Cloud) DestroyCloudIPs(cloudIpList []brightbox.CloudIP, name string) error
- func (c *Cloud) DestroyFirewallPolicy(id string) error
- func (c *Cloud) DestroyLoadBalancer(id string) error
- func (c *Cloud) DestroyServer(id string) error
- func (c *Cloud) DestroyServerGroup(id string) error
- func (c *Cloud) EnsureMappedCloudIP(lb *brightbox.LoadBalancer, cip *brightbox.CloudIP) error
- func (c *Cloud) EnsureOldCloudIPsDeposed(lb *brightbox.LoadBalancer, cip *brightbox.CloudIP, name string) error
- func (c *Cloud) GetCloudIPs() ([]brightbox.CloudIP, error)
- func (c *Cloud) GetFirewallPolicyByName(name string) (*brightbox.FirewallPolicy, error)
- func (c *Cloud) GetLoadBalancerById(id string) (*brightbox.LoadBalancer, error)
- func (c *Cloud) GetLoadBalancerByName(name string) (*brightbox.LoadBalancer, error)
- func (c *Cloud) GetServer(ctx context.Context, id string, notFoundError error) (*brightbox.Server, error)
- func (c *Cloud) GetServerGroup(identifier string) (*brightbox.ServerGroup, error)
- func (c *Cloud) GetServerGroupByName(name string) (*brightbox.ServerGroup, error)
- func (c *Cloud) GetServerGroups() ([]brightbox.ServerGroup, error)
- func (c *Cloud) MetadataClient() (EC2Metadata, error)
- func (c *Cloud) SyncServerGroup(group *brightbox.ServerGroup, newServerIds []string) (*brightbox.ServerGroup, error)
- func (c *Cloud) UpdateFirewallRule(newDetails *brightbox.FirewallRuleOptions) (*brightbox.FirewallRule, error)
- func (c *Cloud) UpdateLoadBalancer(newDetails *brightbox.LoadBalancerOptions) (*brightbox.LoadBalancer, error)
- type CloudAccess
- type EC2Metadata
Constants ¶
const ( LbActive = "active" LbCreating = "creating" ValidAcmeDomainStatus = "valid" )
const ( ProviderName = "brightbox" ProviderPrefix = ProviderName + "://" )
Variables ¶
This section is empty.
Functions ¶
func ClearAuthEnvUsername ¶
func ClearAuthEnvUsername()
func ErrorIfAcmeNotComplete ¶
func ErrorIfAcmeNotComplete(acme *brightbox.LoadBalancerAcme) error
func ErrorIfNotComplete ¶
func ErrorIfNotErased ¶
func ErrorIfNotErased(lb *brightbox.LoadBalancer) error
func IsUpdateLoadBalancerRequired ¶
func IsUpdateLoadBalancerRequired(lb *brightbox.LoadBalancer, newDetails brightbox.LoadBalancerOptions) bool
IsUpdateLoadBalancerRequired checks whether a set of LoadBalancerOptions warrants an API update call.
func MapProviderIDToServerID ¶
Parse the provider id string and return a string that should be a server id Should be no need for error checking here, since the input string is constrained in format by the k8s process
func MapServerIDToProviderID ¶
Add the provider prefix to the server ID
func MapZoneHandleToRegion ¶
Parse the zone handle and return the embedded region id Zone names are of the form: ${region-name}-${ix} So we look for the last '-' and trim just before that
func ResetAuthEnvironment ¶
func ResetAuthEnvironment()
func SetAuthEnvAPIURL ¶
func SetAuthEnvAPIURL(value string)
func SetAuthEnvAccount ¶
func SetAuthEnvAccount()
func SetAuthEnvClientID ¶
func SetAuthEnvClientID()
func SetAuthEnvPassword ¶
func SetAuthEnvPassword()
func SetAuthEnvUsername ¶
func SetAuthEnvUsername()
Types ¶
type Cloud ¶
type Cloud struct {
// contains filtered or unexported fields
}
Cloud allows access to the Brightbox Cloud and/or any EC2 compatible metadata.
func MakeTestClient ¶
func MakeTestClient(testClient CloudAccess, testMetadata EC2Metadata) *Cloud
func (*Cloud) AllocateCloudIP ¶
func (*Cloud) CloudClient ¶
func (c *Cloud) CloudClient() (CloudAccess, error)
CloudClient returns the Brightbox Cloud client, or creates a new client from the current environment if one doesn't exist.
func (*Cloud) CreateFirewallPolicy ¶
func (c *Cloud) CreateFirewallPolicy(group *brightbox.ServerGroup) (*brightbox.FirewallPolicy, error)
Firewall Policy
func (*Cloud) CreateFirewallRule ¶
func (c *Cloud) CreateFirewallRule(newDetails *brightbox.FirewallRuleOptions) (*brightbox.FirewallRule, error)
Firewall Rules
func (*Cloud) CreateLoadBalancer ¶
func (*Cloud) CreateServer ¶
func (*Cloud) CreateServerGroup ¶
func (*Cloud) DestroyCloudIP ¶
func (*Cloud) DestroyCloudIPs ¶
Destroy CloudIPs matching 'name' from a supplied list of cloudIPs
func (*Cloud) DestroyFirewallPolicy ¶
func (*Cloud) DestroyLoadBalancer ¶
func (*Cloud) DestroyServer ¶
func (*Cloud) DestroyServerGroup ¶
func (*Cloud) EnsureMappedCloudIP ¶
func (*Cloud) EnsureOldCloudIPsDeposed ¶
func (c *Cloud) EnsureOldCloudIPsDeposed(lb *brightbox.LoadBalancer, cip *brightbox.CloudIP, name string) error
EnsureOldCloudIPsDeposed unmaps any CloudIPs mapped to the loadbalancer that are not the allocated cloud ip.
func (*Cloud) GetCloudIPs ¶
func (*Cloud) GetFirewallPolicyByName ¶
get a FirewallPolicy By Name
func (*Cloud) GetLoadBalancerById ¶
func (*Cloud) GetLoadBalancerByName ¶
func (*Cloud) GetServerGroup ¶
func (*Cloud) GetServerGroupByName ¶
get a serverGroup By Name
func (*Cloud) GetServerGroups ¶
func (*Cloud) MetadataClient ¶
func (c *Cloud) MetadataClient() (EC2Metadata, error)
MetadataClient returns the EC2 Metadata client, or creates a new client from the default AWS config if one doesn't exist.
func (*Cloud) SyncServerGroup ¶
func (c *Cloud) SyncServerGroup(group *brightbox.ServerGroup, newServerIds []string) (*brightbox.ServerGroup, error)
SyncServerGroup ensures a Brightbox Server Group contains the supplied list of Servers and nothing else
func (*Cloud) UpdateFirewallRule ¶
func (*Cloud) UpdateLoadBalancer ¶
type CloudAccess ¶
type CloudAccess interface { //Fetch a server Server(identifier string) (*brightbox.Server, error) //creates a new server CreateServer(newServer *brightbox.ServerOptions) (*brightbox.Server, error) //Fetch a list of LoadBalancers LoadBalancers() ([]brightbox.LoadBalancer, error) //Retrieves a detailed view of one load balancer LoadBalancer(identifier string) (*brightbox.LoadBalancer, error) //Creates a new load balancer CreateLoadBalancer(newDetails *brightbox.LoadBalancerOptions) (*brightbox.LoadBalancer, error) //Updates an existing load balancer UpdateLoadBalancer(newDetails *brightbox.LoadBalancerOptions) (*brightbox.LoadBalancer, error) //Retrieves a list of all cloud IPs CloudIPs() ([]brightbox.CloudIP, error) //retrieves a detailed view of one cloud ip CloudIP(identifier string) (*brightbox.CloudIP, error) //Issues a request to map the cloud ip to the destination MapCloudIP(identifier string, destination string) error //UnMapCloudIP issues a request to unmap the cloud ip UnMapCloudIP(identifier string) error //Creates a new Cloud IP CreateCloudIP(newCloudIP *brightbox.CloudIPOptions) (*brightbox.CloudIP, error) //adds servers to an existing server group AddServersToServerGroup(identifier string, serverIds []string) (*brightbox.ServerGroup, error) //removes servers from an existing server group RemoveServersFromServerGroup(identifier string, serverIds []string) (*brightbox.ServerGroup, error) // ServerGroups retrieves a list of all server groups ServerGroups() ([]brightbox.ServerGroup, error) //Fetch a server group ServerGroup(identifier string) (*brightbox.ServerGroup, error) //creates a new server group CreateServerGroup(newServerGroup *brightbox.ServerGroupOptions) (*brightbox.ServerGroup, error) //creates a new firewall policy CreateFirewallPolicy(policyOptions *brightbox.FirewallPolicyOptions) (*brightbox.FirewallPolicy, error) //creates a new firewall rule CreateFirewallRule(ruleOptions *brightbox.FirewallRuleOptions) (*brightbox.FirewallRule, error) //updates an existing firewall rule UpdateFirewallRule(ruleOptions *brightbox.FirewallRuleOptions) (*brightbox.FirewallRule, error) //retrieves a list of all firewall policies FirewallPolicies() ([]brightbox.FirewallPolicy, error) // DestroyServer destroys an existing server DestroyServer(identifier string) error // DestroyServerGroup destroys an existing server group DestroyServerGroup(identifier string) error // DestroyFirewallPolicy issues a request to destroy the firewall policy DestroyFirewallPolicy(identifier string) error // DestroyLoadBalancer issues a request to destroy the load balancer DestroyLoadBalancer(identifier string) error // DestroyCloudIP issues a request to destroy the cloud ip DestroyCloudIP(identifier string) error }
CloudAccess is an abstraction over the Brightbox API to allow testing
type EC2Metadata ¶
type EC2Metadata interface { // Query the EC2 metadata service (used to discover instance-id etc) GetMetadata(path string) (string, error) }
EC2Metadata is an abstraction over the AWS metadata service.