ExOvh v0.1.1 ExOvh.Services.V1.Cloud.Query

Helper functions for building queries directed at the /cloud part of the OVH API.

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

TO BE ADDED

GET /cloud/project/{serviceName}/acl
POST /cloud/project/{serviceName}/acl
GET /cloud/project/{serviceName}/acl/{accountId}
DELETE /cloud/project/{serviceName}/acl/{accountId}

Notes

  • service_name or serviceName corresponds to the Openstack tenant_id

Example

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

Summary

Functions

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

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 query 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

create_project(description, voucher)

Specs

create_project(String.t, String.t) :: ExOvh.Query.t

Create a new Cloud Project.

Api Call

POST /cloud/createProject

Arguments

  • description: project description
  • voucher: ovh voucher code

Example

ExOvh.Services.V1.Cloud.Query.create_project(description, voucher) |> ExOvh.request!()
create_project_alert(service_name, email, monthly_threshold, delay \\ "3600")

Specs

create_project_alert(String.t, String.t, integer, String.t) ::
  ExOvh.Query.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.Services.V1.Cloud.Query.create_project_alert(service_name, "email_address@email.email", 5) |> ExOvh.request!()
create_user(service_name, description)

Specs

create_user(String.t, String.t) :: ExOvh.Query.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.Services.V1.Cloud.Query.create_user(service_name, "ex_ovh") |> ExOvh.request!()
delete_project_alert(service_name, alert_id)

Specs

delete_project_alert(String.t, String.t) :: ExOvh.Query.t

Delete a project alert.

Api Call

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

Arguments

Example

ExOvh.Services.V1.Cloud.Query.get_project_alert_info(service_name, alert_id) |> ExOvh.request!()
delete_user(service_name, user_id)

Specs

delete_user(String.t, String.t) :: ExOvh.Query.t

Delete a specific user.

Api Call

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

Arguments

Example

ExOvh.Services.V1.Cloud.Query.delete_user(service_name, user_id) |> ExOvh.request!()
download_openrc_script(service_name, user_id, region \\ "SBG1")

Specs

download_openrc_script(String.t, String.t, String.t) :: ExOvh.Query.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.Services.V1.Cloud.Query.download_openrc_script(service_name, user_id, "SBG1") |> ExOvh.request!()
get_prices(region \\ nil, flavor_id \\ nil)

Specs

get_prices(String.t | nil, String.t | nil) :: ExOvh.Query.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.Services.V1.Cloud.Query.get_prices() |> ExOvh.request!()
get_project_alert_info(service_name, alert_id)

Specs

get_project_alert_info(String.t, String.t) :: ExOvh.Query.t

Get detailed information about a project alert.

Api Call

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

Arguments

Example

ExOvh.Services.V1.Cloud.Query.get_project_alert_info(service_name, alert_id) |> ExOvh.request!()
get_project_alerts(service_name)

Specs

get_project_alerts(String.t) :: ExOvh.Query.t

Get a list of project alert ids. These project alert ids can then be looked up in a separate query for more information.

Api Call

GET /cloud/project/{serviceName}/alerting

Arguments

Example

ExOvh.Services.V1.Cloud.Query.get_project_alerts(service_name) |> ExOvh.request!()
get_user_details(service_name, user_id)

Specs

get_user_details(String.t, String.t) :: ExOvh.Query.t

Get user details. Returns the user_id and username and other details.

Api Call

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

Arguments

Example

ExOvh.Services.V1.Cloud.Query.get_user_details(service_name, user_id) |> ExOvh.request!()
get_users(service_name)

Specs

get_users(String.t) :: ExOvh.Query.t

Get all users

Api Call

GET /cloud/project/{serviceName}/user

Arguments

Example

ExOvh.Services.V1.Cloud.Query.get_users(service_name) |> ExOvh.request!()
list_services()

Specs

list_services :: ExOvh.Query.t

List available services

Api Call

GET /cloud/project

Example

ExOvh.Services.V1.Cloud.Query.list_services() |> ExOvh.request!()
modify_project(service_name, new_description)

Specs

modify_project(String.t, String.t) :: ExOvh.Query.t

Modify the project description for a project.

Api Call

PUT /cloud/project/{serviceName}

Arguments

Example

ExOvh.Services.V1.Cloud.Query.modify_project(service_name, new_description) |> ExOvh.request!()
modify_project_alert(service_name, alert_id, email, monthly_threshold, delay \\ "3600")

Specs

modify_project_alert(String.t, String.t, String.t, integer, String.t) :: ExOvh.Query.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.Services.V1.Cloud.Query.modify_project_alert(service_name, alert_id, "email_address@email.email", 5) |> ExOvh.request!()
project_administrative_info(service_name)

Specs

project_administrative_info(String.t) :: ExOvh.Query.t

Get administration information about the project

Api Call

GET /cloud/project/{serviceName}/serviceInfos

Arguments

Example

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

Specs

project_bills(String.t, String.t, String.t) :: ExOvh.Query.t

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.Services.V1.Cloud.Query.project_bills(service_name) |> ExOvh.request!()
project_consumption(service_name, date_from \\ nil, date_to \\ nil)

Specs

project_consumption(String.t, String.t, String.t) :: ExOvh.Query.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.Services.V1.Cloud.Query.project_consumption(service_name) |> ExOvh.request!()
project_info(service_name)

Specs

project_info(String.t) :: ExOvh.Query.t

Get details for a given project.

Api Call

GET /cloud/project/{serviceName}

Arguments

Example

ExOvh.Services.V1.Cloud.Query.project_info(service_name) |> ExOvh.request!()
project_quotas(service_name)

Specs

project_quotas(String.t) :: ExOvh.Query.t

Get project quotas.

Api Call

GET /cloud/project/{serviceName}/quota

Arguments

Example

ExOvh.Services.V1.Cloud.Query.project_quotas(service_name) |> ExOvh.request!()
project_region_info(service_name, region_name)

Specs

project_region_info(String.t, String.t) :: ExOvh.Query.t

Get project details about a project region.

Api Call

GET /cloud/project/{serviceName}/region/{regionName}

Arguments

Example

ExOvh.Services.V1.Cloud.Query.project_region_info(service_name) |> ExOvh.request!()
project_regions(service_name)

Specs

project_regions(String.t) :: ExOvh.Query.t

Get project regions.

Api Call

GET /cloud/project/{serviceName}/region

Arguments

Example

ExOvh.Services.V1.Cloud.Query.project_regions(service_name) |> ExOvh.request!()
regenerate_credentials(service_name, user_id)

Specs

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

Specs

swift_identity(String.t, String.t, String.t) :: ExOvh.Query.t

Get the token for the user (very similar to keystone identity)

Api Call

POST /cloud/project/{serviceName}/user/{userId}/token

Arguments

Example

ExOvh.Services.V1.Cloud.Query.swift_identity(service_name, user_id) |> ExOvh.request!()
terminate_project(service_name)

Specs

terminate_project(String.t) :: ExOvh.Query.t

Terminate a cloud project.

Api Call

POST /cloud/project/{serviceName}/terminate

Arguments

Example

ExOvh.Services.V1.Cloud.Query.terminate_project(service_name) |> ExOvh.request!()