ssh_keys
Creates, updates, deletes, gets or lists a ssh_keys resource.
Overview​
| Name | ssh_keys |
| Type | Resource |
| Id | ovh.public_cloud.ssh_keys |
Fields​
The following fields are returned by SELECT queries:
- get
- list
successful operation
| Name | Datatype | Description |
|---|---|---|
name | string | Unique name of the SSH key |
created_at | string (date-time) | Creation date of the SSH key (wire: createdAt) |
public_key | string | SSH public key content (wire: publicKey) |
updated_at | string (date-time) | Last update date of the SSH key (wire: updatedAt) |
A Public Cloud SSH key (stored in database, synced to OpenStack on instance creation)
| Name | Datatype | Description |
|---|---|---|
name | string | Unique name of the SSH key |
created_at | string (date-time) | Creation date of the SSH key (wire: createdAt) |
public_key | string | SSH public key content (wire: publicKey) |
updated_at | string (date-time) | Last update date of the SSH key (wire: updatedAt) |
Methods​
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | name, project_id | Returns the SSH key with its public key content. | |
list | select | project_id | x_pagination_cursor, x_pagination_size | Returns the SSH public keys stored in the project. |
create | insert | project_id, name, public_key | Stores an SSH public key under a name that is unique in the project. Use this name to install the key on an instance at creation. | |
delete | delete | name, project_id | Deletes the SSH key from the project. Instances created with this key keep it. |
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"}}) |
name | string | Name |
project_id | string | The Public Cloud project ID. Resolved from OVH_CLOUD_PROJECT_SERVICE when set. |
x_pagination_cursor | string | Pagination cursor (wire: X-Pagination-Cursor) |
x_pagination_size | integer | Pagination size (wire: X-Pagination-Size) |
SELECT examples​
- get
- list
Returns the SSH key with its public key content.
SELECT
name,
created_at,
public_key,
updated_at
FROM ovh.public_cloud.ssh_keys
WHERE name = '{{ name }}' -- required
AND project_id = '{{ project_id }}' -- required unless OVH_CLOUD_PROJECT_SERVICE is set
;
Returns the SSH public keys stored in the project.
SELECT
name,
created_at,
public_key,
updated_at
FROM ovh.public_cloud.ssh_keys
WHERE project_id = '{{ project_id }}' -- required unless OVH_CLOUD_PROJECT_SERVICE is set
AND x_pagination_cursor = '{{ x_pagination_cursor }}'
AND x_pagination_size = '{{ x_pagination_size }}'
;
INSERT examples​
- create
- Manifest
Stores an SSH public key under a name that is unique in the project. Use this name to install the key on an instance at creation.
INSERT INTO ovh.public_cloud.ssh_keys (
name,
public_key,
project_id
)
SELECT
'{{ name }}' /* required */,
'{{ public_key }}' /* required */,
'{{ project_id }}'
RETURNING
name,
created_at,
public_key,
updated_at
;
# Description fields are for documentation purposes
- name: ssh_keys
props:
- name: project_id
value: "{{ project_id }}"
description: Required parameter for the ssh_keys resource.
- name: name
value: "{{ name }}"
description: |
Unique name for the SSH key
- name: public_key
value: "{{ public_key }}"
description: |
SSH public key content
DELETE examples​
- delete
Deletes the SSH key from the project. Instances created with this key keep it.
DELETE FROM ovh.public_cloud.ssh_keys
WHERE name = '{{ name }}' --required
AND project_id = '{{ project_id }}' --required unless OVH_CLOUD_PROJECT_SERVICE is set
;