credits
Creates, updates, deletes, gets or lists a credits resource.
Overview​
| Name | credits |
| Type | Resource |
| Id | ovh.cloud.credits |
Fields​
The following fields are returned by SELECT queries:
- get
- list
successful operation
| Name | Datatype | Description |
|---|---|---|
id | integer | Credit id |
available_credit | object | Available credit |
bill | string | Credit bill id |
description | string | Credit description |
products | array | Use credits on following products |
total_credit | object | Total credit |
used_credit | object | Used credit |
validity | object | Credit validity |
voucher | string | Voucher code |
Cloud credit
| Name | Datatype | Description |
|---|---|---|
id | integer | Credit id |
available_credit | object | Available credit |
bill | string | Credit bill id |
description | string | Credit description |
products | array | Use credits on following products |
total_credit | object | Total credit |
used_credit | object | Used credit |
validity | object | Credit validity |
voucher | string | Voucher code |
Methods​
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | id, service_name | Get a project credit. Returns the total, used and available amounts of the credit, its validity period and the products it applies to. | |
list | select | service_name | x_pagination_mode | List project credits. Returns the IDs of the credits added to the project. |
create | insert | service_name, code | Add a voucher credit. Adds the credit of a voucher code to the project. |
Parameters​
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
api_host | string | The OVHcloud API host. Selected by OVH_ENDPOINT (ovh-eu, ovh-ca or ovh-us; default ovh-eu). (default: api.eu.ovhcloud.com, x-stackQL-envVarSelector: {"envVar":"OVH_ENDPOINT","default":"ovh-eu","values":{"ovh-eu":"api.eu.ovhcloud.com","ovh-ca":"api.ca.ovhcloud.com","ovh-us":"api.us.ovhcloud.com"}}) |
id | integer | Credit id |
service_name | string | The Public Cloud project ID. Resolved from OVH_CLOUD_PROJECT_SERVICE when set. |
x_pagination_mode | string | Sent as CachedObjectList-Pages by default so the list returns the full objects rather than their identifiers. (wire: X-Pagination-Mode) |
SELECT examples​
- get
- list
Get a project credit. Returns the total, used and available amounts of the credit, its validity period and the products it applies to.
SELECT
id,
available_credit,
bill,
description,
products,
total_credit,
used_credit,
validity,
voucher
FROM ovh.cloud.credits
WHERE id = '{{ id }}' -- required
AND service_name = '{{ service_name }}' -- required unless OVH_CLOUD_PROJECT_SERVICE is set
;
List project credits. Returns the IDs of the credits added to the project.
SELECT
id,
available_credit,
bill,
description,
products,
total_credit,
used_credit,
validity,
voucher
FROM ovh.cloud.credits
WHERE service_name = '{{ service_name }}' -- required unless OVH_CLOUD_PROJECT_SERVICE is set
AND x_pagination_mode = '{{ x_pagination_mode }}'
;
INSERT examples​
- create
- Manifest
Add a voucher credit. Adds the credit of a voucher code to the project.
INSERT INTO ovh.cloud.credits (
code,
service_name
)
SELECT
'{{ code }}' /* required */,
'{{ service_name }}'
;
# Description fields are for documentation purposes
- name: credits
props:
- name: service_name
value: "{{ service_name }}"
description: Required parameter for the credits resource.
- name: code
value: "{{ code }}"
description: |
Voucher code