Documentation
¶
Overview ¶
Package cartel provides support for HSDP Cartel services
Index ¶
- Variables
- func CheckResponse(r *http.Response) error
- type AddTagResponse
- type Client
- func (c *Client) AddSecurityGroups(instances []string, groups []string) (*SecurityGroupsResponse, *Response, error)
- func (c *Client) AddTags(instances []string, tags map[string]string) (*AddTagResponse, *Response, error)
- func (c *Client) AddUserGroups(instances []string, groups []string) (*UserGroupsResponse, *Response, error)
- func (c *Client) Create(tagName string, opts ...RequestOptionFunc) (*CreateResponse, *Response, error)
- func (c *Client) Destroy(tagName string) (*DestroyResponse, *Response, error)
- func (c *Client) Do(req *http.Request, v interface{}) (*Response, error)
- func (c *Client) GetAllInstances() (*[]InstanceDetails, *Response, error)
- func (c *Client) GetAllSubnets() (*SubnetDetails, *Response, error)
- func (c *Client) GetDeploymentState(nameTag string) (string, *Response, error)
- func (c *Client) GetDetails(tag string) (*InstanceDetails, *Response, error)
- func (c *Client) GetDetailsMulti(tags ...string) (*DetailsResponse, *Response, error)
- func (c *Client) GetRoles() (*[]Role, *Response, error)
- func (c *Client) GetSecurityGroupDetails(group string) (*SecurityGroupDetails, *Response, error)
- func (c *Client) GetSecurityGroups() (*[]string, *Response, error)
- func (c *Client) NewRequest(method, path string, opt *RequestBody, options []OptionFunc) (*http.Request, error)
- func (c *Client) RemoveSecurityGroups(instances []string, groups []string) (*SecurityGroupsResponse, *Response, error)
- func (c *Client) RemoveUserGroups(instances []string, groups []string) (*UserGroupsResponse, *Response, error)
- func (c *Client) SetProtection(nameTag string, protection bool) (*ProtectionResponse, *Response, error)
- func (c *Client) Start(nameTag string) (*StartResponse, *Response, error)
- func (c *Client) Stop(nameTag string) (*StopResponse, *Response, error)
- type Config
- type CreateResponse
- type DestroyResponse
- type DetailsResponse
- type ErrorResponse
- type InstanceDetails
- type LdapGroups
- type OptionFunc
- type ProtectionResponse
- type RequestBody
- type RequestOptionFunc
- func IOPs(iops int) RequestOptionFunc
- func InSubnet(subnetID string) RequestOptionFunc
- func InstanceRole(role string) RequestOptionFunc
- func InstanceType(instanceType string) RequestOptionFunc
- func Protect(value bool) RequestOptionFunc
- func SecurityGroups(groups ...string) RequestOptionFunc
- func SubnetType(subnetType string) RequestOptionFunc
- func UserGroups(groups ...string) RequestOptionFunc
- func VPCID(vpcID string) RequestOptionFunc
- func VolumeEncryption(value bool) RequestOptionFunc
- func VolumeType(volumeType string) RequestOptionFunc
- func VolumesAndSize(nrVols, size int) RequestOptionFunc
- type Response
- type Role
- type SecurityGroupDetails
- type SecurityGroupsResponse
- type SecurityRule
- type StartResponse
- type StopResponse
- type Subnet
- type SubnetDetails
- type UserGroupsResponse
Constants ¶
This section is empty.
Variables ¶
var ( ErrMissingSecret = errors.New("missing cartel secret") ErrMissingToken = errors.New("missing cartel token") ErrMissingHost = errors.New("missing cartel host") ErrNotImplemented = errors.New("not implemented by cartel client") ErrNotFound = errors.New("not found") ErrNonHttp20xResponse = errors.New("non http 20x cartel response") )
Functions ¶
func CheckResponse ¶
CheckResponse checks the API response for errors, and returns them if present.
Types ¶
type AddTagResponse ¶
type AddTagResponse struct { Message string `json:"message,omitempty"` Code int `json:"code,omitempty"` Description string `json:"description,omitempty"` }
func (AddTagResponse) Success ¶
func (atr AddTagResponse) Success() bool
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client holds the client state
func (*Client) AddSecurityGroups ¶
func (*Client) AddUserGroups ¶
func (*Client) Create ¶
func (c *Client) Create(tagName string, opts ...RequestOptionFunc) (*CreateResponse, *Response, error)
func (*Client) Destroy ¶
func (c *Client) Destroy(tagName string) (*DestroyResponse, *Response, error)
func (*Client) Do ¶
Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred. If v implements the io.Writer interface, the raw response body will be written to v, without attempting to first decode it.
func (*Client) GetAllInstances ¶
func (c *Client) GetAllInstances() (*[]InstanceDetails, *Response, error)
func (*Client) GetAllSubnets ¶
func (c *Client) GetAllSubnets() (*SubnetDetails, *Response, error)
func (*Client) GetDeploymentState ¶
func (*Client) GetDetails ¶
func (c *Client) GetDetails(tag string) (*InstanceDetails, *Response, error)
func (*Client) GetDetailsMulti ¶
func (c *Client) GetDetailsMulti(tags ...string) (*DetailsResponse, *Response, error)
func (*Client) GetSecurityGroupDetails ¶
func (c *Client) GetSecurityGroupDetails(group string) (*SecurityGroupDetails, *Response, error)
func (*Client) GetSecurityGroups ¶
func (*Client) NewRequest ¶
func (c *Client) NewRequest(method, path string, opt *RequestBody, options []OptionFunc) (*http.Request, error)
NewRequest creates an API request. A relative URL path can be provided in urlStr, in which case it is resolved relative to the base URL of the Client. Relative URL paths should always be specified without a preceding slash. If specified, the value pointed to by body is JSON encoded and included as the request body.
func (*Client) RemoveSecurityGroups ¶
func (*Client) RemoveUserGroups ¶
func (*Client) SetProtection ¶
type Config ¶
type Config struct { Region string `cloud:"-" json:"-"` Environment string `cloud:"-" json:"-"` Token string `cloud:"token" json:"token"` Secret string `cloud:"secret" json:"secret"` SkipVerify bool `cloud:"skip_verify" json:"skip_verify"` NoTLS bool `cloud:"no_tls" json:"no_tls"` Host string `cloud:"host" json:"host"` Debug bool `cloud:"-" json:"debug,omitempty"` DebugLog string `cloud:"-" json:"debug_log,omitempty"` }
Config the client
type CreateResponse ¶
type CreateResponse struct { Message []struct { EipAddress interface{} `json:"eip_address"` InstanceID string `json:"instance_id"` IPAddress string `json:"ip_address"` Name string `json:"name"` Role string `json:"role"` } `json:"message,omitempty"` Result string `json:"result,omitempty"` Code int `json:"code,omitempty"` Description string `json:"description,omitempty"` }
func (CreateResponse) IPAddress ¶
func (cr CreateResponse) IPAddress() string
func (CreateResponse) InstanceID ¶
func (cr CreateResponse) InstanceID() string
func (CreateResponse) Success ¶
func (cr CreateResponse) Success() bool
type DestroyResponse ¶
func (DestroyResponse) Success ¶
func (dr DestroyResponse) Success() bool
type DetailsResponse ¶
type DetailsResponse map[string]InstanceDetails
type ErrorResponse ¶
type ErrorResponse struct { Response *http.Response `json:"-"` Message string `json:"-"` Code int `json:"code"` Description string `json:"description"` }
ErrorResponse holds an error response from the server
type InstanceDetails ¶
type InstanceDetails struct { BlockDevices []string `json:"block_devices,omitempty"` InstanceID string `json:"instance_id"` InstanceType string `json:"instance_type,omitempty"` LaunchTime string `json:"launch_time,omitempty"` LdapGroups LdapGroups `json:"ldap_groups,omitempty"` PrivateAddress string `json:"private_address,omitempty"` Protection bool `json:"protection,omitempty"` PublicAddress string `json:"public_address,omitempty"` Role string `json:"role"` SecurityGroups []string `json:"security_groups,omitempty"` State string `json:"state,omitempty"` Subnet string `json:"subnet,omitempty"` Tags map[string]string `json:"tags,omitempty"` Vpc string `json:"vpc,omitempty"` Zone string `json:"zone,omitempty"` Owner string `json:"owner,omitempty"` NameTag string `json:"name_tag,omitempty"` }
type LdapGroups ¶
type LdapGroups []string
func (*LdapGroups) UnmarshalJSON ¶
func (lg *LdapGroups) UnmarshalJSON(b []byte) error
type OptionFunc ¶
OptionFunc is the function signature function for options
type ProtectionResponse ¶
type ProtectionResponse struct { Message string `json:"message,omitempty"` Code int `json:"code,omitempty"` Description string `json:"description,omitempty"` }
func (ProtectionResponse) Success ¶
func (pr ProtectionResponse) Success() bool
type RequestBody ¶
type RequestBody struct { Token string `json:"token,omitempty"` NameTag []string `json:"name-tag,omitempty"` Role string `json:"role,omitempty"` SecurityGroup []string `json:"security_group,omitempty"` Image string `json:"image,omitempty"` LDAPGroups []string `json:"ldap_groups,omitempty"` InstanceType string `json:"instance_type,omitempty"` NumVolumes int `json:"num_vols,omitempty"` VolSize int `json:"vol_size,omitempty"` VolumeType string `json:"vol_type,omitempty"` IOPs int `json:"iops,omitempty"` EncryptVols bool `json:"encrypt_vols"` SubnetType string `json:"subnet_type,omitempty"` Subnet string `json:"subnet,omitempty"` Tags map[string]string `json:"tags,omitempty"` Protect bool `json:"protect"` VpcId string `json:"vpc_id,omitempty"` }
RequestBody contains parameters for Cartel calls
func (*RequestBody) ToJson ¶
func (crb *RequestBody) ToJson() []byte
type RequestOptionFunc ¶
type RequestOptionFunc func(*RequestBody) error
func IOPs ¶
func IOPs(iops int) RequestOptionFunc
IOPs sets the number of IOPs to provision for attached storage
func InstanceRole ¶ added in v0.21.0
func InstanceRole(role string) RequestOptionFunc
InstanceRole sets the instance role
func InstanceType ¶
func InstanceType(instanceType string) RequestOptionFunc
InstanceType sets the instance type
func SecurityGroups ¶
func SecurityGroups(groups ...string) RequestOptionFunc
SecurityGroups sets the security groups
func SubnetType ¶
func SubnetType(subnetType string) RequestOptionFunc
SubnetType sets the subnet type
func UserGroups ¶
func UserGroups(groups ...string) RequestOptionFunc
UserGroups sets the user groups (LDAP groups)
func VolumeEncryption ¶
func VolumeEncryption(value bool) RequestOptionFunc
VolumeEncryption enables volume encryption
func VolumeType ¶
func VolumeType(volumeType string) RequestOptionFunc
VolumeType sets the EBS volume type
func VolumesAndSize ¶
func VolumesAndSize(nrVols, size int) RequestOptionFunc
VolumesAndSize sets the number of volumes to attach and their size (in GB)
type SecurityGroupDetails ¶
type SecurityGroupDetails []SecurityRule
type SecurityGroupsResponse ¶
type SecurityGroupsResponse struct { Message json.RawMessage `json:"message,omitempty"` Result string `json:"result,omitempty"` Code int `json:"code,omitempty"` Description string `json:"description,omitempty"` }
func (SecurityGroupsResponse) Success ¶
func (sgr SecurityGroupsResponse) Success() bool
type SecurityRule ¶
type StartResponse ¶
type StartResponse struct { Message json.RawMessage `json:"message,omitempty"` Code int `json:"code,omitempty"` Description string `json:"description,omitempty"` }
func (StartResponse) Success ¶
func (sr StartResponse) Success() bool
type StopResponse ¶
type StopResponse struct { Message json.RawMessage `json:"message,omitempty"` Code int `json:"code,omitempty"` Description string `json:"description,omitempty"` }
func (StopResponse) Success ¶
func (sr StopResponse) Success() bool
type SubnetDetails ¶
type UserGroupsResponse ¶
type UserGroupsResponse struct { Message json.RawMessage `json:"message,omitempty"` Result string `json:"result,omitempty"` Code int `json:"code,omitempty"` Description string `json:"description,omitempty"` }
func (UserGroupsResponse) Success ¶
func (ugr UserGroupsResponse) Success() bool
Source Files
¶
- add_security_groups.go
- add_tags.go
- add_user_groups.go
- all_instances.go
- client.go
- create.go
- deployment_state.go
- destroy.go
- details.go
- errors.go
- remove_security_groups.go
- remove_user_groups.go
- request_body.go
- roles.go
- security_group_details.go
- security_groups.go
- set_protection.go
- start.go
- stop.go
- subnets.go