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 ( ProviderName = "brightbox" ProviderPrefix = ProviderName + "://" )
const (
ValidAcmeDomainStatus = "valid"
)
Variables ¶
This section is empty.
Functions ¶
func ClearAuthEnvUsername ¶
func ClearAuthEnvUsername()
func ErrorIfAcmeNotComplete ¶
func ErrorIfAcmeNotComplete(acme *brightbox.LoadBalancerAcme) error
ErrorIfAcmeNotComplete returns an appropriate error if ACME has not yet validated
func ErrorIfNotComplete ¶
func ErrorIfNotComplete(lb *brightbox.LoadBalancer, cipID, name string) error
ErrorIfNotComplete returns an appropriate error if the Load Balancer has not yet built
func ErrorIfNotErased ¶
func ErrorIfNotErased(lb *brightbox.LoadBalancer) error
ErrorIfNotErased returns an appropriate error if the Load Balancer has not been erased
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 ¶
AllocateCloudIP allocates a new Cloud IP and gives it the name specified
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)
CreateFirewallPolicy creates a Firewall Policy
func (*Cloud) CreateFirewallRule ¶
func (c *Cloud) CreateFirewallRule(newDetails *brightbox.FirewallRuleOptions) (*brightbox.FirewallRule, error)
CreateFirewallRule creates a Firewall Rule
func (*Cloud) CreateLoadBalancer ¶
func (c *Cloud) CreateLoadBalancer(newDetails *brightbox.LoadBalancerOptions) (*brightbox.LoadBalancer, error)
CreateLoadBalancer creates a LoadBalancer
func (*Cloud) CreateServer ¶
CreateServer creates a Brightbox Cloud Server
func (*Cloud) CreateServerGroup ¶
func (c *Cloud) CreateServerGroup(name string) (*brightbox.ServerGroup, error)
CreateServerGroup creates a Server Group
func (*Cloud) DestroyCloudIP ¶
DestroyCloudIP removes a Cloud IP allocation
func (*Cloud) DestroyCloudIPs ¶
DestroyCloudIPs matching 'name' from a supplied list of cloudIPs
func (*Cloud) DestroyFirewallPolicy ¶
DestroyFirewallPolicy removes a Firewall Policy
func (*Cloud) DestroyLoadBalancer ¶
DestroyLoadBalancer removes a Load Balancer
func (*Cloud) DestroyServer ¶
DestroyServer removes a Server
func (*Cloud) DestroyServerGroup ¶
DestroyServerGroup removes a Server Group
func (*Cloud) EnsureMappedCloudIP ¶
EnsureMappedCloudIP checks to make sure the Cloud IP is mapped to the Load Balancer. This function is idempotent.
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 ¶
GetCloudIPs obtains the list of allocated Cloud IPs
func (*Cloud) GetFirewallPolicyByName ¶
func (c *Cloud) GetFirewallPolicyByName(name string) (*brightbox.FirewallPolicy, error)
GetFirewallPolicyByName get a FirewallPolicy from its name
func (*Cloud) GetLoadBalancerByID ¶ added in v0.2.2
func (c *Cloud) GetLoadBalancerByID(id string) (*brightbox.LoadBalancer, error)
GetLoadBalancerByID finds a Load Balancer from its ID
func (*Cloud) GetLoadBalancerByName ¶
func (c *Cloud) GetLoadBalancerByName(name string) (*brightbox.LoadBalancer, error)
GetLoadBalancerByName finds a Load Balancer from its name
func (*Cloud) GetServer ¶
func (c *Cloud) GetServer(ctx context.Context, id string, notFoundError error) (*brightbox.Server, error)
GetServer retrieves a Brightbox Cloud Server
func (*Cloud) GetServerGroup ¶
func (c *Cloud) GetServerGroup(identifier string) (*brightbox.ServerGroup, error)
GetServerGroup fetches a Server Group from its ID
func (*Cloud) GetServerGroupByName ¶
func (c *Cloud) GetServerGroupByName(name string) (*brightbox.ServerGroup, error)
GetServerGroupByName fetches a Server Group from its name
func (*Cloud) GetServerGroups ¶
func (c *Cloud) GetServerGroups() ([]brightbox.ServerGroup, error)
GetServerGroups obtains the list of Server Groups on the account
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 (c *Cloud) UpdateFirewallRule(newDetails *brightbox.FirewallRuleOptions) (*brightbox.FirewallRule, error)
UpdateFirewallRule updates a Firewall Rule
func (*Cloud) UpdateLoadBalancer ¶
func (c *Cloud) UpdateLoadBalancer(newDetails *brightbox.LoadBalancerOptions) (*brightbox.LoadBalancer, error)
UpdateLoadBalancer updates a LoadBalancer
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 // ConfigMaps retrieves a list of all config maps ConfigMaps() ([]brightbox.ConfigMap, error) // ConfigMap retrieves a detailed view on one config map ConfigMap(identifier string) (*brightbox.ConfigMap, 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.