ExOvh v0.4.0 ExOvh.V1.Cloud View Source
Helper functions for building requests directed at the cloudstorage related parts of the /cloud
part of the OVH API.
See ExOvh.V1.Cloud
for generic cloud requests.
Functions Summary
Function | Description | OVH API call |
---|---|---|
list_services/0 | List available services or list available cloud projects. A returned project id in OVH terms is similar to a tenant id in swift terms | GET /cloud/project |
get_users/1 | Get all users | GET /cloud/project/{serviceName}/user |
create_user/2 | Create user | POST /ctsloud/project/{serviceName}/user |
get_user_details/2 | Get user details. Returns the user_id and username and other details. | GET /cloud/project/{serviceName}/user/{userId} |
delete_user/2 | Delete user | DELETE /cloud/project/{serviceName}/user/{userId} |
download_openrc_script/3 | Get RC file of OpenStack | GET /cloud/project/{serviceName}/user/{userId}/openrc |
regenerate_credentials/2 | Regenerate user credentials including password | POST /cloud/project/{serviceName}/user/{userId}/regeneratePassword |
swift_identity/3 | Gets a json object similar to that returned by Keystone Identity. Includes the ‘X-Auth-Token’ | POST /cloud/project/{serviceName}/user/{userId}/token |
create_project/2 | Start a new cloud project in the OVH cloud. Corresponds to creating a new Swift stack with a new tenant_id. | POST /cloud/createProject |
get_prices/2 | Get Prices for OVH cloud services. | GET /cloud/price |
project_info/1 | Get information about a project with the project_id (tenant_id) | GET /cloud/project/{serviceName} |
modify_project/2 | Modify a project properties. Change the project description. | PUT /cloud/project/{serviceName} |
project_administrative_info/1 | Get administration information about the project. | GET /cloud/project/{serviceName}/serviceInfos |
project_quotas/1 | Get project quotas. | GET /cloud/project/{serviceName}/quota |
project_regions/1 | Get project regions. | GET /cloud/project/{serviceName}/region |
project_region_info/2 | Get details about a project region. | GET /cloud/project/{serviceName}/region/{regionName} |
project_consumption/3 | Get details about a project consumption for a given date_from and date_to . | GET /cloud/project/{serviceName}/consumption |
project_bills/3 | Get details about a project billing for a given date_from and date_to .. | GET /cloud/project/{serviceName}/bill |
create_project_alert/4 | Add a new project alert | POST /cloud/project/{serviceName}/alerting |
get_project_alert_info/2 | Get detailed information about a project alert. | GET /cloud/project/{serviceName}/alerting/{id} |
modify_project_alert/5 | Modify an existing project alert. | PUT /cloud/project/{serviceName}/alerting/{id} |
delete_project_alert/2 | Delete an existing project alert. | DELETE /cloud/project/{serviceName}/alerting/{id} |
terminate_service/2 | Terminate a cloud project. | POST /cloud/project/{serviceName}/terminate |
get_containers/1 | Get containers for a given swift tenant id (project id or ovh service name) | GET /cloud/project/{serviceName}/storage |
create_container/3 | Create a container for a given tenant_id (ovh service_name), a container and a region. | POST /cloud/project/{serviceName}/storage |
get_access/1 | Get access details for the Swift API for a given swift tenant_id (ovh service_name) | GET /cloud/project/{serviceName}/storage/access |
container_info/2 | Gets details about a container such as objects, size, region, public or not, static_url, name, … | GET /cloud/project/{serviceName}/storage/{containerId} |
delete_container/2 | Deletes a given container. | DELETE /cloud/project/{serviceName}/storage/{containerId} |
modify_container_cors/3 | Modify the CORS settings for a container. See swift docs | POST /cloud/project/{serviceName}/storage/{containerId}/cors Add CORS support on your container |
deploy_container_as_static_website/2 | Deploy the container files as a static web site. | POST /cloud/project/{serviceName}/storage/{containerId}/static |
Notes
service_name
orserviceName
corresponds to the Openstacktenant_id
Example
ExOvh.V1.Cloud.get_containers(service_name) |> ExOvh.request!()
Link to this section Summary
Functions
Gets the details for a given container
Create container
Create a new Cloud Project
Create a new project alert
Create user
Deletes a given container
Delete a project alert
Delete a specific user
Deploy a container as a static website
Get RC file of OpenStack. This file is a bash script with much of the openstack credentials. Makes it easier for setting up a swift client from the terminal
Gets the x_auth_token and the swift endpoints for a given tenant_id (ovh service_name). A different endpoint is returned depending on the region. Examples of regions include “BHS1”, “SBG1”, “GRA1”. With these details, requests can be made through the Swift api
Get storage containers
Get services prices for the OVH public cloud
Get detailed information about a project alert
Get a list of project alert ids. These project alert ids can then be looked up in a separate request for more information
Get user details. Returns the user_id and username and other details
Get all users
List available services
Modify CORS settings for a container
Modify the project description for a project
Modify an existing project alert
Get administration information about the project
Get project details about a project bills
Get project details about a project consumption
Get details for a given project
Get project quotas
Get project details about a project region
Get project regions
Regenerate user password and other credentials
Get the token for the user (very similar to keystone identity)
Terminate a cloud project
Link to this section Functions
container_info(String.t(), String.t()) :: HTTPipe.Conn.t()
Gets the details for a given container.
Returns information such as a list of objects in the container, size of the container, whether the container is public or not, the region of the container, the name of the container, the number of stored objects for the container and the static url for the container.
Api call
GET /cloud/project/{serviceName}/storage/{containerId}
Arguments
service_name
: service name for the ovh cloud servicecontainer_id
: container_id for a given container. Note: this is not the same as the container_name.
Example
ExOvh.V1.Cloud.container_info(service_name, container_id) |> ExOvh.request!()
create_container(String.t(), String.t(), String.t()) :: HTTPipe.Conn.t()
Create container
Api call
POST /cloud/project/{serviceName}/storage
Arguments
service_name
: service name for the ovh cloud servicecontainer_name
: name for the new containerregion
: region for the new container, defaults to “SBG1”. See regions by running: Currently can choose from “GRA1”, “BHS1”, “SBG1”.
Example
ExOvh.V1.Cloud.create_container(service_name, "test_container") |> ExOvh.request!()
create_project(String.t(), String.t()) :: HTTPipe.Conn.t()
Create a new Cloud Project.
Api Call
POST /cloud/createProject
Arguments
description
: project descriptionvoucher
: ovh voucher code
Example
ExOvh.V1.Cloud.create_project(description, voucher) |> ExOvh.request!()
create_project_alert(String.t(), String.t(), integer(), String.t()) :: HTTPipe.Conn.t() | no_return()
Create a new project alert.
Notes: It seems only one alert is allowed per project. To create a new one alter the old one or delete the old one and add a new one. Once the monthly threshold in the given currency is exceeded, then the alert email is sent.
Api Call
POST /cloud/project/{serviceName}/alerting
Arguments
service_name
: corresponds to project_id or tenant_id. Seelist_services/0
delay
: The delay between each alert in seconds. This has to be selected from an enumerable (a list). 3600 is the lowest. defaults to 3600. (1 hour)email
: The email to send the alert to.monthlyThreshold
: The maximum monetary (cash) usage allowed in one month. This is an integer value. Ask OVH about how the currency is chosen.
Example
ExOvh.V1.Cloud.create_project_alert(service_name, "email_address@email.email", 5) |> ExOvh.request!()
create_user(String.t(), String.t()) :: HTTPipe.Conn.t()
Create user
Api Call
POST /cloud/project/{serviceName}/user
Arguments
service_name
: corresponds to project_id or tenant_id. Seelist_services/0
description
: description ascribed to the new user.
Example
ExOvh.V1.Cloud.create_user(service_name, "ex_ovh") |> ExOvh.request!()
delete_container(String.t(), String.t()) :: HTTPipe.Conn.t()
Deletes a given container.
Note: container_d is not the same as container_name.
Api call
DELETE /cloud/project/{serviceName}/storage/{containerId}
Arguments
service_name
: service name for the ovh cloud servicecontainer_id
: container_id for a given container. Note: this is not the same as the container_name.
Example
ExOvh.V1.Cloud.delete_container(service_name, container_id) |> ExOvh.request!()
delete_project_alert(String.t(), String.t()) :: HTTPipe.Conn.t()
Delete a project alert.
Api Call
DELETE /cloud/project/{serviceName}/alerting/{id}
Arguments
service_name
: corresponds to project_id or tenant_id. Seelist_services/0
alert_id
: The id of the project alert. Seeget_project_alerts/1
Example
ExOvh.V1.Cloud.get_project_alert_info(service_name, alert_id) |> ExOvh.request!()
delete_user(String.t(), String.t()) :: HTTPipe.Conn.t()
Delete a specific user.
Api Call
DELETE /cloud/project/{serviceName}/user/{userId}
Arguments
service_name
: corresponds to project_id or tenant_id. Seelist_services/0
user_id
: The user_id. Seeget_users/1
Example
ExOvh.V1.Cloud.delete_user(service_name, user_id) |> ExOvh.request!()
deploy_container_as_static_website(String.t(), String.t()) :: HTTPipe.Conn.t()
Deploy a container as a static website.
Modifies the ACL settings for a container on the “X-Container-Read” header and also other container metadata. See swift auth docs, swift acl middleware and swift account middleware for more information.
Api call
POST /cloud/project/{serviceName}/storage/{containerId}/static
Arguments
service_name
: service name for the ovh cloud servicecontainer_id
: container_id for a given container. Note: this is not the same as the container_name.
Example
ExOvh.V1.Cloud.modify_container_cors(service_name, container_id, "http://localhost:4001/") |> ExOvh.request!()
Notes
To get a full overview of the container details with all metadata, the Swift client should be used. To see the changes, try running the following
command for the container_name
associated with this container_id
. In fact, the OVH functions are not really required, most changes can be made directly
using queries sent via the Swift.Cloudstorage
client.
account = ExOvh.Swift.Cloudstorage.account()
container = "test_container"
Openstex.Swift.V1.container_info(container, account) |> ExOvh.Swift.Cloudstorage.request!() |> Map.get(:headers)
download_openrc_script(String.t(), String.t(), String.t()) :: HTTPipe.Conn.t()
Get RC file of OpenStack. This file is a bash script with much of the openstack credentials. Makes it easier for setting up a swift client from the terminal.
Api Call
GET /cloud/project/{serviceName}/user/{userId}/openrc
Arguments
service_name
: corresponds to project_id or tenant_id. Seelist_services/0
user_id
: user_id for user accessing the service.region
: region for which the rc file will be created. Defaults to “SBG1” if left absent.
Example
ExOvh.V1.Cloud.download_openrc_script(service_name, user_id, "SBG1") |> ExOvh.request!()
get_access(String.t()) :: HTTPipe.Conn.t()
Gets the x_auth_token and the swift endpoints for a given tenant_id (ovh service_name). A different endpoint is returned depending on the region. Examples of regions include “BHS1”, “SBG1”, “GRA1”. With these details, requests can be made through the Swift api.
Api call
GET /cloud/project/{serviceName}/storage/access
Arguments
service_name
: service name for the ovh cloud service
Example
ExOvh.V1.Cloud.get_access(service_name) |> ExOvh.request!()
get_containers(String.t()) :: HTTPipe.Conn.t()
Get storage containers
Api call
GET /cloud/project/{serviceName}/storage
Arguments
service_name
: service name for the ovh cloud service
Example
ExOvh.V1.Cloud.get_containers(service_name) |> ExOvh.request!()
get_prices(String.t() | nil, String.t() | nil) :: HTTPipe.Conn.t()
Get services prices for the OVH public cloud.
Api Call
GET /cloud/price
Arguments
region
: prices for a particular region (optional)flavor_id
: ovh voucher code (optional)
Example
ExOvh.V1.Cloud.get_prices() |> ExOvh.request!()
get_project_alert_info(String.t(), String.t()) :: HTTPipe.Conn.t()
Get detailed information about a project alert.
Api Call
GET /cloud/project/{serviceName}/alerting/{id}
Arguments
service_name
: corresponds to project_id or tenant_id. Seelist_services/0
alert_id
: The id of the project alert. Seeget_project_alerts/1
Example
ExOvh.V1.Cloud.get_project_alert_info(service_name, alert_id) |> ExOvh.request!()
get_project_alerts(String.t()) :: HTTPipe.Conn.t()
Get a list of project alert ids. These project alert ids can then be looked up in a separate request for more information.
Api Call
GET /cloud/project/{serviceName}/alerting
Arguments
service_name
: corresponds to project_id or tenant_id. Seelist_services/0
Example
ExOvh.V1.Cloud.get_project_alerts(service_name) |> ExOvh.request!()
get_user_details(String.t(), String.t()) :: HTTPipe.Conn.t()
Get user details. Returns the user_id and username and other details.
Api Call
GET /cloud/project/{serviceName}/user/{userId}
Arguments
service_name
: corresponds to project_id or tenant_id. Seelist_services/0
user_id
: corresponds to user_id. Seeget_users/1
Example
ExOvh.V1.Cloud.get_user_details(service_name, user_id) |> ExOvh.request!()
Get all users
Api Call
GET /cloud/project/{serviceName}/user
Arguments
service_name
: corresponds to project_id or tenant_id. Seelist_services/0
Example
ExOvh.V1.Cloud.get_users(service_name) |> ExOvh.request!()
List available services
Api Call
GET /cloud/project
Example
ExOvh.V1.Cloud.list_services() |> ExOvh.request!()
modify_container_cors(String.t(), String.t(), String.t()) :: HTTPipe.Conn.t()
Modify CORS settings for a container.
Modifies the container metadata such that cross origin requests can be permitted. See CORS section of swift docs for more info. Ans see here for more on CORS in general
Metadata | Use |
---|---|
X-Container-Meta-Access-Control-Allow-Origin | Origins to be allowed to make Cross Origin Requests, space separated. |
Note: container_d is not the same as container_name.
Api call
DELETE /cloud/project/{serviceName}/storage/{containerId}
Arguments
service_name
: service name for the ovh cloud servicecontainer_id
: container_id for a given container. Note: this is not the same as the container_name.origin
: an origin that may make cross origin requests to the container. Defaults to{}
(none) if left absent.
Example
ExOvh.V1.Cloud.modify_container_cors(service_name, container_id, "http://localhost:4001/") |> ExOvh.request!()
Notes
To get a full overview of the container details with all metadata, the Swift client should be used. To see the changes, try running the following
command for the container_name
associated with this container_id
. In fact, the OVH functions are not really required, most changes can be made directly
using queries sent via the Swift.Cloudstorage
client.
account = ExOvh.Swift.Cloudstorage.account()
container = "test_container"
Openstex.Swift.V1.container_info(container, account) |> ExOvh.Swift.Cloudstorage.request!() |> Map.get(:headers) |> Map.get("X-Container-Meta-Access-Control-Allow-Origin")
modify_project(String.t(), String.t()) :: HTTPipe.Conn.t()
Modify the project description for a project.
Api Call
PUT /cloud/project/{serviceName}
Arguments
service_name
: corresponds to project_id or tenant_id. Seelist_services/0
Example
ExOvh.V1.Cloud.modify_project(service_name, new_description) |> ExOvh.request!()
modify_project_alert(String.t(), String.t(), String.t(), integer(), String.t()) :: HTTPipe.Conn.t()
Modify an existing project alert.
Api Call
PUT /cloud/project/{serviceName}/alerting/{id}
Arguments
service_name
: corresponds to project_id or tenant_id. Seelist_services/0
alert_id
: The alert to be modified.delay
: The delay between each alert in seconds. This has to be selected from an enumerable (a list). 3600 is the lowest. defaults to 3600. (1 hour)email
: The email to send the alert to.monthlyThreshold
: The maximum monetary (cash) usage allowed in one month. This is an integer value. Ask OVH about how the currency is chosen.
Example
ExOvh.V1.Cloud.modify_project_alert(service_name, alert_id, "email_address@email.email", 5) |> ExOvh.request!()
project_administrative_info(String.t()) :: HTTPipe.Conn.t()
Get administration information about the project
Api Call
GET /cloud/project/{serviceName}/serviceInfos
Arguments
service_name
: corresponds to project_id or tenant_id. Seelist_services/0
Example
ExOvh.V1.Cloud.project_administrative_info(service_name) |> ExOvh.request!()
project_bills(String.t(), String.t(), String.t()) :: HTTPipe.Conn.t()
Get project details about a project bills.
Api Call
GET /cloud/project/{serviceName}/bill
Arguments
service_name
: corresponds to project_id or tenant_id. Seelist_services/0
date_from
: starting date inISO 8601
format. defaults to 4 weeks/28 days ago (UTC time) if left absent.date_to
: end date inISO 8601
format. defaults to now (UTC time) if left absent.
Example
ExOvh.V1.Cloud.project_bills(service_name) |> ExOvh.request!()
project_consumption(String.t(), String.t(), String.t()) :: HTTPipe.Conn.t()
Get project details about a project consumption.
Note: Will only allow for up to one month of data to be returned.
Api Call
GET /cloud/project/{serviceName}/consumption
Arguments
service_name
: corresponds to project_id or tenant_id. Seelist_services/0
date_from
: starting date inISO 8601
format. defaults to 4 weeks/28 days ago (UTC time) if left absent.date_to
: end date inISO 8601
format. defaults to now (UTC time) if left absent.
Example
ExOvh.V1.Cloud.project_consumption(service_name) |> ExOvh.request!()
project_info(String.t()) :: HTTPipe.Conn.t()
Get details for a given project.
Api Call
GET /cloud/project/{serviceName}
Arguments
service_name
: corresponds to project_id or tenant_id. Seelist_services/0
Example
ExOvh.V1.Cloud.project_info(service_name) |> ExOvh.request!()
project_quotas(String.t()) :: HTTPipe.Conn.t()
Get project quotas.
Api Call
GET /cloud/project/{serviceName}/quota
Arguments
service_name
: corresponds to project_id or tenant_id. Seelist_services/0
Example
ExOvh.V1.Cloud.project_quotas(service_name) |> ExOvh.request!()
project_region_info(String.t(), String.t()) :: HTTPipe.Conn.t()
Get project details about a project region.
Api Call
GET /cloud/project/{serviceName}/region/{regionName}
Arguments
service_name
: corresponds to project_id or tenant_id. Seelist_services/0
Example
ExOvh.V1.Cloud.project_region_info(service_name) |> ExOvh.request!()
project_regions(String.t()) :: HTTPipe.Conn.t()
Get project regions.
Api Call
GET /cloud/project/{serviceName}/region
Arguments
service_name
: corresponds to project_id or tenant_id. Seelist_services/0
Example
ExOvh.V1.Cloud.project_regions(service_name) |> ExOvh.request!()
regenerate_credentials(String.t(), String.t()) :: HTTPipe.Conn.t()
Regenerate user password and other credentials.
Api Call
POST /cloud/project/{serviceName}/user/{userId}/regeneratePassword
Arguments
service_name
: corresponds to project_id or tenant_id. Seelist_services/0
user_id
: user_id for accessing the project. Seeget_users/1
Example
ExOvh.V1.Cloud.regenerate_credentials(service_name, user_id) |> ExOvh.request!()
swift_identity(String.t(), String.t(), String.t()) :: HTTPipe.Conn.t()
Get the token for the user (very similar to keystone identity)
Api Call
POST /cloud/project/{serviceName}/user/{userId}/token
Arguments
service_name
: corresponds to project_id or tenant_id. Seelist_services/0
user_id
: The swift user_id to login with. Seeget_users/1
.password
: The swift password to login with. Seeregenerate_credentials/2
Example
ExOvh.V1.Cloud.swift_identity(service_name, user_id) |> ExOvh.request!()
terminate_project(String.t()) :: HTTPipe.Conn.t()
Terminate a cloud project.
Api Call
POST /cloud/project/{serviceName}/terminate
Arguments
service_name
: corresponds to project_id or tenant_id. Seelist_services/0
Example
ExOvh.V1.Cloud.HTTPipe.Conn.terminate_project(service_name) |> ExOvh.request!()