Documentation
¶
Overview ¶
Package cartel provides support for HSDP Cartel services
Index ¶
- Variables
- 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) BastionHost() string
- func (c *Client) Create(tagName string, opts ...RequestOptionFunc) (*CreateResponse, *Response, error)
- func (c *Client) Destroy(tagName string) (*DestroyResponse, *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) 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 InstanceDetails
- type LdapGroups
- type OptionFunc
- type ProtectionResponse
- type RequestBody
- type RequestOptionFunc
- func IOPs(iops int) RequestOptionFunc
- func Image(image string) 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 Tags(tags map[string]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") ErrNotFound = errors.New("not found") ErrHostnameAlreadyExists = errors.New("hostname already exists") ErrInvalidSubnetType = errors.New("invalid subnet type, must be public or private") )
Functions ¶
This section is empty.
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) BastionHost ¶
BastionHost returns the bastion host if it can be guessed correctly An empty string is returned otherwise
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) 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) RemoveSecurityGroups ¶
func (*Client) RemoveUserGroups ¶
func (*Client) SetProtection ¶
type Config ¶
type Config struct {
Region 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"`
DebugLog io.Writer `cloud:"-" json:"-"`
}
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 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" validate:"max=6"`
VolSize int `json:"vol_size,omitempty" validate:"min=1,max=1000"`
VolumeType string `json:"vol_type,omitempty"`
IOPs int `json:"iops,omitempty" validate:"min=1,max=4000"`
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 ¶
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
- bastion_host.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