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

FunctionDescriptionOVH API call
list_services/0List available services or list available cloud projects. A returned project id in OVH terms is similar to a tenant id in swift termsGET /cloud/project
get_users/1Get all usersGET /cloud/project/{serviceName}/user
create_user/2Create userPOST /ctsloud/project/{serviceName}/user
get_user_details/2Get user details. Returns the user_id and username and other details.GET /cloud/project/{serviceName}/user/{userId}
delete_user/2Delete userDELETE /cloud/project/{serviceName}/user/{userId}
download_openrc_script/3Get RC file of OpenStackGET /cloud/project/{serviceName}/user/{userId}/openrc
regenerate_credentials/2Regenerate user credentials including passwordPOST /cloud/project/{serviceName}/user/{userId}/regeneratePassword
swift_identity/3Gets a json object similar to that returned by Keystone Identity. Includes the ‘X-Auth-Token’POST /cloud/project/{serviceName}/user/{userId}/token
create_project/2Start 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/2Get Prices for OVH cloud services.GET /cloud/price
project_info/1Get information about a project with the project_id (tenant_id)GET /cloud/project/{serviceName}
modify_project/2Modify a project properties. Change the project description.PUT /cloud/project/{serviceName}
project_administrative_info/1Get administration information about the project.GET /cloud/project/{serviceName}/serviceInfos
project_quotas/1Get project quotas.GET /cloud/project/{serviceName}/quota
project_regions/1Get project regions.GET /cloud/project/{serviceName}/region
project_region_info/2Get details about a project region.GET /cloud/project/{serviceName}/region/{regionName}
project_consumption/3Get details about a project consumption for a given date_from and date_to.GET /cloud/project/{serviceName}/consumption
project_bills/3Get details about a project billing for a given date_from and date_to..GET /cloud/project/{serviceName}/bill
create_project_alert/4Add a new project alertPOST /cloud/project/{serviceName}/alerting
get_project_alert_info/2Get detailed information about a project alert.GET /cloud/project/{serviceName}/alerting/{id}
modify_project_alert/5Modify an existing project alert.PUT /cloud/project/{serviceName}/alerting/{id}
delete_project_alert/2Delete an existing project alert.DELETE /cloud/project/{serviceName}/alerting/{id}
terminate_service/2Terminate a cloud project.POST /cloud/project/{serviceName}/terminate
get_containers/1Get containers for a given swift tenant id (project id or ovh service name)GET /cloud/project/{serviceName}/storage
create_container/3Create a container for a given tenant_id (ovh service_name), a container and a region.POST /cloud/project/{serviceName}/storage
get_access/1Get access details for the Swift API for a given swift tenant_id (ovh service_name)GET /cloud/project/{serviceName}/storage/access
container_info/2Gets details about a container such as objects, size, region, public or not, static_url, name, …GET /cloud/project/{serviceName}/storage/{containerId}
delete_container/2Deletes a given container.DELETE /cloud/project/{serviceName}/storage/{containerId}
modify_container_cors/3Modify the CORS settings for a container. See swift docsPOST /cloud/project/{serviceName}/storage/{containerId}/cors Add CORS support on your container
deploy_container_as_static_website/2Deploy 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!()

Link to this section 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 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 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

Link to this section Functions

Link to this function container_info(service_name, container_id) View Source
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: 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!()
Link to this function create_container(service_name, container_name, region \\ "SBG1") View Source
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!()
Link to this function create_project(description, voucher) View Source
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!()
Link to this function create_project_alert(service_name, email, monthly_threshold, delay \\ "3600") View Source
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. 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!()
Link to this function create_user(service_name, description) View Source
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. See list_services/0
  • description: description ascribed to the new user.

Example

ExOvh.V1.Cloud.create_user(service_name, "ex_ovh") |> ExOvh.request!()
Link to this function delete_container(service_name, container_id) View Source
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 service
  • container_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!()
Link to this function delete_project_alert(service_name, alert_id) View Source
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!()
Link to this function delete_user(service_name, user_id) View Source
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!()
Link to this function deploy_container_as_static_website(service_name, container_id) View Source
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: 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)
Link to this function download_openrc_script(service_name, user_id, region \\ "SBG1") View Source
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. 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!()
Link to this function get_access(service_name) View Source
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!()
Link to this function get_containers(service_name) View Source
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!()
Link to this function get_prices(region \\ nil, flavor_id \\ nil) View Source
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!()
Link to this function get_project_alert_info(service_name, alert_id) View Source
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!()
Link to this function get_project_alerts(service_name) View Source
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. See list_services/0

Example

ExOvh.V1.Cloud.get_project_alerts(service_name) |> ExOvh.request!()
Link to this function get_user_details(service_name, user_id) View Source
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!()
Link to this function get_users(service_name) View Source
get_users(String.t()) :: HTTPipe.Conn.t()

Get all users

Api Call

GET /cloud/project/{serviceName}/user

Arguments

  • service_name: corresponds to project_id or tenant_id. See list_services/0

Example

ExOvh.V1.Cloud.get_users(service_name) |> ExOvh.request!()
Link to this function list_services() View Source
list_services() :: HTTPipe.Conn.t()

List available services

Api Call

GET /cloud/project

Example

ExOvh.V1.Cloud.list_services() |> ExOvh.request!()
Link to this function modify_container_cors(service_name, container_id, origin \\ {}) View Source
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

MetadataUse
X-Container-Meta-Access-Control-Allow-OriginOrigins 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 service
  • container_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")
Link to this function modify_project(service_name, new_description) View Source
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. See list_services/0

Example

ExOvh.V1.Cloud.modify_project(service_name, new_description) |> ExOvh.request!()
Link to this function modify_project_alert(service_name, alert_id, email, monthly_threshold, delay \\ "3600") View Source
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. 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!()
Link to this function project_administrative_info(service_name) View Source
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. See list_services/0

Example

ExOvh.V1.Cloud.project_administrative_info(service_name) |> ExOvh.request!()
Link to this function project_bills(service_name, date_from \\ nil, date_to \\ nil) View Source
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. 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!()
Link to this function project_consumption(service_name, date_from \\ nil, date_to \\ nil) View Source
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. 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!()
Link to this function project_info(service_name) View Source
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. See list_services/0

Example

ExOvh.V1.Cloud.project_info(service_name) |> ExOvh.request!()
Link to this function project_quotas(service_name) View Source
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. See list_services/0

Example

ExOvh.V1.Cloud.project_quotas(service_name) |> ExOvh.request!()
Link to this function project_region_info(service_name, region_name) View Source
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. See list_services/0

Example

ExOvh.V1.Cloud.project_region_info(service_name) |> ExOvh.request!()
Link to this function project_regions(service_name) View Source
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. See list_services/0

Example

ExOvh.V1.Cloud.project_regions(service_name) |> ExOvh.request!()
Link to this function regenerate_credentials(service_name, user_id) View Source
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. 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!()
Link to this function swift_identity(service_name, user_id, password) View Source
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!()
Link to this function terminate_project(service_name) View Source
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. See list_services/0

Example

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