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
orserviceName
corresponds to the Openstacktenant_id
Example
ExOvh.Services.V1.Cloud.Cloudstorage.Query.get_containers(service_name) |> ExOvh.request!()
Summary
Functions
Create a new Cloud Project
Create a new project alert
Create user
Delete a project alert
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
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
Functions
Create a new Cloud Project.
Api Call
POST /cloud/createProject
Arguments
description
: project descriptionvoucher
: ovh voucher code
Example
ExOvh.Services.V1.Cloud.Query.create_project(description, voucher) |> ExOvh.request!()
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. 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.Services.V1.Cloud.Query.create_project_alert(service_name, "email_address@email.email", 5) |> ExOvh.request!()
Create user
Api Call
POST /cloud/project/{serviceName}/user
Arguments
service_name
: corresponds to projectid or tenantid. Seelist_services/0
description
: description ascribed to the new user.
Example
ExOvh.Services.V1.Cloud.Query.create_user(service_name, "ex_ovh") |> ExOvh.request!()
Delete a project alert.
Api Call
DELETE /cloud/project/{serviceName}/alerting/{id}
Arguments
service_name
: corresponds to projectid or tenantid. Seelist_services/0
alert_id
: The id of the project alert. Seeget_project_alerts/1
Example
ExOvh.Services.V1.Cloud.Query.get_project_alert_info(service_name, alert_id) |> ExOvh.request!()
Delete a specific user.
Api Call
DELETE /cloud/project/{serviceName}/user/{userId}
Arguments
service_name
: corresponds to projectid or tenantid. Seelist_services/0
user_id
: The user_id. Seeget_users/1
Example
ExOvh.Services.V1.Cloud.Query.delete_user(service_name, user_id) |> ExOvh.request!()
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. 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.Services.V1.Cloud.Query.download_openrc_script(service_name, user_id, "SBG1") |> ExOvh.request!()
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 detailed information about a project alert.
Api Call
GET /cloud/project/{serviceName}/alerting/{id}
Arguments
service_name
: corresponds to projectid or tenantid. Seelist_services/0
alert_id
: The id of the project alert. Seeget_project_alerts/1
Example
ExOvh.Services.V1.Cloud.Query.get_project_alert_info(service_name, alert_id) |> ExOvh.request!()
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
service_name
: corresponds to projectid or tenantid. Seelist_services/0
Example
ExOvh.Services.V1.Cloud.Query.get_project_alerts(service_name) |> ExOvh.request!()
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 projectid or tenantid. Seelist_services/0
user_id
: corresponds to user_id. Seeget_users/1
Example
ExOvh.Services.V1.Cloud.Query.get_user_details(service_name, user_id) |> ExOvh.request!()
Specs
get_users(String.t) :: ExOvh.Query.t
Get all users
Api Call
GET /cloud/project/{serviceName}/user
Arguments
service_name
: corresponds to projectid or tenantid. Seelist_services/0
Example
ExOvh.Services.V1.Cloud.Query.get_users(service_name) |> ExOvh.request!()
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 the project description for a project.
Api Call
PUT /cloud/project/{serviceName}
Arguments
service_name
: corresponds to projectid or tenantid. Seelist_services/0
Example
ExOvh.Services.V1.Cloud.Query.modify_project(service_name, new_description) |> ExOvh.request!()
Modify an existing project alert.
Api Call
PUT /cloud/project/{serviceName}/alerting/{id}
Arguments
service_name
: corresponds to projectid or tenantid. 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.Services.V1.Cloud.Query.modify_project_alert(service_name, alert_id, "email_address@email.email", 5) |> ExOvh.request!()
Specs
project_administrative_info(String.t) :: ExOvh.Query.t
Get administration information about the project
Api Call
GET /cloud/project/{serviceName}/serviceInfos
Arguments
service_name
: corresponds to projectid or tenantid. Seelist_services/0
Example
ExOvh.Services.V1.Cloud.Query.project_administrative_info(service_name) |> ExOvh.request!()
Get project details about a project bills.
Api Call
GET /cloud/project/{serviceName}/bill
Arguments
service_name
: corresponds to projectid or tenantid. 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.Services.V1.Cloud.Query.project_bills(service_name) |> ExOvh.request!()
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. 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.Services.V1.Cloud.Query.project_consumption(service_name) |> ExOvh.request!()
Specs
project_info(String.t) :: ExOvh.Query.t
Get details for a given project.
Api Call
GET /cloud/project/{serviceName}
Arguments
service_name
: corresponds to projectid or tenantid. Seelist_services/0
Example
ExOvh.Services.V1.Cloud.Query.project_info(service_name) |> ExOvh.request!()
Specs
project_quotas(String.t) :: ExOvh.Query.t
Get project quotas.
Api Call
GET /cloud/project/{serviceName}/quota
Arguments
service_name
: corresponds to projectid or tenantid. Seelist_services/0
Example
ExOvh.Services.V1.Cloud.Query.project_quotas(service_name) |> ExOvh.request!()
Get project details about a project region.
Api Call
GET /cloud/project/{serviceName}/region/{regionName}
Arguments
service_name
: corresponds to projectid or tenantid. Seelist_services/0
Example
ExOvh.Services.V1.Cloud.Query.project_region_info(service_name) |> ExOvh.request!()
Specs
project_regions(String.t) :: ExOvh.Query.t
Get project regions.
Api Call
GET /cloud/project/{serviceName}/region
Arguments
service_name
: corresponds to projectid or tenantid. Seelist_services/0
Example
ExOvh.Services.V1.Cloud.Query.project_regions(service_name) |> ExOvh.request!()
Regenerate user password and other credentials.
Api Call
POST /cloud/project/{serviceName}/user/{userId}/regeneratePassword
Arguments
service_name
: corresponds to projectid or tenantid. Seelist_services/0
user_id
: user_id for accessing the project. Seeget_users/1
Example
ExOvh.Services.V1.Cloud.Query.regenerate_credentials(service_name, user_id) |> ExOvh.request!()
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 projectid or tenantid. 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.Services.V1.Cloud.Query.swift_identity(service_name, user_id) |> ExOvh.request!()
Specs
terminate_project(String.t) :: ExOvh.Query.t
Terminate a cloud project.
Api Call
POST /cloud/project/{serviceName}/terminate
Arguments
service_name
: corresponds to projectid or tenantid. Seelist_services/0
Example
ExOvh.Services.V1.Cloud.Query.terminate_project(service_name) |> ExOvh.request!()