Getting started
The cloud.ca API allows you to manage your environments and provision resources in a simple programmatic way using standard HTTP requests.
The API is RESTful. Responses, successful or not, are returned in JSON. Request bodies must be JSON, and should be made over SSL.
API endpoint : https://api.cloud.ca/v1
We have also developed tools to help consume our APIs. If you use go
, check out our library. If you use Terraform, check out our provider. NB: both are being actively developed, so there is still some functionality missing.
Authentication
import "github.com/cloud-ca/go-cloudca"
ccaClient := cca.NewCcaClient("your_api_key")
## To authenticate, add a header
## Make sure to replace `your_api_key` with your API key.
curl "https://api.cloud.ca/v1/organizations" \
-H "MC-Api-Key: your_api_key"
provider "cloudca" {
api_key = "${var.my_api_key}"
}
API endpoints are secured by the same role-based access control (RBAC) as the cloud.ca portal. To identify who is making the requests, it is required to add a header to your HTTP requests:
MC-Api-Key: your_api_key
The API key is found from the API keys section under the user profile menu. If you don't see cloud.ca API keys section, contact your system administrator as you may not have the permission to see that section. Your API key carries the same privileges as your cloud.ca account, so be sure to keep it secret. If you think your API has been compromised, regenerate your API key from the API keys section.
HTTP verbs
The cloud.ca API can be used by any tool that is fluent in HTTP. The appropriate HTTP method should be used depending on the desired action.
Verbs | Purpose |
---|---|
GET |
Used to retrieve information about a resource. |
POST |
Used to create (or provision) a new resource or perform an operation on it. |
PUT |
Used to update a resource. |
DELETE |
Used to delete a resource. |
Responses
Success response
# Example without tasks
{
"data": [
{ "_comment" : "JSON representation of first object goes here" },
{ "_comment" : "JSON representation of second object goes here" }
]
}
# Example of compute API call with task
{
"taskId": "c2c13744-8610-4012-800a-0907bea110a5",
"taskStatus": "PENDING"
}
When an API request is successful, the response body will contain the data
field with the result of the API call. If you're using the compute API, the data
field might be empty since most of the operations are asynchronous. The response will contain the taskId
and taskStatus
fields so that you can retrieve the result of the operation you executed through the task API
Attributes | |
---|---|
data |
The data field contains the object requested by the API caller |
taskId |
The task id of an operation executed through the compute API |
taskStatus |
The status of a task of an operation executed through the compute API |
Error response
{
"errors": [
{
"code": 2012,
"message": "Cannot stop an instance that isn't in the running state",
"context": {
"id": "4534cc36-bc46-48bc-ac5c-3ee4e42f0a44",
"currentState": "Stopped",
"expectedStates": [
"Running"
],
"type": "instances"
}
}
]
}
_, err := ccaResources.Volumes.Get("[some-volume-id]")
if err != nil {
if errorResponse, ok := err.(api.CcaErrorResponse); ok {
if errorResponse.StatusCode == api.NOT_FOUND {
fmt.Println("Volume was not found")
} else {
//Can get more details from the CcaErrors
fmt.Println(errorResponse.Errors)
}
} else {
//handle unexpected error
panic("Unexpected error")
}
}
When an API request is unsuccessful, the response body will contain the errors
field :
Attributes | |
---|---|
errors |
A list of errors objects that contain information about each error |
Each error has additional fields to describe it :
Attributes | |
---|---|
code |
The cloud.ca error code |
message |
A human readable explanation of the error code |
context |
Additional information |
The HTTP status codes of error responses :
Status code | Reason |
---|---|
200 |
The request was successful. |
204 |
The request was successful and the response body is empty |
400 |
Bad request -- Occurs when invalid parameters are provided or when quota limit is exceeded. |
403 |
Forbidden -- Not authorized to perform this request. |
404 |
Not Found -- Cannot locate the specified endpoint. |
405 |
Method not allowed -- Cannot use that HTTP verb on the specified endpoint. |
500 |
An unexpected error occurred. |
Administration API
The following sections describe the various endpoints exposed by cloud.ca to manage customer's configuration and interact with various core functionality of the system. Using these, you can automate various workflows without having to log into the portal, or simply integrate different aspects of cloud.ca with your own toolchain.
Service connections
Service connections are the services that you can create resources for (e.g. compute, object storage). Environments are created for a specific service which allows you to create and manage resources within that service.
List service connections
GET /services/connections
{
"data":[{
"id": "adfbdb51-493b-45b1-8802-3f6327afb9e6",
"serviceCode": "compute-qc",
"name": "Compute - Québec",
"type": "CloudCA",
"status": {
"lastUpdated": "2017-08-15T12:00:00.000Z",
"reachable": true
}
}]
}
ccaClient := cca.NewCcaClient("your_api_key")
serviceConnection, err := ccaClient.ServiceConnections.List()
Attributes | |
---|---|
id UUID |
The id of the service connection |
serviceCode string |
The service code of the service connection. It is used in the endpoint of the services API. |
name string |
The name of the service connection |
type string |
The type of the service connection. |
status Object |
Status of the service connection. Tells you if the service is up. includes: lastUpdated , reachable |
Retrieve a service connection
GET /services/connections/:id
{
"data":[{
"id": "adfbdb51-493b-45b1-8802-3f6327afb9e6",
"serviceCode": "compute-qc",
"name": "Compute - Québec",
"type": "CloudCA",
"status": {
"lastUpdated": "2017-08-15T12:00:00.000Z",
"reachable": true
}
}]
}
ccaClient := cca.NewCcaClient("your_api_key")
serviceConnections, err := ccaClient.ServiceConnections.Get("[service-connection-id]")
Attributes | |
---|---|
id UUID |
The id of the service connection |
serviceCode string |
The service code of the service connection. It is used in the endpoint of the services API. |
name string |
The name of the service connection |
type string |
The type of the service connection. |
status Object |
Status of the service connection. Tells you if the service is up. includes: lastUpdated , reachable |
Organizations
Organizations are the largest logical grouping of users, environments and resources available in cloud.ca. Each organization is isolated from other organizations. It has its own subdomain ([entryPoint].cloud.ca
) and is protected by its own customizable system roles. An administrator that must manage it's sub-organizations environments or provisioned resources can do so by having the Access other levels
permission. Additionally, provisioned resource usage is metered at the organization level facilitating cost tracking.
List organizations
GET /organizations
Retrieves a list of organizations visible to the caller. In most cases, only the caller's organization will be returned. However if the caller's organization has sub-organizations, and the caller has the Access other levels
permission, the sub-organizations will be returned as well.
// List organizations
ccaClient := cca.NewCcaClient("your_api_key")
organizations, err := ccaClient.Organizations.List()
# Retrieve visible organizations
curl "https://api.cloud.ca/v1/organizations" \
-H "MC-Api-Key: your_api_key"
# Response body example
{
"data": [
{
"id": "03bc22bd-adc4-46b8-988d-afddc24c0cb5",
"name": "Umbrella Corporation",
"entryPoint": "umbrella",
"billableStartDate": "2017-08-15T12:00:00.000Z",
"isBillable": true,
"tags": ["a-tag"],
"parent": {
"id": "8e3393ce-ee63-4f32-9e0f-7b0200fa655a",
"name": "Capcom"
},
"environments": [
{
"id": "9df14056-51e2-4000-ab14-beeaa488500d"
}
],
"roles": [
{
"id": "cdaaa9d0-304e-4063-b1ab-de31905bdab8"
}
],
"serviceConnections":[
{
"id":"11607a49-9691-40fe-8022-2e148bc0d720",
"serviceCode":"compute-qc"
}
],
"users": [
{
"id":"0c3ffcce-a98d-4159-b6fc-04edd34e89b7",
"userName":"wbirkin"
}
]
}
]
}
Attributes | |
---|---|
id UUID |
--- |
name string |
--- |
entryPoint string |
The entry point of the organization is the subdomain of the organization in the cloud.ca URL : [entryPoint].cloud.ca |
billableStartDate string |
The billable start date in ISO 8601 of the organization |
isBillable boolean |
If the organization is billable this values is true, false otherwise |
tags Array[string] |
Tags associated to the organization |
parent Organization |
If the organization is a sub-organization, it will have it's parent organization. includes:id ,name |
environments Array[Environment] |
The environments belonging to the organization includes: id |
roles Array[Role] |
The system and environments roles belonging to the organization includes: id |
serviceConnections Array[ServiceConnection] |
The services for which the organization is allowed to provision resources includes: id ,serviceCode |
users Array[User] |
The users of the organization includes: id |
Retrieve an organization
GET /organizations/:id
Retrieve an organization's details
# Retrieve an organization
curl "https://api.cloud.ca/v1/organizations/[id]" \
-H "MC-Api-Key: your_api_key"
# Response body example
{
"data": {
"id": "03bc22bd-adc4-46b8-988d-afddc24c0cb5",
"name": "Nintendo US",
"entryPoint": "nintendo-us",
"billableStartDate": "2017-08-15T12:00:00.000Z",
"isBillable": true,
"tags": ["a-tag"],
"parent": {
"id": "8e3393ce-ee63-4f32-9e0f-7b0200fa655a",
"name": "Nintendo"
},
"environments": [
{
"id": "9df14056-51e2-4000-ab14-beeaa488500d"
}
],
"roles": [
{
"id": "cdaaa9d0-304e-4063-b1ab-de31905bdab8"
}
],
"serviceConnections": [
{
"id":"11607a49-9691-40fe-8022-2e148bc0d720",
"serviceCode":"compute-qc"
}
],
"users": [
{
"id":"0c3ffcce-a98d-4159-b6fc-04edd34e89b7",
"userName":"reggie"
}
]
}
}
Attributes | |
---|---|
id UUID |
--- |
name string |
--- |
entryPoint string |
The entry point of the organization is the subdomain of the organization in the cloud.ca URL :[entryPoint].cloud.ca |
billableStartDate string |
The billable start date in ISO 8601 of the organization |
isBillable boolean |
If the organization is billable this values is true, false otherwise |
tags Array[string] |
Tags associated to the organization |
parent Organization |
If the organization is a sub-organization, it will have it's parent organization. includes:id ,name |
environments Array[Environment] |
The environments belonging to the organization includes: id |
roles Array[Role] |
The system and environments roles belonging to the organization includes: id |
serviceConnections Array[ServiceConnection] |
The services for which the organization is allowed to provision resources includes: id ,serviceCode |
users Array[User] |
The users of the organization includes: id |
Create organization
POST /organizations
Creates a new organization as a sub-organization of the caller's organization, or a sub-organization of the specified parent
. The caller requires the Organizations create
permission.
# Create an organization
curl -X POST "https://api.cloud.ca/v1/organizations" \
-H "MC-Api-Key: your_api_key" \
-H "Content-Type: application/json" \
-d "[request_body]"
# Request body example
{
"entryPoint":"umbrella",
"name":"Umbrella Corp",
"serviceConnections":[
{
"id":"9acb3b76-d5d0-420c-b075-ef320b7e5a3e"
}
],
"parent" : {
"id":"bc0ceecf-feb5-412c-ab6e-a8df8eb7fbbd"
}
}
Required | |
---|---|
name string |
The name of the organization. (Add info about restrictions) |
entryPoint string |
The entry point of the organization is the subdomain of the organization in the cloud.ca URL : [entryPoint].cloud.ca |
Optional | |
---|---|
serviceConnections Array[ServiceConnection] |
A list of service connections for which the organization may provision resources. required : id |
parent Organization |
The organization that will be the parent of the new organization. By default, it will default to the caller's organization. required : id |
Returns
The responses' data
field contains the created organization with it's id
.
Update organization
PUT /organizations/:id
Update an organization. It's parent organization cannot be changed. It can be assigned service connections
# Update an organization
curl -X PUT "https://api.cloud.ca/v1/organizations/[id]" \
-H "MC-Api-Key: your_api_key" \
-H "Content-Type: application/json" \
-d "[request_body]"
# Request body example
{
"entryPoint":"umbrella",
"name":"Umbrella Corp",
"serviceConnections":[
{
"id":"9acb3b76-d5d0-420c-b075-ef320b7e5a3e"
}
]
}
Required | |
---|---|
name string |
The name of the organization. (Add info about restrictions) |
entryPoint string |
The entry point of the organization is the subdomain of the organization in the cloud.ca URL : [entryPoint].cloud.ca |
Optional | |
---|---|
serviceConnections Array[ServiceConnection] |
A list of service connections for which the organization may provision resources. The caller must have access to all connections that are provided. NB : Service connection access may be added but not revoked at this time. required : id |
Returns
The responses' data
field contains the updated organization.
Delete organization
DELETE /organizations/:id
Delete an organization. The caller may not delete his own organization. Also, an organization may not be deleted if it has sub-organizations.
# Delete an organization
curl -X DELETE "https://api.cloud.ca/v1/organizations/[id]" \
-H "MC-Api-Key: your_api_key"
Returns
Returns an HTTP status code 204, with an empty response body.
Users
A user account allows users to authenticate to an organization and to have access to the resources in it. You can restrict user access to the system and environments by assigning them specific roles. Additionally, every user is given an API key which is needed to use our APIs. All operations done by users are persisted and can be accessed through the activity log.
List users
GET /users
# Retrieve visible users
curl "https://api.cloud.ca/v1/users" \
-H "MC-Api-Key: your_api_key"
# Response body example
{
"data":[{
"id": "e83540c7-75a0-4715-96dc-c10a364e0390",
"userName": "habsgoalie123",
"firstName": "Carey",
"lastName": "Price",
"email": "gohabsgo@cloud.ca",
"creationDate": "2017-08-15T12:00:00.000Z",
"status": "ACTIVE",
"organization": {
"id": "8e3393ce-ee63-4f32-9e0f-7b0200fa655a",
"name": "Canadiens"
},
"roles": [
{
"id": "cdaaa9d0-304e-4063-b1ab-de31905bdab8",
"name": "End-User"
},
{
"id": "fe6d2614-3c33-447c-96f2-c79f67f5fd19",
"name": "Environment Admin",
"environment": {
"id": "afcafd98-0287-4139-bb77-f29ab0549eaa"
}
}
]
}]
}
ccaClient := cca.NewCcaClient("your_api_key")
users, err := ccaClient.Users.List()
Retrieve information about users you have access to. If you want access to other users in your organization or sub-organizations, you will need to be assigned the Users read
permission. Without this permission, you will only see your own user in the list.
Attributes | |
---|---|
id UUID |
The id of the user |
userName string |
The username of the user |
firstName string |
The first name of the user |
lastName string |
The last name of the user |
email string |
The email of the user |
creationDate string |
The date in ISO 8601 that the user was created |
status string |
The current status of the user. |
organization Organization |
The organization to which the user belongs |
roles Array[Role] |
The system and environments roles that are assigned to the user includes: id , name and environment.id |
Retrieve a user
GET /users/:id
# Retrieve visible user
curl "https://api.cloud.ca/v1/users/[user-id]" \
-H "MC-Api-Key: your_api_key"
# Response body example
{
"data":{
"id": "fdf60a19-980d-4380-acab-914485111305",
"userName": "frodo",
"firstName": "Frodo",
"lastName": "Baggins",
"email": "frodo@cloud.ca",
"creationDate": "2017-08-15T12:00:00.000Z",
"status": "ACTIVE",
"organization": {
"id": "c64dcd1d-9123-45e5-ad00-5d635c49176b",
"name": "The Shire"
},
"environments": [{
"id": "55724a36-4817-4cd3-927e-57d8a8b41eb8",
"name": "hobbiton"
}],
"roles": [
{
"id": "5f0a4f20-3537-4bcd-81fe-2b74fd4c07e0",
"name": "End-User"
},
{
"id": "0b9159cd-81ac-48d1-be8a-7595a1617c94",
"name": "Read-Only",
"environment": {
"id": "55724a36-4817-4cd3-927e-57d8a8b41eb8"
}
}
]
}
}
ccaClient := cca.NewCcaClient("your_api_key")
user, err := ccaClient.Users.Get("[user-id]")
Retrieve information about a specific user. If you want access to other users in your organization or sub-organizations, you will need to be assigned the Users Read
permission.
Attributes | |
---|---|
id UUID |
The id of the user |
userName string |
The username of the user |
firstName string |
The first name of the user |
lastName string |
The last name of the user |
email string |
The email of the user |
creationDate string |
The date in ISO 8601 that the user was created |
status string |
The current status of the user. |
organization Organization |
The organization to which the user belongs |
environments Array[Environment] |
The environments the user is member of includes: id , name |
roles Array[Role] |
The system and environments roles that are assigned to the user includes: id , name and environment.id |
Create user
POST /users
# Create a user
curl -X POST "https://api.cloud.ca/v1/users" \
-H "MC-Api-Key: your_api_key" \
-H "Content-Type: application/json" \
-d "[request-body]"
# Request body example
{
"userName": "vader42",
"firstName": "Anakin",
"lastName": "Skywalker",
"email": "vader42@cloud.ca",
"organization": {
"id": "645cf4ce-3699-40c5-a1a8-0b3e945f49ee"
},
"roles": [
{
"id": "dd01c908-371c-4ec5-9fd7-80b1bfac8975"
}
]
}
Create a user in a specific organization. There's two different types of role you can assign to the user. A system role will determine the set of system permissions the user will have. An environment role will give the user access to an environment and will determine what he can see and do in that environment. You will need the Create a new user
permission to execute this operation.
Required | |
---|---|
userName string |
Username of the new user. Should be unique across the organization. |
firstName string |
First name of the user |
lastName string |
Last name of the user |
email string |
Email of the user. Should be unique across the organization. |
Optional | |
---|---|
organization Organization |
Organization in which the user will be created. Defaults to your organization required: id |
roles Array[Role] |
The system and environment roles to give to the user required: id |
Returns
The responses' data
field contains the created user with it's id
.
Update user
PUT /users/:id
# Create a user
curl -X PUT "https://api.cloud.ca/v1/users/[user-id]" \
-H "MC-Api-Key: your_api_key" \
-H "Content-Type: application/json" \
-d "[request-body]"
# Request body example
{
"userName": "spidey1",
"firstName": "Peter",
"lastName": "Parker",
"email": "spidey1@cloud.ca",
"roles": [
{
"id": "dd01c908-371c-4ec5-9fd7-80b1bfac8975"
}
]
}
Update a specific user. It is important to note that updating the list of roles will override the previous one. You will the Users update
permission to execute this operation.
Optional | |
---|---|
userName string |
The new username of the user. Should be unique across the organization. |
firstName string |
The new first name of the user |
lastName string |
The new last name of the user |
email string |
The new email of the user. Should be unique across the organization. |
roles Array[Role] |
The new list of system or environment roles to give to the user. This will override the previous list of roles. required: id |
Returns
The responses' data
field contains the updated user.
Delete user
DELETE /users/:id
# Delete a user
curl "https://api.cloud.ca/v1/users/[user-id]" \
-X DELETE -H "MC-Api-Key: your_api_key"
Delete a specific user. You will need the Delete an existing user
permission to execute this operation.
Unlock user
POST /users/:id/unlock
# Unlock a user that was locked from the system
curl "https://api.cloud.ca/v1/users/[user-id]/unlock" \
-X POST -H "MC-Api-Key: your_api_key"
A user with 10 consecutive unsuccessful logins will be automatically locked by our system. This API can be used to unlock a user in this situation. You will need the Unlock user
permission to execute this operation.
Environments
Environments allow you to manage resources of a specific service and to manage your users' access to them. With environment roles, you have tight control of what a user is allowed to do in your environment. A general use case of environments is to split your resources into different deployment environments (e.g. dev, staging and production). The advantage is that resources of different deployments are isolated from each other and you can restrict user access to your most critical resources.
List environments
GET /environments
# Retrieve visible environments
curl "https://api.cloud.ca/v1/environments" \
-H "MC-Api-Key: your_api_key"
# Response body example
{
"data": [{
"id": "1ee5cd43-8395-4cd5-a20f-0f1e83b7f8bd",
"name": "cheyenne_mountain",
"description": "Environment for base at Cheyenne Mountain",
"membership": "MANY_USERS",
"creationDate": "2017-08-15T12:00:00.000Z",
"organization": {
"id": "a9f93785-0545-4876-8241-3b19b9a86721",
"name": "sg1",
"entryPoint": "sg1"
},
"serviceConnection": {
"id": "adfbdb51-493b-45b1-8802-3f6327afb9e6",
"name": "Compute - Québec"
},
"roles": [{
"id": "951b768b-e91c-4d20-8b52-d4a2ab5a538a",
"name": "Environment Admin",
"isDefault": true,
"users": [{
"id": "9f84a6ce-7be1-4a08-a25b-edc6e57fb7e3",
"name": "jack_oneill"
}]
}]
}]
}
ccaClient := cca.NewCcaClient("your_api_key")
environments, err := ccaClient.Environments.List()
List environments that you have access to. It will only return environments that you're member of if you're not assigned the Environments read
permission.
Attributes | |
---|---|
id UUID |
The id of the environment |
name string |
The name of the environment |
description string |
The description of the environment |
membership string |
Type of membership of the environment. (e.g. ALL_ORG_USERS, MANY_USERS) |
creationDate string |
The date in ISO 8601 that the environment was created |
organization Organization |
The organization of the environment includes: id , name , entryPoint |
serviceConnection ServiceConnection |
The service connection of the environment includes: id , name |
roles Array[Role] |
The roles of the environment with all the users assigned to them. includes: id , name , isDefault , users.id , users.name |
Retrieve an environment
GET /environments/:id
# Retrieve visible environment
curl "https://api.cloud.ca/v1/environment/[environment-id]" \
-H "MC-Api-Key: your_api_key"
# Response body example
{
"data": {
"id": "487a2745-bb8a-44bc-adb1-e3b048f6def2",
"name": "galactica",
"description": "Environment for the Galactica",
"membership": "MANY_USERS",
"creationDate": "2017-08-15T12:00:00.000Z",
"organization": {
"id": "a3340a89-8f60-407d-8a49-f5cfe81eef8f",
"name": "kobol",
"entryPoint": "kobol"
},
"serviceConnection": {
"id": "adfbdb51-493b-45b1-8802-3f6327afb9e6",
"name": "Compute - Québec"
},
"users": [{
"id": "6e84ab70-4c62-4db1-bbd8-343636a34647",
"userName": "starbuck"
}],
"roles": [{
"id": "b04b8a7c-6e89-4dba-9734-74d9f1b7be04",
"name": "Environment Admin",
"isDefault": true,
"users": [{
"id": "6e84ab70-4c62-4db1-bbd8-343636a34647",
"name": "starbuck"
}]
}]
}
}
ccaClient := cca.NewCcaClient("your_api_key")
environment, err := ccaClient.Environments.Get("[environment-id]")
Retrieve an environment you have access to. You can always retrieve environments that you're member of but to access other environments you will need the Environments read
permission.
Attributes | |
---|---|
id UUID |
The id of the environment |
name string |
The name of the environment |
description string |
The description of the environment |
membership string |
Type of membership of the environment. (e.g. ALL_ORG_USERS, MANY_USERS) |
creationDate string |
The date in ISO 8601 that the environment was created |
organization Organization |
The organization of the environment includes: id , name , entryPoint |
serviceConnection ServiceConnection |
The service connection of the environment includes: id , name |
users Array[User] |
The users that are members of the environment includes: id , username |
roles Array[Role] |
The roles of the environment with all the users assigned to them. includes: id , name , isDefault , users.id , users.name |
Create environment
POST /environments
# Create an environment
curl -X POST "https://api.cloud.ca/v1/environments" \
-H "MC-Api-Key: your_api_key" \
-H "Content-Type: application/json" \
-d "[request_body]"
# Request body example
{
"name": "glados",
"description": "Environment property of Aperture Science",
"membership": "MANY_USERS",
"organization": {
"id": "2fd60d6f-1fee-4fe5-8ec6-46d8776acc6f"
},
"serviceConnection": {
"id": "7f0fa906-490a-467b-bc44-e2382d43015e"
},
"roles": [{
"name": "Environment Admin",
"isDefault": true,
"users": [{
"id": "73b17dab-1705-45f1-84e2-997e2af5641b"
}]
}]
}
ccaClient := cca.NewCcaClient("your_api_key")
environment, err := ccaClient.Environments.Create(configuration.Environment{
Name: "[environment-name]",
Description: "[environment-description]",
ServiceConnection: configuration.ServiceConnection {
Id: "[service-connection-id]",
},
Organization: configuration.Organization {
Id: "[organization-id]",
},
Roles: [configuration.Role{
Id: "[role-id]",
Users: [configuration.User{
Id: "[user-id]",
}],
}],
})
resource "cloudca_environment" "my_environment" {
service_code = "compute-qc"
organization_code = "kamar-taj"
name = "production"
description = "Environment for production workloads"
admin_role = ["pat"]
read_only_role = ["dr_strange","ancient_one"]
}
Create a new environment in a specific service and organization. You will need the Environments create
permission to execute this operation.
Required | |
---|---|
name string |
The name of the new environment. Should be unique in the environment and only contain lower case characters, numbers, dashes and underscores. |
description string |
The description of the new environment. |
serviceConnection ServiceConnection |
The service connection that the environment should be created in required: id |
Optional | |
---|---|
organization Organization |
The organization that the environment should be created in. Defaults to your organization required: id |
membership string |
Type of membership of the environment. ALL_ORG_USERS will add every user in the organization to this environment with the default role. MANY_USERS will allow you to choose the users you want in the environment and assigned them specific roles. Defaults to MANY_USERS |
roles Array[Role] |
The roles of the environment and the users assigned to them. Also, defines the default role of the environment. required: name , users.id optional: isDefault |
Returns
The responses' data
field contains the updated environment.
Update environment
PUT /environments/:id
# Update an environment
curl -X POST "https://api.cloud.ca/v1/environments/[environment-id]" \
-H "MC-Api-Key: your_api_key" \
-H "Content-Type: application/json" \
-d "[request_body]"
# Request body example
{
"name": "skynet-beta",
"description": "Environment for the Skynet project",
"roles": [{
"id": "f9dea588-d7ab-4f42-b6e6-4b85f273f3db",
"users": [{
"id": "07e02355-d05b-47cf-860d-f69cf0432276"
}]
}]
}
ccaClient := cca.NewCcaClient("your_api_key")
environment, err := ccaClient.Environments.Update(configuration.Environment{
Name: "[environment-name]",
Description: "[environment-description]",
Roles: [configuration.Role{
Id: "[role-id]",
Users: [configuration.User{
Id: "[user-id]",
}],
}],
})
Optional | |
---|---|
name string |
The updated name of the environment. Should be unique in the environment and only contain lower case characters, numbers, dashes and underscores. |
description string |
The updated description of the environment |
membership string |
Type of membership of the environment. ALL_ORG_USERS will add every user in the organization to this environment with the default role. MANY_USERS will allow you to choose the users you want in the environment and assigned them specific roles. Defaults to MANY_USERS |
roles Array[Role] |
Update the users roles in the environment. Also, can also update the default role. required: name , users.id optional: isDefault |
You will need the Environments update
permission to execute this operation.
Delete environment
DELETE /environments/:id
# Delete an environment
curl "https://api.cloud.ca/v1/environments/[environment-id]" \
-X DELETE -H "MC-Api-Key: your_api_key"
ccaClient := cca.NewCcaClient("your_api_key")
deleted, err := ccaClient.Environments.Delete("[environment-id]")
Delete a specific environment. You will need a role with the Delete an existing environment
permission to execute this operation.
Usage
List usage summary
GET /usage_summary/organizations/:id
# Retrieve usage summary in JSON
curl "https://api.cloud.ca/v1/usage_summary/organizations/03bc22bd-adc4-46b8-988d-afddc24c0cb5?start_date=2017-05-01&end_date=2017-05-15&format=json" \
-H "MC-Api-Key: your_api_key"
# Response body example
{
"data": [{
"organizationId": "52fd201e-aa82-4a27-86b3-ea9650a7fb1e",
"serviceConnectionId": "beeba736-0451-49b0-8020-8b93ed5abb35",
"serviceConnectionPricingId": "e37cc44a-47b6-4a26-81f5-1dbf85433e36",
"utilityCost": 0.66,
"utilityUsage": 5.49999878,
"startDate": "2017-05-01T00:00:00.000Z",
"endDate": "2017-05-01T01:00:00.000Z",
"usageType": "1",
"secondaryType": "RAM"
}]
}
# Retrieve usage summary in CSV
curl "https://api.cloud.ca/v1/usage_summary/organizations/03bc22bd-adc4-46b8-988d-afddc24c0cb5?start_date=2017-05-01&end_date=2017-05-15&format=csv" \
-H "MC-Api-Key: your_api_key"
# Response body example
organizationId,serviceConnectionId,startDate,endDate,usageType,secondaryType,serviceConnectionPricingId,utilityCost,utilityUsage
52fd201e-aa82-4a27-86b3-ea9650a7fb1e,beeba736-0451-49b0-8020-8b93ed5abb35,2017-05-01T00:00:00.000Z,2017-05-01T01:00:00.000Z,1,RAM,e37cc44a-47b6-4a26-81f5-1dbf85433e36,0.660000,5.49999878
Retrieve the usage summary records for an organization and all of its sub-organizations for a specific period. The response can be in JSON (default) or CSV format. Additionally, you can aggregate these records using the different query parameters available.
Note: Old records are aggregated by day instead of hour. If you try to query those records per hour, then you will receive an empty list.
Attributes | |
---|---|
organizationId UUID |
Id of the organization |
serviceConnectionId UUID |
Id of the service connection |
serviceConnectionPricingId UUID |
Id of the service connection pricing |
utilityCost string |
Utility cost of the record (aggregated per the period) |
utilityUsage string |
Utility usage of the record |
startDate string |
Start date of the record in ISO 8601 |
endDate string |
End date of the record in ISO 8601 |
usageType string |
Usage type of the record. |
secondaryType string |
Secondary type of the record. |
Query Parameters (required) | |
---|---|
start_date String |
Start date (inclusive). Should have the following format YYYY-MM-DD. |
end_date String |
End date (exclusive). Should have the following format YYYY-MM-DD. |
Query Parameters | |
---|---|
service_connection_id UUID |
Show usage summary for this service connection |
include_sub_orgs boolean |
Include usage summary of all its sub-organizations. Defaults to false. |
include_cost boolean |
Include the utility cost and service connection pricing id fields. Defaults to true. |
include_free_usage boolean |
Include all summary records that has no cost associated to it (i.e. utilityCost == 0). Defaults to true. |
combine_usage_types boolean |
Sums up all the utility cost per organization and service connection. The following fields are removed from the output: serviceConnectionPricingId , usageType , secondaryType , utilityUsage |
period String |
The period on which the aggregation is made. HOUR, DAY or PERIOD. The default is HOUR. |
format String |
JSON or CSV. Defaults to JSON. |
Compute API
The compute API provides endpoints for carrying out operations on cloud.ca compute and networking entities. While each operation has its own validation and required fields, all operations need to specify the service code and environment in which they should be carried out. The following example URL describes how to specify this information for all entities.
https://api.cloud.ca/v1/services/:service_code/:environment_name/:entity_type
The two compute service codes currently available in cloud.ca correspond to compute regions: compute-qc
for Québec, and compute-on
for Ontario.
Working with sub-organizations
If you don't know what a sub-organization is, you can safely skip this section.
When listing entities or carrying out an operation in an organization other than your own, make sure to specify the org_id
query parameter in your request. For operations, this looks like:
https://api.cloud.ca/v1/services/:service_code/:environment_name/:entity_type/:entity_id?operation=:operation&org_id=:org_id
and for listing entities, looks like:
https://api.cloud.ca/v1/services/:service_code/:environment_name/:entity_type?org_id=:org_id
Tasks
# The above command returns JSON structured like this:
{
"taskId": "b2f82e2a-123e-4f86-a4c7-dc9b850dd11e",
"taskStatus": "PENDING"
}
Some operations take longer to execute, and to avoid blocking on the response until it is fully completed, these are treated in an asynchronous fashion. This means the API will return immediately, and provide you a taskId
that is your reference to the ongoing background task. Using the tasks API, you can query the task's status to find if it has completed and obtain the result of the operation.
Retrieve a task
# Example of success response
{
"taskId": "b2f82e2a-123e-4f86-a4c7-dc9b850dd11e",
"taskStatus": "SUCCESS",
"result": {
"id": "8f064230-82a6-4f93-a17d-9cf9623b0cb5",
"name": "morty"
}
}
GET https://api.cloud.ca/v1/tasks/:id
A task has three different status: PENDING
, FAILED
and SUCCESS
. On a successful completion of the task (i.e. it's in the SUCCESS
state), the response will contain a result
field which will contain the result of the operation. It is important to note that we don't persist our task, a task will only stay alive for 30 minutes (in general).
Compute
Instances
Deploy and manage your instances.
List instances
curl -X GET \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/instances"
# The above command returns JSON structured like this:
{
"data": [
{
"id": "9db8ff2f-b49b-466d-a2f3-c1e6def408f4",
"name": "my_instance",
"state": "Running",
"zoneId": "04afdbd1-e32d-4999-86d0-96703736dded",
"zoneName": "QC-1",
"templateId": "5f968ad6-56d0-4d0d-ad7e-f8f4a5b5d986",
"templateName": "CentOS 6.8 PV",
"computeOfferingId": "3caab5ed-b5a2-4d8a-82e4-51c46168ee6c",
"computeOfferingName": "1vCPU.512MB",
"networkId": "d5a68379-a9ee-404f-9492-a1964b374d6f",
"networkName": "Web-test_area",
"vpcId": "9eb1592c-f92f-4ddd-9799-b58caf896328",
"vpcName": "prod-VPC",
"ipAddress": "10.164.212.68",
"isPasswordEnabled": true,
"macAddress": "02:00:2b:67:00:30",
"cpuCount": 1,
"memoryInMB": 512,
"hostname": "my_instance",
"username": "cca-user",
"affinityGroupIds": []
}
],
"metadata": {
"recordCount": 1
}
}
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
instances, err := ccaResources.Instances.List()
GET /services/:service_code/:environment_name/instances
Retrieve a list of all instances in a given environment
Attributes | |
---|---|
id UUID |
The id of the instance |
name string |
The display name of the instance |
state string |
The current state of the instance |
templateId UUID |
The template id of the instance |
templateName string |
The template name of the instance |
computeOfferingId UUID |
The compute offering id of the instance |
computeOfferingName string |
The compute offering name of the instance |
cpuCount int |
The number of vCPUs associated with the instance's compute offering |
memoryInMB int |
The number of megabytes associated with the instance's compute offering |
networkId UUID |
The id of the network where instance is deployed |
networkName string |
The name of the network where instance is deployed |
hostname string |
The host name of the instance |
username string |
The username that can be used to connect to the instance |
affinityGroupIds Array[UUID] |
The id(s) of the affinity groups to which the instance is associated. |
zoneId UUID |
The id of the zone where instance is deployed |
zoneName string |
The name of associated zone |
vpcId UUID |
The id of the associated VPC |
vpcName string |
The name of associated VPC |
ipAddress string |
The instance's private IPv4 address |
isPasswordEnabled boolean |
Indicate whether a password can be used for remote connections |
macAddress string |
The instance's MAC address |
Retrieve an instance
curl -X GET \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/instances/5951c2b8-e901-4c01-8ae0-cb8d7c508d29"
# The above command returns JSON structured like this:
{
"data": {
"id": "9db8ff2f-b49b-466d-a2f3-c1e6def408f4",
"name": "backup_instance",
"state": "Running",
"zoneId": "04afdbd1-e32d-4999-86d0-96703736dded",
"zoneName": "QC-1",
"templateId": "5f968ad6-56d0-4d0d-ad7e-f8f4a5b5d986",
"templateName": "CentOS 6.8 PV",
"computeOfferingId": "3caab5ed-b5a2-4d8a-82e4-51c46168ee6c",
"computeOfferingName": "1vCPU.512MB",
"networkId": "d5a68379-a9ee-404f-9492-a1964b374d6f",
"networkName": "Web-test_area",
"vpcId": "9eb1592c-f92f-4ddd-9799-b58caf896328",
"vpcName": "prod-VPC",
"ipAddress": "10.164.212.68",
"isPasswordEnabled": true,
"macAddress": "02:00:2b:67:00:30",
"cpuCount": 1,
"memoryInMB": 512,
"hostname": "backup_instance",
"username": "cca-user",
"affinityGroupIds": [],
"userData": "",
"publicIps": [{
"id": "7a204b7f-1039-4867-8971-c1e4f778ef33",
"ipAddress": "199.215.226.46",
"purposes": [
"PORT_FORWARDING"
],
"ports": [
"22"
]
}],
"nics": [{
"id": "f401d989-b149-4870-99f3-1991fec31454",
"isDefault": true,
"networkId": "d5a68379-a9ee-404f-9492-a1964b374d6f"
}]
}
}
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
instance, err := ccaResources.Instances.Get("9db8ff2f-b49b-466d-a2f3-c1e6def408f4")
GET /services/:service_code/:environment_name/instances/:id
Retrieve information about a specific instance.
Attributes | |
---|---|
id UUID |
The id of the instance |
name string |
The display name of the instance |
state string |
The current state of the instance |
templateId UUID |
The template id of the instance |
templateName string |
The template name of the instance |
computeOfferingId UUID |
The compute offering id of the instance |
computeOfferingName string |
The compute offering name of the instance |
cpuCount int |
The number of vCPUs associated with the instance's compute offering |
memoryInMB int |
The number of megabytes associated with the instance's compute offering |
networkId UUID |
The id of the network where instance is deployed |
networkName string |
The name of the network where instance is deployed |
hostname string |
The host name of the instance |
username string |
The username that can be used to connect to the instance |
affinityGroupIds Array[UUID] |
The id(s) of the affinity groups to which the instance is associated. |
zoneId UUID |
The id of the zone where instance is deployed |
zoneName string |
The name of associated zone |
vpcId UUID |
The id of the associated VPC |
vpcName string |
The name of associated VPC |
ipAddress string |
The instance's private IPv4 address |
isPasswordEnabled boolean |
Indicate whether a password can be used for remote connections |
macAddress string |
The instance's MAC address |
userData string |
The user data of the instance |
publicIps Array[PublicIp] |
The public IP addresses associated to the instance includes: id , purposes , ipAddress , ports |
nics Array[NIC] |
The NICs of the instance includes: id , isDefault , networkId |
Create an instance
# Here is the absolute minimum information required to create a new instance:
curl -X POST \
-H "Content-Type: application/json" \
-H "MC-Api-Key: your_api_key" \
-d "request_body" \
"https://api.cloud.ca/v1/services/compute-on/test_area/instances"
# Request should look like this
{
"name": "jarvis",
"templateId": "5f968ad6-56d0-4d0d-ad7e-f8f4a5b5d986",
"computeOfferingId": "3caab5ed-b5a2-4d8a-82e4-51c46168ee6c",
"networkId": "55ccea7f-8286-479e-a648-dd4a45866daf",
"diskOfferingId": "f16f7f1b-462d-47b9-97bb-25a19e47a648",
"rootVolumeSizeInGb": 60,
"additionalDiskSizeInGb": 20,
"additionalDiskIops": 1000,
"sshKeyName": "mysshkey",
"volumeIdToAttach": "2478012b-3cf3-4eef-a8d6-85eb8599df6d",
"affinityGroupId": "1c0bfd2b-d609-4892-a43e-273654532d26",
"portsToForward": ["80", "9999"],
"userData": "#!/bin/bash\necho 'hello world'"
}
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
createdInstance, err := ccaResources.Instances.Create(cloudca.Instance{
Name: "jarvis",
TemplateId: "5f968ad6-56d0-4d0d-ad7e-f8f4a5b5d986",
ComputeOfferingId:"3caab5ed-b5a2-4d8a-82e4-51c46168ee6c",
NetworkId:"55ccea7f-8286-479e-a648-dd4a45866daf",
})
resource "cloudca_instance" "my_instance" {
service_code = "compute-on"
environment_name = "test_area"
name = "jarvis"
network_id = "55ccea7f-8286-479e-a648-dd4a45866daf"
template = "CentOS 6.8 PV"
compute_offering = "1vCPU.512MB"
ssh_key_name = "my_ssh_key"
}
POST /services/:service_code/:environment_name/instances
Create an instance in an environment. This endpoint allows you to easily attach a new or existing data volume and add port forwarding rules to the new instance without doing additional API calls.
Required | |
---|---|
name string |
Name of the newly created instance |
templateId UUID |
The template to use for this instance |
computeOfferingId UUID |
The compute offering will determine the number of CPU and RAM of your instance |
networkId UUID |
The network in which the instance will be created. If you don't have a network, it can be created through the create network api. |
Optional | |
---|---|
rootVolumeSizeInGb int |
The number of GB of the root volume. You must choose a template that allows the resize of root volume. If none specified, then the default one of the template will be used. |
diskOfferingId UUID |
The disk offering to be used for a new volume to attach to this instance |
additionalDiskSizeInGb int |
The number of GB the additional disk should have. You must choose a disk offering with custom disk size enabled. |
additionalDiskIops int |
The number of IOPS the additional disk should have. You must choose a disk offering with custom IOPS enabled. |
sshKeyName string |
The name of the SSH key to use for this instance. If you don't have an SSH key registered, you can do so through this api. |
publicKey string |
The public key to use for this instance. |
volumeIdToAttach UUID |
The volume to attach to this instance. |
affinityGroupId UUID |
The affinity group where to create the instance. |
portsToForward array[string] |
The ports you would like to open on the instance. It will try to use an existing public IP address, if it can't find one it will acquire a new public IP. |
userData string |
User data is data that can be accessed and interpreted in the instance. You can read about common use cases here. |
cpuCount int |
If the compute offering requires custom values (i.e. "custom": true ), this value must be provided. |
memoryInMB int |
If the compute offering requires custom values (i.e. "custom": true ), this value must be provided. |
Update an instance
# Here is the absolute minimum information required to create a new instance:
curl -X PUT \
-H "Content-Type: application/json" \
-H "MC-Api-Key: your_api_key" \
-d "request_body" \
"https://api.cloud.ca/v1/services/compute-on/test_area/instances/5951c2b8-e901-4c01-8ae0-cb8d7c508d29"
# Request example:
{
"name": "hal",
"hostname": "hal_9000"
}
POST /services/:service_code/:environment_name/instances/:id
Update the name and hostname of an existing instance.
Optional | |
---|---|
name string |
Updated name of instance |
hostname string |
Updated hostname of instance. |
Destroy an instance
curl -X DELETE \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca:443/v1/services/compute-on/test_area/instances/5bf7352c-eed2-43dc-83f1-89917fb893ca" \
# Request example:
{
"purgeImmediately":true,
"deleteSnapshots":true,
"publicIpIdsToRelease":[
"fe446d61-a22c-403a-87bf-5351e65dc54d"
],
"volumeIdsToDelete":[
"e3d4045d-3ef7-464d-92a3-fc18269f36e2"
]
}
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
success, err := ccaResources.Instances.Destroy("5951c2b8-e901-4c01-8ae0-cb8d7c508d29", true) // purge flag
DELETE /services/:service_code/:environment_name/instances/:id
Destroys an existing instance. The instance needs to be in the Running, Stopped or Error state for the operation to work. This endpoint allows you to do additional cleanup of resources attached to this instance such as public IPs, volumes and snapshots. If the purgeImmediately flag is not true, then it will not completely remove the instance from the environment. (i.e. the instance could still be recovered).
Optional | |
---|---|
purgeImmediately boolean |
Will destroy and purge the instance if true, puts the instance in destroyed state otherwise. An instance that wasn't purged can be recovered. |
deleteSnapshots boolean |
Will delete all snapshots of volumes attached to this instance if true, will keep snapshots otherwise. |
publicIpIdsToRelease Array[UUID] |
List of IDs of the public IP addresses to release with the instance. Can only release public IPs of the instance being destroyed and they must not be used by other instances. |
volumeIdsToDelete Array[UUID] |
List of IDs of the data volumes to delete with the instance. Can only destroy data volumes that are attached to this instance. |
Start an instance
# Example:
curl -X POST \
-H "Content-Type: application/json" \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/instances/5951c2b8-e901-4c01-8ae0-cb8d7c508d29?operation=start"
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
success, err := ccaResources.Instances.Start("5951c2b8-e901-4c01-8ae0-cb8d7c508d29")
POST /services/:service_code/:environment_name/instances/:id?operation=start
Start an existing instance. The instance must be in the Stopped state for this operation to work.
Stop an instance
# Example:
curl -X POST \
-H "Content-Type: application/json" \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/instances/5951c2b8-e901-4c01-8ae0-cb8d7c508d29?operation=stop"
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
success, err := ccaResources.Instances.Stop("5951c2b8-e901-4c01-8ae0-cb8d7c508d29")
POST /services/:service_code/:environment_name/instances/:id?operation=stop
Stop an existing instance. The instance must be in the Running state for this operation to work.
Reboot an instance
# Example:
curl -X POST \
-H "Content-Type: application/json" \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/instances/5951c2b8-e901-4c01-8ae0-cb8d7c508d29?operation=reboot"
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
success, err := ccaResources.Instances.Reboot("5951c2b8-e901-4c01-8ae0-cb8d7c508d29")
POST /services/:service_code/:environment_name/instances/:id?operation=reboot
Reboot an existing instance. The instance must be in the Running or Stopped state for this operation to work.
Purge an instance
# Example:
curl -X POST \
-H "Content-Type: application/json" \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/instances/5951c2b8-e901-4c01-8ae0-cb8d7c508d29?operation=purge"
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
success, err := ccaResources.Instances.Purge("5951c2b8-e901-4c01-8ae0-cb8d7c508d29")
POST /services/:service_code/:environment_name/instances/:id?operation=purge
Purges an existing instance (i.e. completely remove it from the environment). The instance must be in a Destroyed state.
Recover an instance
# Example:
curl -X POST \
-H "Content-Type: application/json" \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/instances/5951c2b8-e901-4c01-8ae0-cb8d7c508d29?operation=recover"
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
success, err := ccaResources.Instances.Recover("instance_id")
POST /services/:service_code/:environment_name/instances/:id?operation=recover
Recover an existing instance that was previously destroyed. The instance must be in a Destroyed state.
Change the compute offering of an instance
# Example:
curl -X POST \
-H "Content-Type: application/json" \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/instances/5951c2b8-e901-4c01-8ae0-cb8d7c508d29?operation=changeComputeOffering"
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
success, err := ccaResources.Instances.ChangeComputeOffering(Instance {
Id: "instance_id",
ComputeOfferingId: "new_compute_offering_id"})
POST /services/:service_code/:environment_name/instances/:id?operation=changeComputeOffering
Change the compute offering of an existing instance.
Required | |
---|---|
computeOfferingId UUID |
Id of the new compute offering for the instnace |
Required | (if custom compute offering) |
---|---|
cpuCount integer |
Number of CPUs for the instance |
memoryInMB integer |
Amount of memory in MB for the instance |
Reset the password of an instance
# Example:
curl -X POST \
-H "Content-Type: application/json" \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/instances/5951c2b8-e901-4c01-8ae0-cb8d7c508d29?operation=resetPassword"
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
password, err := ccaResources.Instances.ResetPassword("instance_id")
POST /services/:service_code/:environment_name/instances/:id?operation=resetPassword
Reset the password of the default user of an existing instance. The new password of the instance will be in the task result.
Change network of an instance
# Example:
curl -X POST \
-H "Content-Type: application/json" \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/instances/5951c2b8-e901-4c01-8ae0-cb8d7c508d29?operation=changeNetwork"
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
password, err := ccaResources.Instances.ChangeNetwork("instance_id", "new_network_id")
POST /services/:service_code/:environment_name/instances/:id?operation=changeNetwork
Move an instance to another network. NOTE: This will destroy all port forwarding rules associated to this instance and remove the instance from all load balancing rules. Additionally, it will reboot your instance.
Required | |
---|---|
networkId UUID |
The destination network. |
Associate an SSH key to an instance
# Example:
curl -X POST \
-H "Content-Type: application/json" \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/instances/5951c2b8-e901-4c01-8ae0-cb8d7c508d29?operation=associateSSHKey"
# Request example:
{
"sshKeyName": "my_ssh_key"
}
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
success, err := ccaResources.Instances.AssociateSSHKey("5951c2b8-e901-4c01-8ae0-cb8d7c508d29", "my_ssh_key")
POST /services/:service_code/:environment_name/instances/:id?operation=associateSSHKey
Associate a new SSH key to the default user of an existing instance. This will override any other SSH key associated to the instance for the default user. You can register a new SSH key with the register SSH key endpoint.
Required | |
---|---|
sshKeyName string |
The name of the SSH key to associate to the instance |
Templates
A template is a virtual disk image that can be used on the creation of an instance. It contains the operating system which can contain some predefined configuration, files and software. Cloud.ca provides many default templates but you can also upload your own custom templates.
List templates
curl -X GET \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/templates"
# Example:
{
"data": [{
"id": "0b3fea04-b1ed-48cf-921d-96795dfe9a81",
"name": "ubuntu",
"description": "Example template",
"size": 52428800,
"isPublic": false,
"isReady": true,
"isDynamicallyScalable": true,
"sshKeyEnabled": true,
"created":"2016-10-24 2:40:29 PM EDT",
"osType": "Other (64-bit)",
"availableInZones": [
"ea901007-056b-4c50-bb3a-2dd635fce2ab"
]
}],
"metadata": {
"recordCount": 1
}
}
GET /services/:service_code/:environment_name/templates
Retrieve a list of all templates of an environment It will include all the public templates of the system.
Attributes | |
---|---|
id UUID |
The id of the template |
name string |
The name of the template |
description string |
The description of the template |
size long |
The size of the template in bytes |
isPublic boolean |
true if public to everyone. Your custom templates will always be private |
isReady boolean |
true if the template is ready to be used for a new instance |
isDynamicallyScalable boolean |
true if you can dynamically scale an instance with this template |
created string |
The creation date of the template |
osType string |
The OS type of the template (e.g. Ubuntu, CentOS...) |
availableInZones array[UUID] |
List of all zone ids that the template is available in |
Retrieve a template
curl -X GET \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/templates/162cdfcb-45e5-4aa6-81c4-124c94621bdb"
# Example:
{
"data": {
"id": "0b3fea04-b1ed-48cf-921d-96795dfe9a81",
"name": "ubuntu",
"description": "Example template",
"size": 52428800,
"isPublic": false,
"isReady": true,
"isDynamicallyScalable": true,
"sshKeyEnabled": true,
"created":"2016-10-24 2:40:29 PM EDT",
"osType": "Other (64-bit)",
"availableInZones": [
"ea901007-056b-4c50-bb3a-2dd635fce2ab"
]
}
}
GET /services/:service_code/:environment_name/templates/:id
Retrieve information about a public or private template of an environment
Attributes | |
---|---|
id UUID |
The id of the template |
name string |
The name of the template |
description string |
The description of the template |
size long |
The size of the template in bytes |
isPublic boolean |
true if public to everyone. Your custom templates will always be private |
isReady boolean |
true if the template is ready to be used for a new instance |
isDynamicallyScalable boolean |
true if you can dynamically scale an instance with this template |
created string |
The creation date of the template |
osType string |
The OS type of the template (e.g. Ubuntu, CentOS...) |
availableInZones array[UUID] |
List of all zone ids that the template is available in |
SSH keys
SSH keys can be assigned to default users of instances by using the associate SSH key operation.
List SSH keys
curl -X GET \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/sshkeys"
# Example:
{
"data": [{
"name": "mellon",
"fingerprint": "91:8d:71:ca:2d:2c:ad:97:26:db:cb:c3:df:9a:e9:b6"
}],
"metadata": {
"recordCount": 1
}
}
GET /services/:service_code/:environment_name/sshkeys
Retrieve a list of all SSH keys in an environment
Attributes | |
---|---|
name string |
The name of the SSH key |
fingerprint string |
A short sequence of bytes used to identify the SSH key. |
Retrieve an SSH key
curl -X GET \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/sshkeys/mellon"
# Example:
{
"data": {
"name": "mellon",
"fingerprint": "91:8d:71:ca:2d:2c:ad:97:26:db:cb:c3:df:9a:e9:b6"
}
}
GET /services/:service_code/:environment_name/sshkeys/:name
Retrieve information about an SSH key of an environment
Attributes | |
---|---|
name string |
The name of the SSH key |
fingerprint string |
A short sequence of bytes used to identify the SSH key. |
Affinity groups
Affinity groups are a way of influencing on which host an instance will be deployed. An anti-affinity group (the only type of affinity group we support) allows you to put instances on different hosts to increase fault-tolerance. In the unlikely event of a host failure, your services would still be up on another host (assuming you distribute your services on multiple instances).
List affinity groups
curl -X GET \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/affinitygroups"
# Example:
{
"data": [{
"id": "d4fd794f-66e1-4906-a720-d0afb04bd517",
"name": "gnr",
"type":"host anti-affinity",
"instanceIds": [
"92b4df86-fee3-4610-8167-78332b86362f"
]
}],
"metadata": {
"recordCount": 1
}
}
GET /services/:service_code/:environment_name/affinitygroups
Retrieve a list of all affinity groups in an environment
Attributes | |
---|---|
id UUID |
The id of the affinity group |
name string |
The name of the affinity group |
type string |
The type of affinity group. We only support anti-affinity |
instanceIds Array[UUID] |
The ids of the instances in the affinity group |
Retrieve an affinity group
curl -X GET \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/affinitygroups/d4fd794f-66e1-4906-a720-d0afb04bd517"
# Example:
{
"data": {
"id": "d4fd794f-66e1-4906-a720-d0afb04bd517",
"name": "gnr",
"type": "host anti-affinity",
"instanceIds": [
"92b4df86-fee3-4610-8167-78332b86362f"
]
}
}
GET /services/:service_code/:environment_name/affinitygroups/:id
Retrieve information about an affinity group.
Attributes | |
---|---|
id UUID |
The id of the affinity group |
name string |
The name of the affinity group |
type string |
The type of affinity group. We only support anti-affinity |
instanceIds Array[UUID] |
The ids of the instances in the affinity group |
Create an affinity group
curl -X POST \
-H "Content-Type: application/json" \
-H "MC-Api-Key: your_api_key" \
-d "request_body" \
"https://api.cloud.ca/v1/services/compute-on/test_area/affinitygroups"
# Request should look like this
{
"name": "gnr",
"description": "My affinity group",
"type": "host anti-affinity",
"instanceIds": [
"92b4df86-fee3-4610-8167-78332b86362f"
]
}
POST /services/:service_code/:environment_name/affinitygroups
Create an affinity group and add instances to it.
Required | |
---|---|
name string |
The name of the new affinity group |
description string |
A description of the affinity group |
type string |
The type of new affinity group. We only support anti-affinity |
instanceIds Array[UUID] |
The ids of the instances in the affinity group |
Update an affinity group
curl -X PUT \
-H "Content-Type: application/json" \
-H "MC-Api-Key: your_api_key" \
-d "request_body" \
"https://api.cloud.ca/v1/services/compute-on/test_area/affinitygroups/d4fd794f-66e1-4906-a720-d0afb04bd517"
# Request should look like this
{
"instanceIds": [
"92b4df86-fee3-4610-8167-78332b86362f",
"105f8b5e-5482-4bf5-88ca-7d7b7f431e3e"
]
}
PUT /services/:service_code/:environment_name/affinitygroups/:id
Update the list of instances in the affinity group.
Required | |
---|---|
name string |
The name of the new affinity group |
description string |
A description of the affinity group |
type string |
The type of new affinity group. We only support anti-affinity |
instanceIds Array[UUID] |
The ids of the instances in the affinity group |
Delete an affinity group
curl -X DELETE \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/affinitygroups/d4fd794f-66e1-4906-a720-d0afb04bd517"
DELETE /services/:service_code/:environment_name/affinitygroups/:id
Delete an existing affinity group.
Networking
VPCs
A Virtual Private Cloud (VPC) is a logically isolated section of cloud.ca, where you can build a multi-network application architecture.
List VPCs
curl -X GET \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/vpcs"
# Example response:
{
"data": [{
"id": "9fe8e398-06d6-482c-8f55-b805bde4d3cc",
"name": "MyVPC",
"description": "Some VPC",
"cidr": "10.155.24.0/22",
"zoneId": "04afdbd1-e32d-4999-86d0-96703736dded",
"zoneName": "QC-1",
"state": "Enabled",
"networkDomain": "hello.world",
"vpcOfferingId": "21a40b85-5fa9-440f-ab77-5e560073b584",
"requiresUpgrade": false,
"sourceNatIp": "172.31.3.253",
"vpnStatus": "Disabled"
}],
"metadata": {
"recordCount": 1
}
}
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
vpcs, err := ccaResources.Vpcs.List()
GET /services/:service_code/:environment_name/vpcs
Retrieve a list of all VPCs of an environment
Attributes | |
---|---|
id UUID |
The id of the VPC |
name string |
The name of the VPC |
description string |
The description of the VPC |
cidr string |
The CIDR of a VPC |
zoneId string |
The id of the zone where the VPC was created |
zoneName string |
The name of the zone where the VPC was created |
state string |
The state of the VPC |
networkDomain string |
A custom DNS suffix at the level of a network |
requiresUpgrade string |
true if the VPC needs to be upgraded |
sourceNatIp string |
The source NAT IP of the VPC |
vpnStatus string |
The status of the VPN. The status can be ENABLED or DISABLED |
Retrieve a VPC
curl -X GET \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/vpcs/ad5bcae8-ee8b-4ee8-a7a4-381c25444b8e"
# Example response:
{
"data": {
"id": "9fe8e398-06d6-482c-8f55-b805bde4d3cc",
"name": "MyVPC",
"description": "Some VPC",
"cidr": "10.155.24.0/22",
"zoneId": "04afdbd1-e32d-4999-86d0-96703736dded",
"zoneName": "QC-1",
"state": "Enabled",
"networkDomain": "hello.world",
"vpcOfferingId": "21a40b85-5fa9-440f-ab77-5e560073b584",
"requiresUpgrade": false,
"sourceNatIp": "172.31.3.253",
"vpnStatus": "Disabled"
}
}
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
vpc, err := ccaResources.Vpcs.Get("ad5bcae8-ee8b-4ee8-a7a4-381c25444b8e")
GET /services/:service_code/:environment_name/vpcs/:id
Retrieve information about a VPC.
Attributes | |
---|---|
id UUID |
The id of the VPC |
name string |
The name of the VPC |
description string |
The description of the VPC |
cidr string |
The CIDR of a VPC |
zoneId string |
The id of the zone where the VPC was created |
zoneName string |
The name of the zone where the VPC was created |
state string |
The state of the VPC |
networkDomain string |
A custom DNS suffix at the level of a network |
requiresUpgrade string |
true if the VPC needs to be upgraded |
sourceNatIp string |
The source NAT IP of the VPC |
vpnStatus string |
The status of the VPN. The status can be ENABLED or DISABLED |
Create a VPC
# Example:
curl -X POST \
-H "Content-Type: application/json" \
-H "MC-Api-Key: your_api_key" \
-d "request_body" \
"https://api.cloud.ca/v1/services/compute-on/test_area/vpcs"
# Request example:
{
"name": "my_vpc",
"description": "My prod VPC",
"vpcOfferingId": "21a40b85-5fa9-440f-ab77-5e560073b584",
"networkDomain": "hello.world"
}
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
createdVpc, err := ccaResources.Vpcs.Create(cloudca.Vpc{
Name: "my_vpc",
Description: "My prod VPC",
VpcOfferingId: "21a40b85-5fa9-440f-ab77-5e560073b584",
NetworkDomain:"hello.world"
})
resource "cloudca_vpc" "my_vpc" {
service_code = "compute-on"
environment_name = "test_area"
name = "my_vpc"
description = "This is a test vpc"
vpc_offering = "Default VPC offering"
}
POST /services/:service_code/:environment_name/vpcs
Create a VPC in an environment
Required | |
---|---|
name string |
The name of the new VPC |
description string |
The description of the new VPC |
vpcOfferingId UUID |
The id of the VPC offering to use for the new VPC |
Optional | |
---|---|
networkDomain string |
A custom DNS suffix at the level of a network |
Update a VPC
# Example:
curl -X PUT \
-H "Content-Type: application/json" \
-H "MC-Api-Key: your_api_key" \
-d "request_body" \
"https://api.cloud.ca/v1/services/compute-on/test_area/vpcs/d77e1ab1-0320-4504-83c5-e78b431c7577"
# Request example:
{
"name": "my_updated_vpc",
"description": "My prod VPC"
}
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
updatedVpc, err := ccaResources.Vpcs.Update(cloudca.Vpc{
Id: "d77e1ab1-0320-4504-83c5-e78b431c7577",
Name: "my_updated_vpc",
Description: "My prod VPC",
})
PUT /services/:service_code/:environment_name/vpcs
Update an existing VPC in your environment
Optional | |
---|---|
name string |
The new name of the VPC |
description string |
The new description of the VPC |
Destroy a VPC
# Example:
curl -X DELETE \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/vpcs/ad5bcae8-ee8b-4ee8-a7a4-381c25444b8e"
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
success, err := ccaResources.Vpcs.Destroy("ad5bcae8-ee8b-4ee8-a7a4-381c25444b8e")
DELETE /services/:service_code/:environment_name/vpcs/:id
Destroy an existing VPC. To delete a VPC, you must first delete all the networks in the VPC.
Restart a VPC
# Example:
curl -X POST \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/vpcs/ad5bcae8-ee8b-4ee8-a7a4-381c25444b8e?operation=restart"
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
success, err := ccaResources.Vpcs.RestartRouter("ad5bcae8-ee8b-4ee8-a7a4-381c25444b8e")
POST /services/:service_code/:environment_name/vpcs/:id?operation=restart
Restart the router of a VPC.
Networks
A network is an isolated network with its own VLANs and CIDR list, where you can place groups of resources, such as instances.
List networks
curl -X GET \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/networks"
# Example response:
{
"data": [{
"id": "8ef7539c-c9ba-49f3-a484-a08f4ffb2234",
"name": "Frontend",
"description": "default network",
"vpcId": "12b8c150-b444-482a-8411-c08eaccb0a3b",
"vpcName": "SomeVPC",
"zoneId": "04afdbd1-e32d-4999-86d0-96703736dded",
"zoneName": "QC-1",
"cidr": "10.169.254.0/24",
"gateway": "10.169.254.1",
"netmask": "255.255.255.0",
"networkAclId": "9ba3ec65-2e1d-11e4-8e05-42a29a39fc92",
"networkAclName": "default_allow",
"networkOfferingId": "9593f0df-573a-43c4-a107-a5c704a7cfee",
"networkOfferingName": "Load Balanced Network",
"networkOfferingDescription": "Offering for Isolated Vpc networks with Source Nat service enabled",
"state": "Implemented"
}],
"metadata": {
"recordCount": 1
}
}
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
networks, err := ccaResources.Networks.List()
GET /services/:service_code/:environment_name/networks
Retrieve a list of all networks of an environment
Attributes | |
---|---|
id UUID |
The id of the network |
name string |
The name of the network |
description string |
The description of the network |
vpcId UUID |
The id of the VPC where the network was created |
vpcName string |
The name of the VPC where the network was created |
zoneId string |
The id of the zone where the network was created |
zoneName string |
The name of the zone where the network was created |
cidr string |
The cidr of the network |
gateway string |
The gateway of the network |
netmask string |
The netmask of the network |
networkAclId UUID |
The id of the network ACL of the the network |
networkAclName string |
The name of the network ACL of the the network |
networkOfferingId UUID |
The id of the network offering of the network |
networkOfferingName string |
The name of the network offering of the network |
networkOfferingDescription string |
The description of the network offering of the network |
state string |
The state of the network. Allocated if no instances where created in the network yet, Implemented otherwise. |
Query Parameters | |
---|---|
vpc_id UUID |
Filter the list to only retrieve the networks of a VPC |
zone_id UUID |
Filter the list to only retrieve the networks in a specific zone |
Retrieve a network
curl -X GET \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/networks/ad5bcae8-ee8b-4ee8-a7a4-381c25444b8e"
# Example response:
{
"data": {
"id": "8ef7539c-c9ba-49f3-a484-a08f4ffb2234",
"name": "Frontend",
"description": "default network",
"vpcId": "12b8c150-b444-482a-8411-c08eaccb0a3b",
"vpcName": "SomeVPC",
"zoneId": "04afdbd1-e32d-4999-86d0-96703736dded",
"zoneName": "QC-1",
"cidr": "10.169.254.0/24",
"gateway": "10.169.254.1",
"netmask": "255.255.255.0",
"networkAclId": "9ba3ec65-2e1d-11e4-8e05-42a29a39fc92",
"networkAclName": "default_allow",
"networkOfferingId": "9593f0df-573a-43c4-a107-a5c704a7cfee",
"networkOfferingName": "Load Balanced Network",
"networkOfferingDescription": "Offering for Isolated Vpc networks with Source Nat service enabled",
"state": "Implemented"
}
}
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
network, err := ccaResources.Networks.Get("ad5bcae8-ee8b-4ee8-a7a4-381c25444b8e")
GET /services/:service_code/:environment_name/networks/:id
Retrieve information about a network.
Attributes | |
---|---|
id UUID |
The id of the network |
name string |
The name of the network |
description string |
The description of the network |
vpcId UUID |
The id of the VPC where the network was created |
vpcName string |
The name of the VPC where the network was created |
zoneId string |
The id of the zone where the network was created |
zoneName string |
The name of the zone where the network was created |
cidr string |
The cidr of the network |
gateway string |
The gateway of the network |
netmask string |
The netmask of the network |
networkAclId UUID |
The id of the network ACL of the the network |
networkAclName string |
The name of the network ACL of the the network |
networkOfferingId UUID |
The id of the network offering of the network |
networkOfferingName string |
The name of the network offering of the network |
networkOfferingDescription string |
The description of the network offering of the network |
state string |
The state of the network. Allocated if no instances where created in the network yet, Implemented otherwise. |
Create a network
# Example:
curl -X POST \
-H "Content-Type: application/json" \
-H "MC-Api-Key: your_api_key" \
-d "request_body" \
"https://api.cloud.ca/v1/services/compute-on/test_area/networks"
# Request example:
{
"name": "my_network",
"description": "My production network",
"vpcId": "b1932c7c-0b85-450f-92b9-bfdeb3e80804",
"networkOfferingId": "c5d4ffcd-56e2-407a-8b4d-06082b7365c4",
"networkAclId": "9ba3ec65-2e1d-11e4-8e05-42a29a39fc92"
}
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
createdNetwork, err := ccaResources.Networks.Create(cloudca.Network{
Name: "my_network",
Description: "My production network",
VpcId: "b1932c7c-0b85-450f-92b9-bfdeb3e80804",
NetworkOfferingId: "c5d4ffcd-56e2-407a-8b4d-06082b7365c4",
NetworkAclId: "9ba3ec65-2e1d-11e4-8e05-42a29a39fc92"
}, map[string]string{})
resource "cloudca_network" "my_network" {
service_code = "compute-on"
environment_name = "test_area"
name = "my_network"
description = "This is a prod network"
vpc_id = "8b46e2d1-bbc4-4fad-b3bd-1b25fcba4cec"
network_offering = "Standard Network"
network_acl_id = "7d428416-263d-47cd-9270-2cdbdf222f57"
}
POST /services/:service_code/:environment_name/networks
Create a network in an environment
Required | |
---|---|
name string |
The name of the new network |
description string |
The description of the new network |
vpcId UUID |
The id of the VPC where to create the network |
networkOfferingId UUID |
The id of the network offering to use for the network |
networkAclId UUID |
The id of the network ACL to use for the network |
Update a network
# Example:
curl -X PUT \
-H "Content-Type: application/json" \
-H "MC-Api-Key: your_api_key" \
-d "request_body" \
"https://api.cloud.ca/v1/services/compute-on/test_area/networks/9572d2ea-a60d-478a-a75e-8ed31f2641f1"
# Request example:
{
"name": "my_updated_network",
"description": "My updated production network"
}
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
updatedNetwork, err := ccaResources.Networks.Update("9572d2ea-a60d-478a-a75e-8ed31f2641f1", cloudca.Network{
Name: "my_updated_network",
Description: "My updated production network"
})
POST /services/:service_code/:environment_name/networks/9572d2ea-a60d-478a-a75e-8ed31f2641f1
Update an existing network in an environment
Required | |
---|---|
name string |
The updated name of the network |
description string |
The updated description of the network |
Delete a network
# Example:
curl -X DELETE \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/networks/9572d2ea-a60d-478a-a75e-8ed31f2641f1"
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
success, err := ccaResources.Networks.Delete("9572d2ea-a60d-478a-a75e-8ed31f2641f1")
POST /services/:service_code/:environment_name/networks/9572d2ea-a60d-478a-a75e-8ed31f2641f1
Delete an existing network in an environment To delete a network, you must first delete all the instances in the network.
Replace the network ACL
# Example:
curl -X POST \
-H "Content-Type: application/json" \
-H "MC-Api-Key: your_api_key" \
-d "request_body" \
"https://api.cloud.ca/v1/services/compute-on/test_area/networks/9572d2ea-a60d-478a-a75e-8ed31f2641f1?operation=replace"
# Request example:
{
"name": "my_updated_network",
"description": "My updated production network"
}
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
success, err := ccaResources.Networks.ChangeAcl("9572d2ea-a60d-478a-a75e-8ed31f2641f1", "9ba3863e-2e1d-11e4-8e05-42a29a39fc92")
POST /services/:service_code/:environment_name/networks/9572d2ea-a60d-478a-a75e-8ed31f2641f1?operation=replace
Replace the network ACL.
Required | |
---|---|
networkAclId string |
The id of the network ACL to use for the network |
Network ACLs
Manage access control lists and their rules. To apply an ACL to a network, replace the ACL of a network.
List network ACLs
curl -X GET \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/networkacls?vpc_id=eb763d03-9935-4cd4-8a42-99134e242ccb"
{
"data": [
{
"id": "736d0c2e-d6b5-43fc-bcf0-732fce9a509e",
"vpcId": "eb763d03-9935-4cd4-8a42-99134e242ccb",
"name": "custom-1",
"description": "Allows network egress"
},
{
"id": "3246de94-e7e7-11e3-9187-06669c0000ad",
"name": "default_allow",
"description": "Default Network ACL Allow All"
},
{
"id": "32467792-e7e7-11e3-9187-06669c0000ad",
"name": "default_deny",
"description": "Default Network ACL Deny All"
}
],
"metadata": {
"recordCount": 3
}
}
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
acls, err := ccaResources.NetworkAcls.ListByVpcId("eb763d03-9935-4cd4-8a42-99134e242ccb")
GET /services/:service_code/:environment_name/networkacls?vpc_id=:vpc_id
Retrieve a list of network ACLs in a VPC.
Attributes | |
---|---|
id UUID |
The id of the network ACL |
name string |
The name of the network ACL |
description string |
The description of the network ACL |
vpcId UUID |
The VPC where this rule is available. Not present on default_allow and default_deny ACLs |
Query Parameters | |
---|---|
vpc_id UUID |
Filter the list to only retrieve the network ACLs of a specific VPC |
Retrieve a network ACL
curl -X GET \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/networkacls/:id"
{
"data": {
"id": "736d0c2e-d6b5-43fc-bcf0-732fce9a509e",
"vpcId": "eb763d03-9935-4cd4-8a42-99134e242ccb",
"name": "custom-1",
"description": "Allows network egress"
}
}
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
acl, err := ccaResources.NetworkAcls.Get("736d0c2e-d6b5-43fc-bcf0-732fce9a509e")
GET /services/:service_code/:environment_name/networkacls/:id
Retrieve a specific network ACL by its id.
Attributes | |
---|---|
id UUID |
The id of the network ACL |
name string |
The name of the network ACL |
description string |
The description of the network ACL |
vpcId UUID |
The VPC where this rule is available. Not present on default_allow and default_deny ACLs |
Create network ACL
curl -X POST \
-H "Content-Type: application/json" \
-H "MC-Api-Key: your_api_key" \
-d "request_body" \
"https://api.cloud.ca/v1/services/compute-on/test_area/networkacls"
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
acl, err := ccaResources.NetworkAcls.Create(cloudca.NetworkAcl{
Name: "network-ingress",
Description: "Allows network ingress",
VpcId: "eb763d03-9935-4cd4-8a42-99134e242ccb",
})
resource "cloudca_network_acl" "my_acl" {
service_code = "compute-on"
environment_name = "test_area"
name = "network-ingress"
description = "Allows network ingress"
vpc_id = "eb763d03-9935-4cd4-8a42-99134e242ccb"
}
POST /services/:service_code/:environment_name/networkacls
Create a new network ACL associated to a VPC.
Required | |
---|---|
name string |
The name of the network ACL |
description string |
The description of the network ACL |
vpcId UUID |
Networks of this VPC will be able to use the new ACL |
Delete a network ACL
curl -X DELETE \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/networkacls/736d0c2e-d6b5-43fc-bcf0-732fce9a509e"
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
success, err := ccaResources.NetworkAcls.Delete("736d0c2e-d6b5-43fc-bcf0-732fce9a509e")
DELETE /services/:service_code/:environment_name/networkacls/:id
Delete an ACL and all of its rules.
List a network ACL's rules
curl -X GET \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/networkaclrules?network_acl_id=3246de94-e7e7-11e3-9187-06669c0000ad"
{
"data": [
{
"id": "3247167a-e7e7-11e3-9187-06669c0000ad",
"networkAclId": "3246de94-e7e7-11e3-9187-06669c0000ad",
"ruleNumber": "2",
"cidr": "0.0.0.0/0",
"action": "Allow",
"protocol": "ALL",
"trafficType": "Egress",
"state": "Active"
},
{
"id": "3246fdb6-e7e7-11e3-9187-06669c0000ad",
"networkAclId": "3246de94-e7e7-11e3-9187-06669c0000ad",
"ruleNumber": "1",
"cidr": "0.0.0.0/0",
"action": "Allow",
"protocol": "ALL",
"trafficType": "Ingress",
"state": "Active"
}
],
"metadata": {
"recordCount": 2
}
}
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
rules, err := ccaResources.NetworkAclRules.ListByNetworkAclId("3246de94-e7e7-11e3-9187-06669c0000ad")
GET /services/:service_code/:environment_name/networkaclrules?network_acl_id=:network_acl_id
List a network ACL's rules.
Attributes | |
---|---|
id UUID |
The id of the network ACL rule |
networkAclId UUID |
The id of the network ACL that this rule belongs to |
ruleNumber int |
The relative position of this rule in its ACL |
cidr CIDR |
The network addresses targeted by this rule |
action string |
What to do with traffic matched by this rule. Either Allow or Deny |
protocol string |
The protocols targeted by this rule. TCP, UDP, ICMP, or ALL |
trafficType string |
The direction of traffic targeted by this rule. Either Ingress or Egress |
state string |
The state of this rule. Either Active or Inactive |
Query Parameters | |
---|---|
network_acl_id UUID |
Filter the list to only retrieve the rules of a specific network ACL |
Retrieve a network ACL rule
curl -X GET \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/networkaclrules/3247167a-e7e7-11e3-9187-06669c0000ad"
{
"data": {
"id": "3247167a-e7e7-11e3-9187-06669c0000ad",
"networkAclId": "3246de94-e7e7-11e3-9187-06669c0000ad",
"ruleNumber": "2",
"cidr": "0.0.0.0/0",
"action": "Allow",
"protocol": "ALL",
"trafficType": "Egress",
"state": "Active"
}
}
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
rules, err := ccaResources.NetworkAclRules.Get("3247167a-e7e7-11e3-9187-06669c0000ad")
GET /services/:service_code/:environment_name/networkaclrules/:id
Attributes | |
---|---|
id UUID |
The id of the network ACL rule |
networkAclId UUID |
The id of the network ACL that this rule belongs to |
ruleNumber int |
The relative position of this rule in its ACL |
cidr CIDR |
The network addresses targeted by this rule |
action string |
What to do with traffic matched by this rule. Either Allow or Deny |
protocol string |
The protocols targeted by this rule. TCP, UDP, ICMP, or ALL |
trafficType string |
The direction of traffic targeted by this rule. Either Ingress or Egress |
state string |
The state of this rule. Either Active or Inactive |
Create a network ACL rule
curl -X POST \
-H "Content-Type: application/json" \
-H "MC-Api-Key: your_api_key" \
-d "request_body" \
"https://api.cloud.ca/v1/services/compute-on/test_area/networkaclrules"
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
rule, err := ccaResources.NetworkAclRules.Create(cloudca.NetworkAclRule{
NetworkAclId: "3247167a-e7e7-11e3-9187-06669c0000ad",
RuleNumber: 1,
Cidr: "0.0.0.0/0",
Action: "Deny",
TrafficType: "Ingress",
Protocol: "ALL",
})
resource "cloudca_network_acl_rule" "my_acl_rule" {
service_code = "compute-on"
environment_name = "test_area"
network_acl_id = "3247167a-e7e7-11e3-9187-06669c0000ad"
rule_number = 1
cidr = "0.0.0.0/0"
action = "Deny"
traffic_type = "Ingress"
protocol = "ALL"
}
POST /services/:service_code/:environment_name/networkaclrules
Required | |
---|---|
networkAclId UUID |
The id of the network ACL to add this rule to |
ruleNumber int |
The relative position of this rule in its ACL |
cidr CIDR |
The network addresses targeted by this rule |
action string |
What to do with traffic matched by this rule. Either Allow or Deny |
protocol string |
The protocols targeted by this rule. TCP, UDP, ICMP, or ALL |
trafficType string |
The direction of traffic targeted by this rule. Either Ingress or Egress |
Protocol-specific | |
---|---|
startPort int |
The start of the port range targeted by this rule. Required if the protocol is TCP or UDP |
endPort int |
The end of the port range targeted by this rule. Required if the protocol is TCP or UDP |
icmpType int |
ICMP message type. Required if the protocol is ICMP |
icmpCode int |
ICMP message error code. Required if the protocol is ICMP |
Update a network ACL rule
curl -X PUT \
-H "Content-Type: application/json" \
-H "MC-Api-Key: your_api_key" \
-d "request_body" \
"https://api.cloud.ca/v1/services/compute-on/test_area/networkaclrules/3247167a-e7e7-11e3-9187-06669c0000ad"
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
rule, err := ccaResources.NetworkAclRules.Update("3247167a-e7e7-11e3-9187-06669c0000ad", cloudca.NetworkAclRule{
RuleNumber: 3,
Action: "Allow",
})
PUT /services/:service_code/:environment_name/networkaclrules/:id
Update a network ACL rule.
Optional | |
---|---|
ruleNumber int |
The relative position of this rule in its ACL |
cidr CIDR |
The network addresses targeted by this rule |
action string |
What to do with traffic matched by this rule. Either Allow or Deny |
protocol string |
The protocols targeted by this rule. TCP, UDP, ICMP, or ALL |
trafficType string |
The direction of traffic targeted by this rule. Either Ingress or Egress |
startPort int |
The start of the port range targeted by this rule |
endPort int |
The end of the port range targeted by this rule |
icmpType int |
ICMP message type |
icmpCode int |
ICMP message error code |
Delete a network ACL rule
curl -X DELETE \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/networkaclrules/3247167a-e7e7-11e3-9187-06669c0000ad"
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
success, err := ccaResources.NetworkAclRules.Delete("3247167a-e7e7-11e3-9187-06669c0000ad")
DELETE /services/:service_code/:environment_name/networkaclrules/:id
Delete a specific rule of a network ACL.
Public IPs
List public IPs
curl -X GET \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/publicipaddresses"
# Example:
{
"data": [
{
"id": "0ed72307-e33d-4d41-90b7-7d2b4f0d1ae0",
"instances": [
{
"id": "986cfea3-4a94-407d-b915-eb2d49e4323f",
"name": "i-pdube-F49"
}
],
"ipAddress": "69.196.164.98",
"networkId": "def89cb6-f897-435a-ad7f-6b2d05ab11e6",
"networkName": "web",
"purposes": [
"PORT_FORWARDING"
],
"state": "Allocated",
"vpcId": "0687f5ce-89f9-47c8-9f58-c522455d56eb",
"vpcName": "secondary",
"zoneId": "ea901007-056b-4c50-bb3a-2dd635fce2ab",
"zoneName": "ON-1"
},
{
"id": "10001e7d-b4ef-489b-836e-0619a383bc8d",
"ipAddress": "208.80.152.201",
"purposes": [
"SOURCE_NAT"
],
"state": "Allocated",
"vpcId": "0687f5ce-89f9-47c8-9f58-c522455d56eb",
"vpcName": "primary",
"zoneId": "ea901007-056b-4c50-bb3a-2dd635fce2ab",
"zoneName": "ON-1"
}
],
"metadata": {
"recordCount": 2
}
}
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
publicIps, _ := ccaResources.PublicIps.List()
GET /services/:service_code/:environment_name/publicipaddresses
List allocated public IP addresses.
Attributes | |
---|---|
id UUID |
The id of the public IP |
instances Array[Instance] |
The associated instances includes: id ,name |
ipAddress string |
The IP address (e.g. 208.80.154.224) |
networkId UUID |
The associated network id |
networkName string |
The associated network name |
purposes Array[string] |
The list of purposes of the IP address.Possible values: STATIC_NAT , PORT_FORWARDING , LOAD_BALANCING , SOURCE_NAT or SOURCE_NAT and VPN |
state string |
The state of the public IP |
vpcId UUID |
The id of the VPC |
vpcName string |
The name of the VPC |
zoneId UUID |
The id of the zone |
zoneName string |
The name of the zone |
Query Parameters | |
---|---|
vpc_id UUID |
Filter the list to only retrieve the public IPs in a specific VPC |
instance_id UUID |
Filter the list to only retrieve the public IPs associated to a specific instance |
Retrieve a public IP
curl -X GET -H "MC-Api-Key: your_api_key"
"https://api.cloud.ca/v1/services/compute-on/test_area/publicipaddresses/10001e7d-b4ef-489b-836e-0619a383bc8d"
# Example:
{
"data": {
"id": "10001e7d-b4ef-489b-836e-0619a383bc8d",
"ipAddress": "208.80.152.201",
"purposes": [
"SOURCE_NAT"
],
"state": "Allocated",
"vpcId": "0687f5ce-89f9-47c8-9f58-c522455d56eb",
"vpcName": "primary",
"zoneId": "ea901007-056b-4c50-bb3a-2dd635fce2ab",
"zoneName": "ON-1"
}
}
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
publicIp, _ := ccaResources.PublicIps.Get("10001e7d-b4ef-489b-836e-0619a383bc8d")
GET /services/:service_code/:environment_name/publicipaddresses/:id
Retrieve a public IP address.
Attributes | |
---|---|
id UUID |
The id of the public IP |
instances Array[Instance] |
The associated instances includes: id ,name |
ipAddress string |
The IP address (e.g. 208.80.154.224) |
networkId UUID |
The associated network id |
networkName string |
The associated network name |
purposes Array[string] |
The list of purposes of the IP address.Possible values: STATIC_NAT , PORT_FORWARDING , LOAD_BALANCING , SOURCE_NAT or SOURCE_NAT and VPN |
state string |
The state of the public IP |
vpcId UUID |
The id of the VPC |
vpcName string |
The name of the VPC |
zoneId UUID |
The id of the zone |
zoneName string |
The name of the zone |
Acquire a public IP
curl -X POST \
-H "MC-Api-Key: your_api_key" \
-H "Content-Type: application/json" \
-d "request_body" \
"https://api.cloud.ca/v1/services/compute-on/test_area/publicipaddresses"
# Request should look like this
{
"vpcId": "0687f5ce-89f9-47c8-9f58-c522455d56eb"
}
POST /services/:service_code/:environment_name/publicipaddresses
Acquire a public IP address for a VPC.
Required | |
---|---|
vpcId UUID |
The id of the VPC where to acquire the public IP |
Release a public IP
curl -X DELETE \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/publicipaddresses/a723b2b1-e343-4ea1-afe0-bf345a99a92b"
DELETE /services/:service_code/:environment_name/publicipaddresses/:id
Release a public IP. When acquiring a public IP, you are not guaranteed to receive a previously owned public IP, so be careful when releasing public IPs.
Enable static NAT
curl -X POST \
-H "MC-Api-Key: your_api_key" \
-H "Content-Type: application/json" \
-d "request_body" \
"https://api.cloud.ca/v1/services/compute-on/test_area/publicipaddresses/a723b2b1-e343-4ea1-afe0-bf345a99a92b?operation=enableStaticNat"
# Request should look like this
{
"privateIpId": "5e30609d-7098-4d93-8317-3ecfe316ed00"
}
POST /services/:service_code/:environment_name/publicipaddresses/:id?operation=enableStaticNat
Enable static NAT on a public IP address.
Required | |
---|---|
privateIpId string |
The private IP id of the instance which is to be available on that IP. It can also be done on a secondary IP id. |
Disable static NAT
curl -X POST \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/publicipaddresses/a723b2b1-e343-4ea1-afe0-bf345a99a92b?operation=disableStaticNat"
POST /services/:service_code/:environment_name/publicipaddresses/:id?operation=disableStaticNat
Disable static NAT on that public IP.
Port forwarding rules
Port forwarding allows traffic from external hosts to services offered by applications in your VPCs. A port forwarding rule is a mapping of public IP ports to private IP ports (i.e. forwards traffic from a public IP to an instance).
List port forwarding rules
curl -X GET \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/portforwardingrules"
# Example response:
{
"data": [{
"id": "bf145d1e-7beb-42b8-bd2c-1a316aeb9aef",
"ipAddress": "74.121.244.23",
"ipAddressId": "747e30d0-a0cd-48ba-b7d8-77a2f7e10504",
"privatePortStart": "8080",
"privatePortEnd": "8080",
"publicPortStart": "80",
"publicPortEnd": "80",
"protocol": "TCP",
"instanceId": "d7328dd9-882e-4d08-8ad2-c74c2d493689",
"instanceName": "my_app_instance",
"networkId": "7388f551-4163-4467-b49b-58e9310d7207",
"vpcId": "39907f0a-c253-42b8-b02d-337e00e9851e",
"privateIp": "10.155.24.145",
"privateIpId": "10.155.24.145 "
}],
"metadata": {
"recordCount": 1
}
}
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
portForwardingRules, err := ccaResources.PortForwardingRules.List()
GET /services/:service_code/:environment_name/portforwardingrules
Retrieve a list of all port forwarding rules of an environment.
Attributes | |
---|---|
id UUID |
The id of the port forwarding rule |
ipAddress string |
The ip address of the public IP associated to this port forwarding rule |
ipAddressId UUID |
The id of the public IP associated to this port forwarding rule |
privatePortStart string |
The start of the private port range |
privatePortEnd string |
The end of the private port range |
publicPortStart string |
The start of the public port range |
publicPortEnd string |
The end of the public port range |
protocol string |
The protocol of the port forwarding rule (e.g. TCP, UDP) |
instanceId UUID |
The id of the instance of the port forwarding rule |
instanceName string |
The name of the instance of the port forwarding rule |
networkId UUID |
The id of the network of the port forwarding rule |
vpcId UUID |
The id of the VPC of the port forwarding rule |
privateIp string |
The private IP address of the instance where the traffic will be forwarded |
privateIpId UUID |
The id of private IP address of the instance where traffic will be forwarded |
Query Parameters | |
---|---|
instance_id UUID |
Filter the list to only retrieve the port forwarding rules of an instance |
Retrieve a port forwarding rule
curl -X GET \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/portforwardingrules/ad5bcae8-ee8b-4ee8-a7a4-381c25444b8e"
# Example response:
{
"data": {
"id": "bf145d1e-7beb-42b8-bd2c-1a316aeb9aef",
"ipAddress": "74.121.244.23",
"ipAddressId": "747e30d0-a0cd-48ba-b7d8-77a2f7e10504",
"privatePortStart": "8080",
"privatePortEnd": "8080",
"publicPortStart": "80",
"publicPortEnd": "80",
"protocol": "TCP",
"instanceName": "my_app_instance",
"instanceId": "d7328dd9-882e-4d08-8ad2-c74c2d493689",
"networkId": "7388f551-4163-4467-b49b-58e9310d7207",
"vpcId": "39907f0a-c253-42b8-b02d-337e00e9851e",
"privateIp": "10.155.24.145",
"privateIpId": "fc9d60a5-a8f8-4d01-a63f-f1731440063f"
}
}
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
portForwardingRule, err := ccaResources.PortForwardingRule.Get("bf145d1e-7beb-42b8-bd2c-1a316aeb9aef")
GET /services/:service_code/:environment_name/portforwardingrules/:id
Retrieve information about a port forwarding rule.
Attributes | |
---|---|
id UUID |
The id of the port forwarding rule |
ipAddress string |
The ip address of the public IP associated to this port forwarding rule |
ipAddressId UUID |
The id of the public IP associated to this port forwarding rule |
privatePortStart string |
The start of the private port range |
privatePortEnd string |
The end of the private port range |
publicPortStart string |
The start of the public port range |
publicPortEnd string |
The end of the public port range |
protocol string |
The protocol of the port forwarding rule (e.g. TCP, UDP) |
instanceId UUID |
The id of the instance of the port forwarding rule |
instanceName string |
The name of the instance of the port forwarding rule |
networkId UUID |
The id of the network of the port forwarding rule |
vpcId UUID |
The id of the VPC of the port forwarding rule |
privateIp string |
The private IP address of the instance where requests will be forwarded |
privateIpId UUID |
The id of private IP address of the instance where requests will be forwarded |
Create a port forwarding rule
# Example:
curl -X POST \
-H "Content-Type: application/json" \
-H "MC-Api-Key: your_api_key" \
-d "request_body" \
"https://api.cloud.ca/v1/services/compute-on/test_area/portforwardingrules"
# Request example:
{
"ipAddressId": "4daf6ce5-a8b1-47d2-96b3-8edda63d891c",
"instanceId": "0ec9ee23-f9dd-4830-acb6-7f8d4469673a",
"protocol": "TCP",
"privatePortStart": "8080",
"privatePortEnd": "8080",
"publicPortStart": "80",
"publicPortEnd": "80"
}
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
createdVpc, err := ccaResources.PortForwardingRules.Create(cloudca.PortForwardingRule{
PublicIpId: "4daf6ce5-a8b1-47d2-96b3-8edda63d891c"
InstanceId: "0ec9ee23-f9dd-4830-acb6-7f8d4469673a",
Protocol: "TCP",
PrivatePortStart: "8080",
PrivatePortEnd: "8080",
PublicPortStart: "80",
PublicPortEnd: "80"
})
resource "cloudca_port_forwarding_rule" "web_pfr" {
service_code = "compute-on"
environment_name = "test_area"
public_ip_id = "4daf6ce5-a8b1-47d2-96b3-8edda63d891c"
public_port_start = 80
private_ip_id = "30face92-f1cf-4064-aa7f-008ea09ef7f0"
private_port_start = 8080
protocol = "TCP"
}
POST /services/:service_code/:environment_name/portforwardingrules
Create a port forwarding rule for a public IP.
Required | |
---|---|
ipAddressId UUID |
The id of the public IP where the port forwarding should be created |
protocol string |
The protocol (e.g. TCP, UDP) to forward |
privatePortStart string |
The start of the private port range |
privatePortEnd string |
The end of the private port range |
publicPortStart string |
The start of the public port range |
publicPortEnd string |
The end of the public port range |
Optional | |
---|---|
instanceId UUID |
The id of the instance that will have a port forwarded (it will use the default private port) |
privateIpId UUID |
The id of the private IP to forward |
Delete a port forwarding rule
# Example:
curl -X DELETE \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/portforwardingrules/7d22b390-cbb3-4df6-96c6-52901ccb63c0"
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
success, err := ccaResources.PortForwardingRules.Delete("7d22b390-cbb3-4df6-96c6-52901ccb63c0")
DELETE /services/:service_code/:environment_name/portforwardingrules/:id
Delete an existing port forwarding rule.
Load balancer rules
List load balancer rules
curl -X GET \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/loadbalancerrules?public_ip_id=eb763d03-9935-4cd4-8a42-99134e242ccb"
{
"data": [
{
"id": "32804ef2-dea6-4b07-b507-b3562bb9844a",
"name": "web_lbr",
"networkId": "394873ef-8655-49b6-8096-58b99c4e2347",
"publicIp": "172.31.3.202",
"publicIpId": "44ebac5d-18cc-4eea-ab59-7a2af0691c88",
"publicPort": "80",
"privatePort": "80",
"algorithm": "roundrobin",
"protocol": "ssl",
"stickinessMethod": "AppCookie",
"instanceIds": [
"d7048640-35d4-4a4f-8193-f4837da7e861"
],
"sslCertificateId": "b1bea50a-e5f0-4b1e-bc0d-1dde909ac49a",
"stickinessPolicyId": "217c1140-4146-4af0-92e9-ad47d4ff5ba9",
"stickinessPolicyParameters": {
"mode": "test",
"indirect": "false",
"domain": "some_domain",
"postonly": "false",
"nocache": "true",
"cookieName": "test"
}
}
],
"metadata": {
"recordCount": 1
}
}
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
lbrs, err := ccaResources.LoadBalancerRules.List()
GET /services/:service_code/:environment_name/loadbalancerrules?public_ip_id=:public_ip_id
Retrieve a list of load balancer rules.
Attributes | |
---|---|
id UUID |
The id of the load balancer rule |
name string |
The name of the load balancer rule |
networkId string |
The network id of the load balancer rule |
publicIp UUID |
The public IP of this load balancer rule |
publicIpId string |
The id of the public IP of this load balancer rule |
publicPort int |
The public port of this load balancer rule |
privatePort int |
The private port of this load balancer rule |
algorithm string |
The algorithm to use for this load balancer rule |
protocol string |
The protocol to load balance |
stickinessMethod string |
The stickiness policy of the load balancer rule |
stickinessPolicyParameters Map[string,string] |
The stickiness policy parameters of the load balancer rule |
instanceIds Array[string] |
The ids of the instances being load balanced |
Query Parameters | |
---|---|
public_ip_id UUID |
Filter the list to only retrieve the load balancer rules of a public IP |
Retrieve a load balancer rule
curl -X GET \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/loadbalancerrules/:id"
{
"data": {
"id": "f8ed7f44-449c-4510-848c-dc18e6665db1",
"name": "web_lbr",
"networkId": "394873ef-8655-49b6-8096-58b99c4e2347",
"publicIp": "172.31.3.202",
"publicIpId": "44ebac5d-18cc-4eea-ab59-7a2af0691c88",
"publicPort": "22",
"privatePort": "22",
"algorithm": "roundrobin",
"protocol": "tcp",
"stickinessMethod": "LbCookie",
"instanceIds": [
"056cbb23-9021-4df7-b458-721ed9153ba9"
],
"stickinessPolicyId": "29a1946c-5b59-4ab1-b9b8-5c73444b1c10",
"stickinessPolicyParameters": {
"mode": "test",
"indirect": "false",
"domain": "some_domain",
"postonly": "false",
"nocache": "true",
"cookieName": "test"
}
}
}
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
lbr, err := ccaResources.LoadBalancerRules.Get("736d0c2e-d6b5-43fc-bcf0-732fce9a509e")
GET /services/:service_code/:environment_name/loadbalancerrules/:id
Retrieve a specific load balancer rule by its id.
Attributes | |
---|---|
id UUID |
The id of the load balancer rule |
name string |
The name of the load balancer rule |
networkId string |
The network id of the load balancer rule |
publicIp UUID |
The public IP of this load balancer rule |
publicIpId string |
The id of the public IP of this load balancer rule |
publicPort int |
The public port of this load balancer rule |
privatePort int |
The private port of this load balancer rule |
algorithm string |
The algorithm to use for this load balancer rule |
protocol string |
The protocol to load balance |
stickinessMethod string |
The stickiness policy of the load balancer rule |
stickinessPolicyParameters Map[string,string] |
The stickiness policy parameters of the load balancer rule |
instanceIds Array[string] |
The ids of the instances being load balanced |
Create a load balancer rule
curl -X POST \
-H "Content-Type: application/json" \
-H "MC-Api-Key: your_api_key" \
-d "request_body" \
"https://api.cloud.ca/v1/services/compute-on/test_area/loadbalancerrules"
# Request example:
{
"name": "test",
"publicIpId": "44ebac5d-18cc-4eea-ab59-7a2af0691c88",
"networkId": "093f6208-8a56-4035-8e71-3e39029fc5aa",
"publicPort": "80",
"privatePort": "80",
"algorithm": "roundrobin",
"protocol": "ssl",
"stickinessMethod": "AppCookie",
"instanceIds": [
"d7048640-35d4-4a4f-8193-f4837da7e861"
],
"sslCertificateId": "b1bea50a-e5f0-4b1e-bc0d-1dde909ac49a",
"stickinessPolicyParameters": {
"holdtime": 3600000
}
}
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
lbr, err := ccaResources.LoadBalancerRules.Create(cloudca.LoadBalancerRule{
Name: "test",
PublicIpId: "44ebac5d-18cc-4eea-ab59-7a2af0691c88",
NetworkId: "093f6208-8a56-4035-8e71-3e39029fc5aa",
PublicPort: "80",
PrivatePort: "80",
Algorithm: "roundrobin",
Protocol: "tcp",
StickinessMethod: "AppCookie",
StickinesPolicyParameters: map[string]string{,
"holdtime": "3600000",
},
InstanceIds: ["d7048640-35d4-4a4f-8193-f4837da7e861"]
})
resource "cloudca_load_balancer_rule" "lbr" {
service_code = "compute-qc"
environment_name = "dev"
name="web_lb"
public_ip_id="5cd3a059-f15b-49f7-b7e1-254fef15968d"
protocol="tcp"
algorithm = "leastconn"
public_port = 80
private_port = 80
instance_ids = ["071e2929-672e-45bc-a5b6-703d17c08367"]
stickiness_method = "AppCookie"
stickiness_params {
cookieName = "allo"
}
}
POST /services/:service_code/:environment_name/loadbalancerrules
Create a new load balancer rule associated to a public IP.
Required | |
---|---|
name string |
The name of the load balancer rule |
publicIpId string |
The id of the public IP of this load balancer rule |
publicPort int |
The public port of this load balancer rule |
privatePort int |
The private port of this load balancer rule |
algorithm string |
The algorithm to use for this load balancer rule (roundrobin, leastconn or source) |
protocol string |
The protocol to load balance (TCP, UDP or TCP-PROXY) |
Optional (required if public IP already assigned a network) | |
---|---|
networkId string |
The network id of the load balancer rule |
Optional | |
---|---|
stickinessMethod string |
The stickiness policy of the load balancer rule |
stickinessPolicyParameters Map[string, object] |
The stickiness policy parameters of the load balancer rule |
instanceIds Array[string] |
The ids of the instances being load balanced |
sslCertificateId UUID |
The id of the SSL certificate for the load balancer rule. Can only be used with SSL protocol. |
LbCookie parameters | |
---|---|
cookieName string |
Name of the cookie to be inserted by the load balancer for load balancing |
mode string |
rewrite, insert or prefix. rewrite: This keyword indicates that the cookie will be provided by the server and that the load balancer will have to modify its value to set the server's identifier in it. insert: This keyword indicates that the persistence cookie will have to be inserted by the load balancer in server responses if the client did not already have a cookie that would have permitted it to access this server. prefix: This keyword indicates that instead of relying on a dedicated cookie for the persistence, an existing one will be completed. |
nocache boolean |
This option is recommended in conjunction with the insert mode when there is a cache between the client and the load balancer, as it ensures that a cacheable response will be tagged non-cacheable if a cookie needs to be inserted. |
indirect boolean |
When this option is specified, no cookie will be emitted to a client which already has a valid one for the server which has processed the request. |
postonly boolean |
This option ensures that cookie insertion will only be performed on responses to POST requests. |
domain string |
This option allows to specify the domain at which a cookie is inserted. |
AppCookie parameters | |
---|---|
cookieName string |
Name of the cookie to be inserted by the application for load balancing. |
mode string |
This option allows to change the URL parser mode. path-parameters (default) will look for the appsession cookie in the path parameters. query-parameters will look for the appsession cookie in the query parameters. |
length string |
The maximum number of characters to check in the cookie value. |
holdtime boolean |
Time in milliseconds that the cookie should be saved. |
requestLearn boolean |
If true, then it will be able to learn the cookie found in the request in case the server does not specify any in response. |
prefix string |
If true, then it will match on the cookie prefix (or URL parameter prefix). The appsession value is the data following this prefix. |
SourceBased parameters | |
---|---|
tableSize string |
The maximum number of entries that can be stored in the table. |
expires string |
Defines the maximum duration of an entry in the table since it was last created, refreshed or matched. The expiration delay is defined using the standard time format, similarly as the various timeouts. |
For more information, please consult section 4.2 of the HAProxy configuration manual. (AppCookie, LbCookie, SourceBased)
Update a load balancer rule
curl -X PUT \
-H "Content-Type: application/json" \
-H "MC-Api-Key: your_api_key" \
-d "request_body" \
"https://api.cloud.ca/v1/services/compute-on/test_area/loadbalancerrules/3247167a-e7e7-11e3-9187-06669c0000ad"
# Request example:
{
"name": "test",
"algorithm": "roundrobin"
}
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
lbr, err := ccaResources.LoadBalancerRules.Update("3247167a-e7e7-11e3-9187-06669c0000ad", cloudca.LoadBalancerRule{
Name: "newtest",
Algorithm: "leastconn",
})
PUT /services/:service_code/:environment_name/loadbalancerrules/:id
Update a load balancer rule.
Optional | |
---|---|
name string |
The name of the load balancer rule |
algorithm string |
The algorithm of the load balancer rule (roundrobin, leastconn or source) |
Update instances of a load balancer rule
curl -X PUT \
-H "Content-Type: application/json" \
-H "MC-Api-Key: your_api_key" \
-d "request_body" \
"https://api.cloud.ca/v1/services/compute-on/test_area/loadbalancerrules/3247167a-e7e7-11e3-9187-06669c0000ad"
# Request example:
{
"instanceIds": [
"95d034b5-b902-440c-b430-120efaed9caf", "60df0bc2-f59b-4608-8147-1b8ac4a39add"
]
}
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
err := ccaResources.LoadBalancerRules.SetLoadBalancerRuleInstances("3247167a-e7e7-11e3-9187-06669c0000ad", []string {"95d034b5-b902-440c-b430-120efaed9caf"})
PUT /services/:service_code/:environment_name/loadbalancerrules/:id?operation=updateInstances
Update instances of a load balancer rule.
Required | |
---|---|
instanceIds Array[String] |
The instances of the load balancer rule |
Update stickiness policy of a load balancer rule
curl -X PUT \
-H "Content-Type: application/json" \
-H "MC-Api-Key: your_api_key" \
-d "request_body" \
"https://api.cloud.ca/v1/services/compute-on/test_area/loadbalancerrules/3247167a-e7e7-11e3-9187-06669c0000ad"
# Request example:
{
"stickinessMethod": "LbCookie",
"stickinessPolicyParameters": {
"mode": "test",
"indirect": "false",
"domain": "some_domain",
"postonly": "false",
"nocache": "true",
"cookieName": "test"
}
}
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
lbr, err := ccaResources.LoadBalancerRules.SetLoadBalancerRuleStickinessPolicy("3247167a-e7e7-11e3-9187-06669c0000ad", "LbCookie", map[string]string{,
"holdtime": "3600000",
})
PUT /services/:service_code/:environment_name/loadbalancerrules/:id?operation=updateStickiness
Update instances of a load balancer rule.
Required | |
---|---|
stickinessMethod string |
The stickiness policy for the load balancer rule |
stickinessPolicyParameters Map[String, String] |
The parameters for the stickiness policy of the load balancer rule |
See Create a load balance rule for stickiness policy parameters documentation.
Delete a load balancer rule
curl -X DELETE \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/loadbalancerrules/736d0c2e-d6b5-43fc-bcf0-732fce9a509e"
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
success, err := ccaResources.LoadBalancerRules.Delete("736d0c2e-d6b5-43fc-bcf0-732fce9a509e")
DELETE /services/:service_code/:environment_name/loadbalancerrules/:id
Delete a load balancer rule.
NICs
List NICs
curl -X GET \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/nics"
# Example response:
{
"data": [{
"id": "fff1f45a-8350-4c87-be43-947b96d01ebd",
"name": "NIC-0",
"ipAddress": "10.169.253.165",
"isDefault": true,
"networkId": "d2243d4c-0dd8-4f8c-9ab4-4b1d285d5642",
"networkName": "Backend",
"gateway": "10.169.253.1",
"netmask": "255.255.255.0",
"instanceId": "b6145e8b-abd3ta-456c-832c-f3db86a6acfe",
"vpcId": "5aa9f5d7-55a9-43bf-bd2c-78a6bae1b267",
"vpcName": "default-vpc",
"secondaryIps": [
{
"id": "9c28e297-5d23-41a3-a167-34dc24f1df19",
"ipAddress": "10.169.253.124"
}
]
}],
"metadata": {
"recordCount": 1
}
}
GET :service_code/:environment_name/portforwardingrules
Retrieve a list of all NICs.
Attributes | |
---|---|
id UUID |
The id of the NIC |
name string |
The name of the NIC |
ipAddress string |
The IP address of the NIC |
isDefault string |
true if it's the default NIC of the instance (i.e. it will be the private IP on the instance) |
networkId UUID |
The id of the network of the NIC |
networkName string |
The name of the network of the NIC |
gateway string |
The gateway of the network associated with the NIC |
netmask string |
The netmask of the network associated with the NIC |
instanceId string |
The id of the instance associated with the NIC |
vpcId string |
The id of the VPC associated with the NIC |
vpcName string |
The name of the VPC associated with the NIC |
secondaryIps SecondaryIP |
The list of secondary IPs of the NIC includes: id , ipAddress |
Query Parameters | |
---|---|
instance_id UUID |
Filter the list to only retrieve the NICs of a specific instance |
network_id UUID |
Filter the list to only retrieve the NICs of a specific network |
Retrieve a NIC
curl -X GET \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/nics/fff1f45a-8350-4c87-be43-947b96d01ebd"
# Example response:
{
"data": {
"id": "fff1f45a-8350-4c87-be43-947b96d01ebd",
"name": "NIC-0",
"ipAddress": "10.169.253.165",
"isDefault": true,
"networkId": "d2243d4c-0dd8-4f8c-9ab4-4b1d285d5642",
"networkName": "Backend",
"gateway": "10.169.253.1",
"netmask": "255.255.255.0",
"instanceId": "b6145e8b-abd3ta-456c-832c-f3db86a6acfe",
"vpcId": "5aa9f5d7-55a9-43bf-bd2c-78a6bae1b267",
"vpcName": "default-vpc",
"secondaryIps": [
{
"id": "9c28e297-5d23-41a3-a167-34dc24f1df19",
"ipAddress": "10.169.253.124"
}
]
}
}
GET /services/:service_code/:environment_name/nics/:id
Retrieve an existing NIC.
Attributes | |
---|---|
id UUID |
The id of the NIC |
name string |
The name of the NIC |
ipAddress string |
The IP address of the NIC |
isDefault string |
true if it's the default NIC of the instance (i.e. it will be the private IP on the instance) |
networkId UUID |
The id of the network of the NIC |
networkName string |
The name of the network of the NIC |
gateway string |
The gateway of the network associated with the NIC |
netmask string |
The netmask of the network associated with the NIC |
instanceId string |
The id of the instance associated with the NIC |
vpcId string |
The id of the VPC associated with the NIC |
vpcName string |
The name of the VPC associated with the NIC |
secondaryIps SecondaryIP |
The list of secondary IPs of the NIC includes: id , ipAddress |
Create a NIC
# Example:
curl -X POST \
-H "Content-Type: application/json" \
-H "MC-Api-Key: your_api_key" \
-d "request_body" \
"https://api.cloud.ca/v1/services/compute-on/test_area/nics"
# Request example:
{
"networkId": "d67e986d-fe04-4827-836e-1697ede8ed30",
"instanceId": "96330eea-4424-46ca-825c-82fdd051d8c3"
}
POST /services/:service_code/:environment_name/nics
Create a NIC for an instance in a specific network. You can only have one NIC per network.
Required | |
---|---|
networkId string |
The id of the network where to create the NIC |
instanceId string |
The id of the instance where to attach the NIC |
Delete a NIC
# Example:
curl -X DELETE \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/nics"
DELETE /services/:service_code/:environment_name/nics/:id
Delete an existing NIC. The NIC you're trying to delete must not be the default one.
Set a NIC as default
# Example:
curl -X POST \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/nics/63ef1efe-225f-4e05-bc79-b3e457a041e2?operation=setDefault"
POST /services/:service_code/:environment_name/nics/:id?operation=setDefault
Set an existing NIC as the default NIC of an instance.
Remote access VPNs
Remote access VPNs allow users to connect to VPCs through secure connections.
List remote access VPNs
curl -H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/remoteaccessvpns"
# Response example:
{
"data": [
{
"id": "10001e7d-b4ef-489b-836e-0619a383bc8d",
"publicIpAddress": "69.196.164.31",
"publicIpAddressId": "10001e7d-b4ef-489b-836e-0619a383bc8d",
"state": "Disabled"
},
{
"id": "8925406c-8051-467e-a0ca-c48caa5bf670",
"presharedKey": "Kwth4JYUfXXmtMG4X7vAwRPH",
"publicIpAddress": "69.196.164.223",
"publicIpAddressId": "8925406c-8051-467e-a0ca-c48caa5bf670",
"state": "Enabled"
}
],
"metadata": {
"recordCount": 2
}
}
GET /services/:service_code/:environment_name/remoteaccessvpns
List remote access VPNs.
Attributes | |
---|---|
id UUID |
The id of the remote access VPN |
presharedKey string |
The VPN's preshared key |
publicIpAddress string |
The public IP (e.g. 208.80.154.224) |
publicIpAddressId string |
The id of the public IP |
state string |
The state. Possible values: Enabled , Disabled. |
Query Parameters | |
---|---|
vpc_id UUID |
Filter the list to only retrieve the VPN information of a specific VPC |
Retrieve a remote access VPN
curl -H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/remoteaccessvpns/10001e7d-b4ef-489b-836e-0619a383bc8d"
# Response example:
{
"data": {
"id": "10001e7d-b4ef-489b-836e-0619a383bc8d",
"publicIpAddress": "69.196.164.31",
"publicIpAddressId": "10001e7d-b4ef-489b-836e-0619a383bc8d",
"state": "Disabled"
}
}
GET /services/:service_code/:environment_name/remoteaccessvpns/:id
Retrieve a remote access VPN.
Attributes | |
---|---|
id UUID |
The id of the remote access VPN |
presharedKey string |
The VPN's preshared key |
publicIpAddress string |
The public IP (e.g. 208.80.154.224) |
publicIpAddressId string |
The id of the public IP |
state string |
The state. Possible values: Enabled , Disabled. |
VPN users
VPN users are the accounts that are allowed to connect to remote access VPNs.
List VPN users
curl -X GET \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/vpnusers"
# Response example:
{
"data": [
{
"id": "5de76bf5-9f61-487a-a989-042b52882da4",
"username": "wilson"
}
],
"metadata": {
"recordCount": 1
}
}
GET /services/:service_code/:environment_name/vpnusers
List VPN users.
Attributes | |
---|---|
id UUID |
The id of the remote access VPN user |
username string |
The VPN user's username |
Retrieve a VPN user
curl -X GET \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/vpnusers/5de76bf5-9f61-487a-a989-042b52882da4"
# Response example:
{
"data": {
"id": "5de76bf5-9f61-487a-a989-042b52882da4",
"username": "wilson"
}
}
GET /services/:service_code/:environment_name/vpnusers/:id
Retrieve a VPN user
Attributes | |
---|---|
id UUID |
The id of the remote access VPN user |
username string |
The VPN user's username |
Site-to-site VPN
A site-to-site VPN allows multiple sites to establish a secure connection over the public network. In our case, we are talking about a secure connection between your VPC and another network (e.g. VPC, offices).
List site-to-site VPNs
curl -X GET \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/sitetositevpns"
# Example:
{
"data": [
{
"id": "d49b2922-0581-4587-94df-6fe719327d0f",
"name": "stargate",
"state": "Connected",
"vpcId": "3fe7d82a-f4c4-4552-ac3b-787fdafed4e7",
"gateway":"19.19.19.19",
"cidr":"10.12.0.2/22",
"ipSecPsk": "WtOBS9GRux2XtJPtHY2TUvrv",
"ikeEncryptionAlgorithm": "3des",
"ikeHashAlgorithm": "sha1",
"ikeDhGroup":"modp1536",
"ikeLifetime":86400,
"espEncryptionAlgorithm":"3des",
"espHashAlgorithm":"sha1",
"espPerfectForwardSecrecy":"modp1536",
"espLifetime":3600,
"dpd": false,
"forceEncap": false
}
],
"metadata": {
"recordCount": 1
}
}
GET /services/:service_code/:environment_name/sitetositevpns
Retrieve a list of all site-to-site VPNs in an environment
Attributes | |
---|---|
id UUID |
The id of the site-to-site VPN |
name string |
The name of the site-to-site VPN |
state string |
The state of the site-to-site VPN. Can be Connected, Pending, Disconnected or Error. If disconnected, you can try to use the reset operation |
vpcId UUID |
The VPC for which the site-to-site VPN was created. |
gateway string |
The gateway of the network you want to connect to. NOTE: you cannot use a gateway that has already been used by a site-to-site VPN in your environment |
cidr string |
CIDR of the network you want to connect to. |
ipSecPsk string |
IPSec pre-shared key. Must contain at least 10 alphanumeric characters. |
ikeEncryptionAlgorithm string |
The Internet Key Exchange (IKE) policy for phase-1. The supported encryption algorithms are AES128, AES192, AES256, and 3DES. |
ikeHashAlgorithm string |
The IKE hash for phase-1. The supported hash algorithms are SHA1 and MD5. |
ikeDhGroup string |
A public-key cryptography protocol which allows two parties to establish a shared secret over an insecure communications channel. The supported options are None, Group-5 (1536-bit) and Group-2 (1024-bit). |
ikeLifetime integer |
The phase-1 lifetime of the security association in seconds. |
espEncryptionAlgorithm string |
Encapsulating Security Payload (ESP) algorithm within phase-2. The supported encryption algorithms are AES128, AES192, AES256, and 3DES. |
espHashAlgorithm string |
Encapsulating Security Payload (ESP) hash for phase-2. Supported hash algorithms are SHA1 and MD5. |
espPerfectForwardSecrecy string |
Perfect Forward Secrecy (or PFS) is the property that ensures that a session key derived from a set of long-term public and private keys will not be compromised. The supported options are None, Group-5 (1536-bit) and Group-2 (1024-bit). |
espLifetime integer |
The phase-2 lifetime of the security association in seconds |
dpd boolean |
A method to detect an unavailable Internet Key Exchange (IKE) peer. |
forceEncap boolean |
Force encapsulation for NAT Traversal |
Query Parameters | |
---|---|
vpc_id UUID |
Filter the list to only retrieve the site-to-site VPNs of a VPC |
Retrieve a site-to-site VPN
curl -X GET \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/sitetositevpns/d49b2922-0581-4587-94df-6fe719327d0f"
# Example:
{
"data": {
"id": "d49b2922-0581-4587-94df-6fe719327d0f",
"name": "stargate",
"state": "Connected",
"vpcId": "3fe7d82a-f4c4-4552-ac3b-787fdafed4e7",
"gateway":"19.19.19.19",
"cidr":"10.12.0.2/22",
"ipSecPsk": "WtOBS9GRux2XtJPtHY2TUvrv",
"ikeEncryptionAlgorithm": "3des",
"ikeHashAlgorithm": "sha1",
"ikeDhGroup":"modp1536",
"ikeLifetime":86400,
"espEncryptionAlgorithm":"3des",
"espHashAlgorithm":"sha1",
"espPerfectForwardSecrecy":"modp1536",
"espLifetime":3600,
"dpd": false,
"forceEncap": false
}
}
GET /services/:service_code/:environment_name/sitetositevpns/:id
Retrieve information about a site-to-site VPN.
Attributes | |
---|---|
id UUID |
The id of the site-to-site VPN |
name string |
The name of the site-to-site VPN |
state string |
The state of the site-to-site VPN. Can be Connected, Pending, Disconnected or Error. If disconnected, you can try to use the reset operation |
vpcId UUID |
The VPC for which the site-to-site VPN was created. |
gateway string |
The gateway of the network you want to connect to. NOTE: you cannot use a gateway that has already been used by a site-to-site VPN in your environment |
cidr string |
CIDR of the network you want to connect to. |
ipSecPsk string |
IPSec pre-shared key. Must contain at least 10 alphanumeric characters. |
ikeEncryptionAlgorithm string |
The Internet Key Exchange (IKE) policy for phase-1. The supported encryption algorithms are AES128, AES192, AES256, and 3DES. |
ikeHashAlgorithm string |
The IKE hash for phase-1. The supported hash algorithms are SHA1 and MD5. |
ikeDhGroup string |
A public-key cryptography protocol which allows two parties to establish a shared secret over an insecure communications channel. The supported options are None, Group-5 (1536-bit) and Group-2 (1024-bit). |
ikeLifetime integer |
The phase-1 lifetime of the security association in seconds. |
espEncryptionAlgorithm string |
Encapsulating Security Payload (ESP) algorithm within phase-2. The supported encryption algorithms are AES128, AES192, AES256, and 3DES. |
espHashAlgorithm string |
Encapsulating Security Payload (ESP) hash for phase-2. Supported hash algorithms are SHA1 and MD5. |
espPerfectForwardSecrecy string |
Perfect Forward Secrecy (or PFS) is the property that ensures that a session key derived from a set of long-term public and private keys will not be compromised. The supported options are None, Group-5 (1536-bit) and Group-2 (1024-bit). |
espLifetime integer |
The phase-2 lifetime of the security association in seconds |
dpd boolean |
A method to detect an unavailable Internet Key Exchange (IKE) peer. |
forceEncap boolean |
Force encapsulation for NAT Traversal |
Create a site-to-site VPN
# Here is the absolute minimum information required to create a new site-to-site VPN:
curl -X POST \
-H "Content-Type: application/json" \
-H "MC-Api-Key: your_api_key" \
-d "request_body" \
"https://api.cloud.ca/v1/services/compute-on/test_area/sitetositevpns"
# Request should look like this
{
"name": "stargate",
"vpcId": "3fe7d82a-f4c4-4552-ac3b-787fdafed4e7",
"gateway":"19.19.19.19",
"cidr":"10.12.0.2/22",
"ipSecPsk": "WtOBS9GRux2XtJPtHY2TUvrv",
"ikeEncryptionAlgorithm": "3des",
"ikeHashAlgorithm": "sha1",
"ikeDhGroup":"modp1536",
"ikeLifetime":86400,
"espEncryptionAlgorithm":"3des",
"espHashAlgorithm":"sha1",
"espPerfectForwardSecrecy":"modp1536",
"espLifetime":3600,
"dpd": false,
"forceEncap": false
}
POST /services/:service_code/:environment_name/sitetositevpns
Create a site-to-site VPN
Required | |
---|---|
name string |
The name of the site-to-site VPN. Must be unique in the environment. |
vpcId UUID |
The VPC for which the site-to-site VPN was created. |
gateway string |
The gateway of the network you want to connect to. NOTE: you cannot use a gateway that has already been used by a site-to-site VPN in your environment |
cidr string |
CIDR of the network you want to connect to. |
ipSecPsk string |
IPSec pre-shared key. Must contain at least 10 alphanumeric characters. |
ikeEncryptionAlgorithm string |
The Internet Key Exchange (IKE) policy for phase-1. The supported encryption algorithms are AES128, AES192, AES256, and 3DES. |
ikeHashAlgorithm string |
The IKE hash for phase-1. The supported hash algorithms are SHA1 and MD5. |
ikeLifetime integer |
The phase-1 lifetime of the security association in seconds. |
espEncryptionAlgorithm string |
Encapsulating Security Payload (ESP) algorithm within phase-2. The supported encryption algorithms are AES128, AES192, AES256, and 3DES. |
espHashAlgorithm string |
Encapsulating Security Payload (ESP) hash for phase-2. Supported hash algorithms are SHA1 and MD5. |
espLifetime integer |
The phase-2 lifetime of the security association in seconds |
Optional | |
---|---|
ikeDhGroup string |
A public-key cryptography protocol which allows two parties to establish a shared secret over an insecure communications channel. The supported options are Group-5 (1536-bit) and Group-2 (1024-bit). |
espPerfectForwardSecrecy string |
Perfect Forward Secrecy (or PFS) is the property that ensures that a session key derived from a set of long-term public and private keys will not be compromised. The supported options are Group-5 (1536-bit) and Group-2 (1024-bit). |
dpd boolean |
A method to detect an unavailable Internet Key Exchange (IKE) peer. Defaults to false |
forceEncap boolean |
Force encapsulation for NAT Traversal. Defaults to false |
Delete a site-to-site VPN
# Example:
curl -X DELETE \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/sitetositevpns/d49b2922-0581-4587-94df-6fe719327d0f"
DELETE /services/:service_code/:environment_name/sitetositevpns/:id
Delete an existing site-to-site VPN.
Reset the connection of a site-to-site VPN
curl -X POST \
-H "Content-Type: application/json" \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/sitetositevpns/ca86b14f-20db-463d-b58a-9d3fa5959af2?operation=reset"
POST /services/:service_code/:environment_name/sitetositevpns/:id?operation=reset
Reset a site-to-site VPN.
Storage
Volumes
A volume is a virtual disk that provides storage for your instances. An OS volume is created for every instance and it holds the OS of the instance. The size of this volume is typically just large enough to hold the operating system. A data volume is a volume that can be created and attached to an instance. It can also be detached and reattached to another instance.
List volumes
curl -X GET \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/volumes"
# Example:
{
"data": [
{
"id": "1bd672f4-b274-4371-a792-b0a6c6778cc7",
"name": "DOUGLAS-ADM",
"type": "os",
"creationDate": "2016-10-19T14:25:41-0400",
"instanceId": "b6145e8b-abd3-456c-832c-f3db86a6acfe",
"instanceName": "i-douglas-ADM",
"zoneId": "04afdbd1-e32d-4999-86d0-96703736dded",
"zoneName": "QC-1",
"state": "Ready",
"sizeInGb": 40
}
],
"metadata": {
"recordCount": 1
}
}
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
volumes, err := ccaResources.Volumes.List()
GET /services/:service_code/:environment_name/volumes
Retrieve a list of all volumes in an environment.
Attributes | |
---|---|
id UUID |
The id of the volume |
name string |
The name of the volume |
type string |
The type of the volume. os if it is a root volume of an instance, data otherwise |
creationDate string |
The creation date of the volume |
instanceId UUID |
The id of the instance to which the volume is attached |
instanceName string |
The name of the instance to which the volume is attached |
zoneId UUID |
The id of the zone where the volume was created |
zoneName string |
The name of the zone where the volume was created |
state string |
The state of the volume |
sizeInGb int |
The size in gigabytes of the volume |
Query Parameters | |
---|---|
type string |
Filter the list to only retrieve the volumes of a specific type (os or data ) |
instance_id UUID |
Filter the list to only retrieve the volumes of a specific instance |
Retrieve a volume
curl -X GET \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/volumes/1bd672f4-b274-4371-a792-b0a6c6778cc7"
# Example:
{
"data": {
"id": "1bd672f4-b274-4371-a792-b0a6c6778cc7",
"name": "deep_thought_42",
"type": "data",
"creationDate": "2016-10-19T14:25:41-0400",
"instanceId": "b6145e8b-abd3-456c-832c-f3db86a6acfe",
"instanceName": "i-douglas-ADM",
"zoneId": "04afdbd1-e32d-4999-86d0-96703736dded",
"zoneName": "QC-1",
"diskOfferingId": "21ba9c9b-a31e-496e-983f-e3041525bf95",
"diskOfferingName": "50GB - 50 IOPS Min.",
"state": "Ready",
"sizeInGb": 40
}
}
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
volumes, err := ccaResources.Volumes.Get("1bd672f4-b274-4371-a792-b0a6c6778cc7")
GET /services/:service_code/:environment_name/volumes/:id
Retrieve information about an volume.
Attributes | |
---|---|
id UUID |
The id of the volume |
name string |
The name of the volume |
type string |
The type of the volume. os if it is a root volume of an instance, data otherwise |
creationDate string |
The creation date of the volume |
instanceId UUID |
The id of the instance to which the volume is attached |
instanceName string |
The name of the instance to which the volume is attached |
zoneId UUID |
The id of the zone where the volume was created |
zoneName string |
The name of the zone where the volume was created |
state string |
The state of the volume |
sizeInGb int |
The size in gigabytes of the volume |
Create a volume
curl -X POST \
-H "Content-Type: application/json" \
-H "MC-Api-Key: your_api_key" \
-d "request_body" \
"https://api.cloud.ca/v1/services/compute-on/testing/volumes"
# Request should look like this
{
"name": "my_volume",
"diskOfferingId": "166f85eb-b4a2-4000-8e0c-24104d551f60",
"instanceId": "c043e651-8b3f-4941-b47f-5ecb77f3423b"
}
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
createdVolume, err := ccaResources.Volumes.Create(cloudca.Volume{
Name: "my_volume",
DiskOfferingId: "166f85eb-b4a2-4000-8e0c-24104d551f60",
InstanceId: "c043e651-8b3f-4941-b47f-5ecb77f3423b"
})
resource "cloudca_volume" "data_volume" {
service_code = "compute-on"
environment_name = "test_area"
name = "my_volume"
disk_offering = "50GB - 50 IOPS Min.",
instance_id = "c043e651-8b3f-4941-b47f-5ecb77f3423b"
}
POST /services/:service_code/:environment_name/volumes
Create a volume in an environment. It will attached to the specified instance.
Required | |
---|---|
name string |
The name of the new volume |
diskOfferingId UUID |
The disk offering to use for the volume |
instanceId UUID |
The id of the instance to which the created volume will be attached |
Delete a volume
# Example:
curl -X DELETE \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/volumes/e922e5fc-8fee-4688-ad93-c9ef5d7eb685"
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
err := ccaResources.Volumes.Delete("e922e5fc-8fee-4688-ad93-c9ef5d7eb685")
DELETE /services/:service_code/:environment_name/vpcs/:id
Destroy an existing data volume. A volume can only be deleted if it's not attached to an instance.
Attach a volume to an instance
curl -X POST \
-H "Content-Type: application/json" \
-H "MC-Api-Key: your_api_key" \
-d "request_body" \
"https://api.cloud.ca/v1/services/compute-on/testing/volumes/e922e5fc-8fee-4688-ad93-c9ef5d7eb685?operation=attachToInstance"
# Request should look like this
{
"instanceId": "c043e651-8b3f-4941-b47f-5ecb77f3423b"
}
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
err := ccaResources.Volumes.AttachToInstance(cloudca.Volume{
Id: "e922e5fc-8fee-4688-ad93-c9ef5d7eb685"
InstanceId: "c043e651-8b3f-4941-b47f-5ecb77f3423b"
})
POST /services/:service_code/:environment_name/volumes/:id?operation=attachToInstance
Attach an existing data volume to an instance.
Required | |
---|---|
instanceId UUID |
The id of the instance to which the created volume should be attached |
Detach a volume from an instance
curl -X POST \
-H "Content-Type: application/json" \
-H "MC-Api-Key: your_api_key" \
-d "request_body" \
"https://api.cloud.ca/v1/services/compute-on/testing/volumes/e922e5fc-8fee-4688-ad93-c9ef5d7eb685?operation=detachFromInstance"
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
err := ccaResources.Volumes.DetachFromInstance(cloudca.Volume{
Id: "e922e5fc-8fee-4688-ad93-c9ef5d7eb685"
})
POST /services/:service_code/:environment_name/volumes/:id?operation=detachFromInstance
Detach a data volume from an instance.
Snapshots
A volume snapshot is a full image of a volume. They are often considered as backups, but in reality this is not 100% true since you have only the data written on disk. Volume Snapshots are typically used to derive new templates out of a running instance.
List snapshots
curl -X GET \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/snapshots"
# Example:
{
"data": [
{
"id": "33a27b8d-5a27-42a5-aec4-37606e372bda",
"name": "i-douglas-ADM_foo_20161116211009",
"state": "BackedUp",
"intervalType": "MANUAL",
"volumeId": "c779ca42-6966-41af-a7dc-23db4e41d4ee",
"volume": "ROOT-35545",
"volumeType": "ROOT-35545"
}
],
"metadata": {
"recordCount": 1
}
}
GET /services/:service_code/:environment_name/snapshots
Retrieve a list of all snapshots in an environment
Attributes | |
---|---|
id UUID |
The id of the snapshot |
name string |
The name of the snapshot |
state string |
The state of the snapshot |
intervalType string |
The interval type. MANUAL means that you created the snapshot manually (i.e. it's not a recurring snapshot) |
volumeId UUID |
The id of the volume that was snapshotted |
volume string |
The name of the volume that was snapshotted |
volumeType string |
The type of the volume that was snapshotted |
Query Parameters | |
---|---|
volume_id UUID |
Filter the list to only retrieve the snapshots of a specific volume |
Retrieve a snapshot
curl -X GET \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/snapshots/1bd672f4-b274-4371-a792-b0a6c6778cc7"
# Example:
{
"data": {
"id": "33a27b8d-5a27-42a5-aec4-37606e372bda",
"name": "i-douglas-ADM_foo_20161116211009",
"state": "BackedUp",
"intervalType": "MANUAL",
"volumeId": "c779ca42-6966-41af-a7dc-23db4e41d4ee",
"volume": "ROOT-35545",
"volumeType": "ROOT-35545"
}
}
GET /services/:service_code/:environment_name/snapshots/:id
Retrieve information about a snapshot.
Attributes | |
---|---|
id UUID |
The id of the snapshot |
name string |
The name of the snapshot |
state string |
The state of the snapshot |
intervalType string |
The interval type. MANUAL means that you created the snapshot manually (i.e. it's not a recurring snapshot) |
volumeId UUID |
The id of the volume that was snapshotted |
volume string |
The name of the volume that was snapshotted |
volumeType string |
The type of the volume that was snapshotted |
Offerings
Offerings are what determine the characteristics of provisioned resources. There are 4 types of offerings : compute, disk, VPC and network offerings.
VPC offerings
VPC offerings determine which services are available to provisioned VPCs.
List VPC offerings
curl -X GET \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/vpcofferings"
# The above command returns JSON structured like this:
{
"data": [
{
"id": "41ac6ba0-6172-4bc4-bff6-b0831b91677c",
"name": "Default VPC offering",
"services": [
"PortForwarding",
"Vpn",
"SourceNat",
"Dhcp",
"NetworkACL",
"Dns",
"Lb",
"UserData",
"StaticNat"
],
"state": "Enabled"
}
],
"metadata": {
"recordCount": 1
}
}
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
vpcOfferings, _ := ccaResources.VpcOfferings.List()
GET /services/:service_code/:environment_name/vpcofferings
Retrieve a list of available VPC offerings.
Attributes | |
---|---|
id UUID |
The id of the VPC offering |
name string |
The name of the VPC offering |
services Array[string] |
The services provided by the offering |
state string |
The state of the offering |
Retrieve a VPC offering
curl -X GET \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/vpcofferings/41ac6ba0-6172-4bc4-bff6-b0831b91677c"
# The above command returns JSON structured like this:
{
"data": {
"id": "41ac6ba0-6172-4bc4-bff6-b0831b91677c",
"name": "Default VPC offering",
"services": [
"PortForwarding",
"Lb",
"NetworkACL",
"SourceNat",
"Dns",
"StaticNat",
"Vpn",
"Dhcp",
"UserData"
],
"state": "Enabled"
}
}
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
vpcOfferings, _ := ccaResources.VpcOfferings.Get("41ac6ba0-6172-4bc4-bff6-b0831b91677c")
GET /services/:service_code/:environment_name/vpcofferings/:id
Retrieve a VPC offering.
Attributes | |
---|---|
id UUID |
The id of the VPC offering |
name string |
The name of the VPC offering |
services Array[string] |
The services provided by the offering |
state string |
The state of the offering |
Network offerings
Network offerings determine which services are available to each provisioned network.
List network offerings
curl -X GET \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/networkofferings"
# The above command returns JSON structured like this:
{
"data": [
{
"id": "89724d35-b69c-418c-be81-7d83fcfc9da9",
"name": "Load Balanced Tier",
"services": [
"PortForwarding",
"Vpn",
"SourceNat",
"Dhcp",
"NetworkACL",
"Dns",
"Lb",
"UserData",
"StaticNat"
],
"state": "ENABLED"
},
{
"id": "087502ea-cb42-421b-9bd9-9cf9ae5d1b89",
"name": "Standard Tier",
"services": [
"PortForwarding",
"Vpn",
"SourceNat",
"Dhcp",
"NetworkACL",
"Dns",
"UserData",
"StaticNat"
],
"state": "ENABLED"
}
],
"metadata": {
"recordCount": 2
}
}
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
networkOfferings, _ := ccaResources.NetworkOfferings.List()
GET /services/:service_code/:environment_name/networkofferings
Retrieve a list of available network offerings.
Attributes | |
---|---|
id UUID |
The id of the network offering |
name string |
The name of the network offering |
services Array[string] |
The services provided by the offering |
state string |
The state of the offering |
Retrieve a network offering
curl -X GET \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/networkofferings/89724d35-b69c-418c-be81-7d83fcfc9da9"
# The above command returns JSON structured like this:
{
"data": {
"id": "89724d35-b69c-418c-be81-7d83fcfc9da9",
"name": "Load Balanced Tier",
"services": [
"PortForwarding",
"Lb",
"NetworkACL",
"SourceNat",
"Dns",
"StaticNat",
"Vpn",
"Dhcp",
"UserData"
],
"state": "ENABLED"
}
}
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
networkOfferings, _ := ccaResources.NetworkOfferings.Get("89724d35-b69c-418c-be81-7d83fcfc9da9")
GET /services/:service_code/:environment_name/networkofferings/:id
Retrieve a network offering.
Attributes | |
---|---|
id UUID |
The id of the network offering |
name string |
The name of the network offering |
services Array[string] |
The services provided by the offering |
state string |
The state of the offering |
Compute offerings
Compute offerings determine the number of vCPUs and the size of the memory allocated to new instances.
List compute offerings
curl -X GET \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/computeofferings"
# The above command returns JSON structured like this:
{
"data": [
{
"id": "40a2e5f7-22e6-4d1e-b03b-4a4b7c9cbc6f",
"name": "Custom CPU and memory",
"custom" : true,
"availableCpuCountValues": [1, 2, 4, 8],
"availableMemoryInMBValues": [1024, 2048, 4096, 8192],
"maxMemoryInMBToCpuRatio": 2048
},
{
"id": "1fb0caba-8ffb-4e77-8dcb-401170e15e0a",
"name": "1vCPU.1GB",
"cpuCount": 1,
"memoryInMB": 1024,
"custom" : false
}
],
"metadata": {
"recordCount": 2
}
}
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
computeOfferings, _ := ccaResources.ComputeOfferings.List()
GET /services/:service_code/:environment_name/computeofferings
Retrieve a list of available compute offerings.
Attributes | |
---|---|
id UUID |
The id of the compute offering |
name string |
The name of the compute offering |
memoryInMB int |
The amount of provisioned memory in MB |
cpuCount int |
The number of vCPUs available to the created instance |
custom boolean |
If true, the cpuCount and memoryInMB fields will be missing from the response and will be required on instance create |
availableCpuCountValues Array[integer] |
The list of valid cpu counts when used in the create instance operation. Only present for custom offerings |
availableMemoryInMBValues Array[integer] |
The list of valid amounts of memory (in MB) that can be used in the create instance operation. Only present for custom offerings |
maxMemoryInMBToCpuRatio integer |
The maximum ratio of memory (in MB) to number of CPU of an instance created with this offering. Only present for custom offerings. |
Retrieve a compute offering
curl -X GET \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/computeofferings/40a2e5f7-22e6-4d1e-b03b-4a4b7c9cbc6f"
# The above command returns JSON structured like this:
{
"data": {
"id": "40a2e5f7-22e6-4d1e-b03b-4a4b7c9cbc6f",
"name": "1vCPU.512MB",
"cpuCount": 1,
"memoryInMB": 512,
"custom": false
}
}
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
computeOfferings, _ := ccaResources.ComputeOfferings.Get("40a2e5f7-22e6-4d1e-b03b-4a4b7c9cbc6f")
GET /services/:service_code/:environment_name/computeofferings/:id
Retrieve a compute offering.
Attributes | |
---|---|
id UUID |
The id of the compute offering |
name string |
The name of the compute offering |
memoryInMB int |
The amount of provisioned memory in MB |
cpuCount int |
The number of vCPUs available to the created instance |
custom boolean |
If true, the cpuCount and memoryInMB fields will be missing from the response and will be required on instance create |
availableCpuCountValues Array[integer] |
The list of valid cpu counts when used in the create instance operation. Only present for custom offerings |
availableMemoryInMBValues Array[integer] |
The list of valid amounts of memory (in MB) that can be used in the create instance operation. Only present for custom offerings |
maxMemoryInMBToCpuRatio integer |
The maximum ratio of memory (in MB) to number of CPU of an instance created with this offering. Only present for custom offerings. |
Disk offerings
Disk offerings determine the size and the performance (IOPS) of data volumes.
List disk offerings
curl -X GET \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/diskofferings"
# The above command returns JSON structured like this:
{
"data": [
{
"customIops": false,
"customSize": false,
"gbSize": 20,
"id": "18bbab50-8d85-4b34-8361-0dc223ffd7e5",
"name": "20GB - 20 IOPS Min."
},
{
"customIops": false,
"customSize": false,
"gbSize": 50,
"id": "0432acc2-9226-4945-bf2e-9c8157be31d1",
"name": "50GB - 50 IOPS Min."
}
],
"metadata": {
"recordCount": 2
}
}
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
diskOfferings, _ := ccaResources.DiskOfferings.List()
GET /services/:service_code/:environment_name/diskofferings
Retrieve a list of available disk offerings.
Attributes | |
---|---|
id UUID |
The id of the disk offering |
name string |
The name of the disk offering |
gbSize int |
The size of the data volume in GB |
customSize boolean |
If the offering supports custom size |
customIops boolean |
If the offering supports custom IOPS |
Retrieve a disk offering
curl -X GET \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/diskofferings/18bbab50-8d85-4b34-8361-0dc223ffd7e5"
# The above command returns JSON structured like this:
{
"data": {
"customIops": false,
"customSize": false,
"gbSize": 20,
"id": "18bbab50-8d85-4b34-8361-0dc223ffd7e5",
"name": "20GB - 20 IOPS Min."
}
}
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
diskOfferings, _ := ccaResources.DiskOfferings.Get("18bbab50-8d85-4b34-8361-0dc223ffd7e5")
GET /services/:service_code/:environment_name/diskofferings/:id
Retrieve a disk offering.
Attributes | |
---|---|
id UUID |
The id of the disk offering |
name string |
The name of the disk offering |
gbSize int |
The size of the data volume in GB |
customSize boolean |
If the offering supports custom size |
customIops boolean |
If the offering supports custom IOPS |
Zones
Each zone consists of physically isolated hosts, storage, and networking infrastructure. Like deploying workloads across regions, deploying workloads over multiple zones can help ensure high availability of applications.
List zones
curl -X GET \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/zones"
# The above command returns JSON structured like this:
{
"data": [
{
"id": "ea901007-056b-4c50-bb3a-2dd635fce2ab",
"name": "ON-1"
}
],
"metadata": {
"recordCount": 1
}
}
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
zones, _ := ccaResources.Zones.List()
GET /services/:service_code/:environment_name/zones
Retrieve a list of available zones.
Attributes | |
---|---|
id UUID |
The id of the zone |
name string |
The name of the zone |
Retrieve a zone
curl -X GET \
-H "MC-Api-Key: your_api_key" \
"https://api.cloud.ca/v1/services/compute-on/test_area/zones/ea901007-056b-4c50-bb3a-2dd635fce2ab"
# The above command returns JSON structured like this:
{
"data": {
"id": "ea901007-056b-4c50-bb3a-2dd635fce2ab",
"name": "ON-1"
}
}
resources, _ := ccaClient.GetResources("compute-on", "test_area")
ccaResources := resources.(cloudca.Resources)
zones, _ := ccaResources.Zones.Get("ea901007-056b-4c50-bb3a-2dd635fce2ab")
GET /services/:service_code/:environment_name/zones/:id
Retrieve a zone
Attributes | |
---|---|
id UUID |
The id of the zone |
name string |
The name of the zone |