ExOvh v0.3.4 ExOvh.V1.Cloud

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 projectid (tenantid) 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 tenantid (ovh servicename), a container and a region. POST /cloud/project/{serviceName}/storage
get_access/1 Get access details for the Swift API for a given swift tenantid (ovh servicename) 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 or serviceName corresponds to the Openstack tenant_id

Example

ExOvh.V1.Cloud.get_containers(service_name) |> ExOvh.request!()

Summary

Functions

Gets the details for a given container

Create a new Cloud Project

Delete a specific user

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 xauthtoken and the swift endpoints for a given tenantid (ovh servicename). 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 the project description for a project

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

Functions

container_info(service_name, container_id)
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 service
  • container_id: containerid for a given container. Note: this is not the same as the containername.

Example

ExOvh.V1.Cloud.container_info(service_name, container_id) |> ExOvh.request!()
create_container(service_name, container_name, region \\ "SBG1")
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 service
  • container_name: name for the new container
  • region: 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(description, voucher)
create_project(String.t, String.t) :: HTTPipe.Conn.t

Create a new Cloud Project.

Api Call

POST /cloud/createProject

Arguments

  • description: project description
  • voucher: ovh voucher code

Example

ExOvh.V1.Cloud.create_project(description, voucher) |> ExOvh.request!()
create_project_alert(service_name, email, monthly_threshold, delay \\ "3600")
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 projectid or tenantid. See list_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(service_name, description)
create_user(String.t, String.t) :: HTTPipe.Conn.t

Create user

Api Call

POST /cloud/project/{serviceName}/user

Arguments

  • service_name: corresponds to projectid or tenantid. See list_services/0
  • description: description ascribed to the new user.

Example

ExOvh.V1.Cloud.create_user(service_name, "ex_ovh") |> ExOvh.request!()
delete_container(service_name, container_id)
delete_container(String.t, String.t) :: HTTPipe.Conn.t

Deletes a given container.

Note: containerd is not the same as containername.

Api call

DELETE /cloud/project/{serviceName}/storage/{containerId}

Arguments

  • service_name: service name for the ovh cloud service
  • container_id: containerid for a given container. Note: this is not the same as the containername.

Example

ExOvh.V1.Cloud.delete_container(service_name, container_id) |> ExOvh.request!()
delete_project_alert(service_name, alert_id)
delete_project_alert(String.t, String.t) :: HTTPipe.Conn.t

Delete a project alert.

Api Call

DELETE /cloud/project/{serviceName}/alerting/{id}

Arguments

Example

ExOvh.V1.Cloud.get_project_alert_info(service_name, alert_id) |> ExOvh.request!()
delete_user(service_name, user_id)
delete_user(String.t, String.t) :: HTTPipe.Conn.t

Delete a specific user.

Api Call

DELETE /cloud/project/{serviceName}/user/{userId}

Arguments

Example

ExOvh.V1.Cloud.delete_user(service_name, user_id) |> ExOvh.request!()
deploy_container_as_static_website(service_name, container_id)
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 service
  • container_id: containerid for a given container. Note: this is not the same as the containername.

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(service_name, user_id, region \\ "SBG1")
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 projectid or tenantid. See list_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(service_name)
get_access(String.t) :: HTTPipe.Conn.t

Gets the xauthtoken and the swift endpoints for a given tenantid (ovh servicename). 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(service_name)
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(region \\ nil, flavor_id \\ nil)
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(service_name, alert_id)
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

Example

ExOvh.V1.Cloud.get_project_alert_info(service_name, alert_id) |> ExOvh.request!()
get_project_alerts(service_name)
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

Example

ExOvh.V1.Cloud.get_project_alerts(service_name) |> ExOvh.request!()
get_user_details(service_name, user_id)
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

Example

ExOvh.V1.Cloud.get_user_details(service_name, user_id) |> ExOvh.request!()
get_users(service_name)
get_users(String.t) :: HTTPipe.Conn.t

Get all users

Api Call

GET /cloud/project/{serviceName}/user

