Documentation ¶
Index ¶
- Constants
- Variables
- func Request(verb string, path string, body []byte) ([]byte, error)
- type ApiError
- type Configuration
- type InstanceFlavor
- type InstanceHistoryEntry
- type IpQuotaChange
- type Project
- type ProjectImagesUsage
- type ProjectInstancesUsage
- type ProjectIpsUsage
- type ProjectLoadBalancersUsage
- type ProjectUsage
- type ProjectVolumesUsage
- type ProjectVpnsUsage
- type QuotaSet
- type Role
- type Usage
- type UsageBreakdown
- type User
Constants ¶
const AcceptType = "application/vnd.datacentred.api+json"
AcceptType is the response type we accept from the server.
const ApiVersion = "1"
ApiVersion is the API microversion this SDK currently targets on server.
const BaseUri = "https://my.datacentred.io/api/"
BaseUri is the server's base URI before path suffixes are added.
const ContentType = "application/json"
ContentType is the request content type for the API.
const UserAgent = "datacentred/go v1"
Variables ¶
var Config = Configuration{ Client: http.Client{}, AccessKey: os.Getenv("DATACENTRED_ACCESS"), SecretKey: os.Getenv("DATACENTRED_SECRET"), }
Config holds config information for this SDK. This includes API credentials and a HTTP transport client.
Functions ¶
Types ¶
type Configuration ¶
Configuration is a structure for config data this SDK.
type InstanceFlavor ¶
type InstanceFlavor struct { Id string `json:"id"` Name string `json:"name"` RamMb int `json:"ram_mb"` RootDiskGb int `json:"root_disk_gb"` VcpusCount int `json:"vcpus_count"` }
InstanceFlavor contains information about a cloud instance's assigned flavor.
type InstanceHistoryEntry ¶
type InstanceHistoryEntry struct { Billable bool `json:"billable"` EventName string `json:"event_name"` Flavor string `json:"flavor"` RecordedAt time.Time `json:"recorded_at"` Seconds int `json:"seconds"` State string `json:"state"` UserId string `json:"user_id"` }
InstanceHistoryEntry contains information about a specific event in a cloud instance's runtime history.
type IpQuotaChange ¶
type IpQuotaChange struct { Previous int `json:"previous"` Quota int `json:"quota"` RecordedAt time.Time `json:"recorded_at"` }
IpQuotaChange contains information about an IP quota change event.
type Project ¶
type Project struct { Id string `json:"id"` Name string `json:"name"` QuotaSet QuotaSet `json:"quota_set"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
Project is a cloud organizational unit. It is possible to manage a project's name and resource quotas, as well as assign/revoke user access.
func CreateProject ¶
CreateProject creates a new project on the currently authenticated user's account. This may fail if the account is at its limit for projects.
func FindProject ¶
FindProject locates a specific project by its unique ID.
func Projects ¶
Projects is the collection of projects belonging to the currently authenticated user's account.
func (Project) RemoveUser ¶
RemoveUser revokes a user's access to this project.
type ProjectImagesUsage ¶
type ProjectImagesUsage struct { CreatedAt time.Time `json:"created_at"` DeletedAt time.Time `json:"deleted_at"` Id string `json:"id"` LatestSizeGb float64 `json:"latest_size_gb"` Name string `json:"name"` Owner string `json:"owner"` Usage []UsageBreakdown `json:"usage"` }
ProjectImagesUsage contains usage information for a single cloud image.
type ProjectInstancesUsage ¶
type ProjectInstancesUsage struct { FirstBootedAt time.Time `json:"first_booted_at"` TerminatedAt time.Time `json:"terminated_at"` Id string `json:"id"` Name string `json:"name"` LatestState string `json:"latest_state"` History []InstanceHistoryEntry `json:"history"` Tags []string `json:"tags"` CurrentFlavor InstanceFlavor `json:"current_flavor"` Usage []UsageBreakdown `json:"usage"` }
ProjectInstancesUsage contains usage information about a single cloud instance.
type ProjectIpsUsage ¶
type ProjectIpsUsage struct { CurrentQuota int `json:"current_quota"` QuotaChanges []IpQuotaChange `json:"quota_changes"` Usage []UsageBreakdown `json:"usage"` }
ProjectIpsUsage contains usage information about IPs.
type ProjectLoadBalancersUsage ¶
type ProjectLoadBalancersUsage struct { Id string `json:"id"` Name string `json:"name"` Owner string `json:"owner"` StartedAt time.Time `json:"started_at"` TerminatedAt time.Time `json:"terminated_at"` Usage []UsageBreakdown `json:"usage"` }
ProjectLoadBalancersUsage contains usage information about a single cloud load balancer.
type ProjectUsage ¶
type ProjectUsage struct { Id string `json:"id"` Name string `json:"name"` Usage struct { Images []ProjectImagesUsage `json:"images"` Instances []ProjectInstancesUsage `json:"instances"` Ips ProjectIpsUsage `json:"ips"` LoadBalancers []ProjectLoadBalancersUsage `json:"load_balancers"` ObjectStorage struct { Usage []UsageBreakdown `json:"usage"` } `json:"object_storage"` Volumes []ProjectVolumesUsage `json:"volumes"` Vpns []ProjectVpnsUsage `json:"vpns"` } `json:"usage"` }
ProjectUsage contains usage information about a single cloud project.
type ProjectVolumesUsage ¶
type ProjectVolumesUsage struct { CreatedAt time.Time `json:"created_at"` DeletedAt time.Time `json:"deleted_at"` Id string `json:"id"` LatestSizeGb int `json:"latest_size_gb"` Name string `json:"name"` Owner string `json:"owner"` Tags []string `json:"tags"` Usage []UsageBreakdown `json:"usage"` }
ProjectVolumesUsage contains usage information about a single cloud volume.
type ProjectVpnsUsage ¶
type ProjectVpnsUsage struct { Id string `json:"id"` Name string `json:"name"` Owner string `json:"owner"` StartedAt time.Time `json:"started_at"` TerminatedAt time.Time `json:"terminated_at"` Usage []UsageBreakdown `json:"usage"` }
ProjectVpnsUsage contains usage information about a single cloud VPN.
type QuotaSet ¶
type QuotaSet struct { Compute struct { Cores int `json:"cores"` Instances int `json:"instances"` Ram int `json:"ram"` } `json:"compute"` Volume struct { Gigabytes int `json:"gigabytes"` Snapshots int `json:"snapshots"` Volumes int `json:"volumes"` } `json:"volume"` Network struct { FloatingIp int `json:"floating_ip"` Network int `json:"network"` Port int `json:"port"` Router int `json:"router"` SecurityGroup int `json:"security_group"` SecurityGroupRule int `json:"security_group_rule"` Subnet int `json:"subnet"` } `json:"network"` }
QuotaSet is a collection of resource quota values for a Project. It contains Compute, Volume, and Network values as positive integers.
type Role ¶
type Role struct { Id string `json:"id"` Name string `json:"name"` Admin bool `json:"admin"` Permissions []string `json:"permissions"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
Role is a grouping structure for assigning account permissions to all users who are assigned as members of the role.
func CreateRole ¶
CreateRole creates a new role on the currently authenticated user's account.
func Roles ¶
Roles is the collection of roles belonging to the currently authenticated user's account.
func (Role) RemoveUser ¶
RemoveUser removes a user from this role, revoking the role's permissions.
type Usage ¶
type Usage struct { LastUpdatedAt time.Time `json:"last_updated_at"` Projects []ProjectUsage `json:"projects"` }
Usage contains usage information about all cloud projects belonging to the currently authenticated user's account.
type UsageBreakdown ¶
type UsageBreakdown struct { Cost struct { Currency string `json:"currency"` Rate float64 `json:"rate"` Value float64 `json:"value"` } Meta map[string]interface{} `json:"meta"` Unit string `json:"unit"` Value float64 `json:"value"` }
UsageBreakdown show the cost and unit-usage of a resource. This structure is common to all resource types.
type User ¶
type User struct { Id string `json:"id"` Email string `json:"email"` FirstName string `json:"first_name"` LastName string `json:"last_name"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
User is a member of this account's team. Users can log into the DataCentred dashboard and be assigned to OpenStack projects and granted system permissions via role assignment.
func CreateUser ¶
CreateUser creates a new user on the currently authenticated user's account. A password must be specified to create a new user.
func Users ¶
Users is the collection of users belonging to the currently authenticated user's account.
func (User) ChangePassword ¶
ChangePassword allows a new password to be set for this user.