Arguments

Example

ExOvh.V1.Cloud.get_users(service_name) |> ExOvh.request!()
list_services()
list_services() :: HTTPipe.Conn.t

List available services

Api Call

GET /cloud/project

Example

ExOvh.V1.Cloud.list_services() |> ExOvh.request!()
modify_container_cors(service_name, container_id, origin \\ {})
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: containerd is not the same as containername.

Api call

DELETE /cloud/project/{serviceName}/storage/{containerId}

Arguments

  • service_name: service name for the ovh cloud service
  • container_id: containerid for a given container. Note: this is not the same as the containername.
  • 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(service_name, new_description)
modify_project(String.t, String.t) :: HTTPipe.Conn.t

Modify the project description for a project.

Api Call

PUT /cloud/project/{serviceName}

Arguments

Example

ExOvh.V1.Cloud.modify_project(service_name, new_description) |> ExOvh.request!()
modify_project_alert(service_name, alert_id, email, monthly_threshold, delay \\ "3600")
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 projectid or tenantid. See list_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(service_name)
project_administrative_info(String.t) :: HTTPipe.Conn.t

Get administration information about the project

Api Call

GET /cloud/project/{serviceName}/serviceInfos

Arguments

Example

ExOvh.V1.Cloud.project_administrative_info(service_name) |> ExOvh.request!()
project_bills(service_name, date_from \\ nil, date_to \\ nil)

Get project details about a project bills.

Api Call

GET /cloud/project/{serviceName}/bill

Arguments

  • service_name: corresponds to projectid or tenantid. See list_services/0
  • date_from: starting date in ISO 8601 format. defaults to 4 weeks/28 days ago (UTC time) if left absent.
  • date_to: end date in ISO 8601 format. defaults to now (UTC time) if left absent.

Example

ExOvh.V1.Cloud.project_bills(service_name) |> ExOvh.request!()
project_consumption(service_name, date_from \\ nil, date_to \\ nil)
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 projectid or tenantid. See list_services/0
  • date_from: starting date in ISO 8601 format. defaults to 4 weeks/28 days ago (UTC time) if left absent.
  • date_to: end date in ISO 8601 format. defaults to now (UTC time) if left absent.

Example

ExOvh.V1.Cloud.project_consumption(service_name) |> ExOvh.request!()
project_info(service_name)
project_info(String.t) :: HTTPipe.Conn.t

Get details for a given project.

Api Call

GET /cloud/project/{serviceName}

Arguments

Example

ExOvh.V1.Cloud.project_info(service_name) |> ExOvh.request!()
project_quotas(service_name)
project_quotas(String.t) :: HTTPipe.Conn.t

Get project quotas.

Api Call

GET /cloud/project/{serviceName}/quota

Arguments

Example

ExOvh.V1.Cloud.project_quotas(service_name) |> ExOvh.request!()
project_region_info(service_name, region_name)
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

Example

ExOvh.V1.Cloud.project_region_info(service_name) |> ExOvh.request!()
project_regions(service_name)
project_regions(String.t) :: HTTPipe.Conn.t

Get project regions.

Api Call

GET /cloud/project/{serviceName}/region

Arguments

Example

ExOvh.V1.Cloud.project_regions(service_name) |> ExOvh.request!()
regenerate_credentials(service_name, user_id)
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 projectid or tenantid. See list_services/0
  • user_id: user_id for accessing the project. See get_users/1

Example

ExOvh.V1.Cloud.regenerate_credentials(service_name, user_id) |> ExOvh.request!()
swift_identity(service_name, user_id, password)
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

Example

ExOvh.V1.Cloud.swift_identity(service_name, user_id) |> ExOvh.request!()
terminate_project(service_name)
terminate_project(String.t) :: HTTPipe.Conn.t

Terminate a cloud project.

Api Call

POST /cloud/project/{serviceName}/terminate

Arguments

Example

ExOvh.V1.Cloud.HTTPipe.Conn.terminate_project(service_name) |> ExOvh.request!()