Skip to main content

netapp_snapshot_policies

Creates, updates, deletes, gets or lists a netapp_snapshot_policies resource.

Overview​

Namenetapp_snapshot_policies
TypeResource
Idovh.storage.netapp_snapshot_policies

Fields​

The following fields are returned by SELECT queries:

successful operation

NameDatatypeDescription
idstring (uuid)Snapshot policy ID
namestringSnapshot policy name
created_atstring (date-time)Snapshot policy creation date (wire: createdAt)
descriptionstringSnapshot policy description
is_defaultbooleanIs this the default snapshot policy? (wire: isDefault)
rulesarraySnapshot policy rules, 1 to 4
statusstringSnapshot policy status (available, creating, deleting, error, updating)

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectservice_name, snapshot_policy_idReturns the snapshot policy with its rules and status. A policy can be updated, deleted or assigned to a share only when its status is available.
listselectservice_nameReturns the snapshot policies, including the default one. Each item contains only the policy ID and name: get a snapshot policy to read its rules and status.
createinsertservice_name, rulesCreates a policy made of rules, each with a schedule, a snapshot name prefix and a number of copies to keep. Creation is asynchronous: follow the snapshot policy status until it is available. The policy takes effect only once it is assigned to a share.
updateupdateservice_name, snapshot_policy_idUpdates the policy name and description. Rules cannot be changed: create a new policy instead. The policy must be available, and the default policy cannot be updated.
deletedeleteservice_name, snapshot_policy_idDeletes the snapshot policy and its schedules. A policy applied to a share cannot be deleted: apply another non-default policy to the share first. The default policy cannot be deleted, and deletion is asynchronous: follow the snapshot policy status until the policy is no longer found.

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.

NameDatatypeDescription
api_hoststringThe 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"}})
service_namestring (uuid)Service name (wire: serviceName)
snapshot_policy_idstring (uuid)Snapshot policy ID (wire: snapshotPolicyId)

SELECT examples​

Returns the snapshot policy with its rules and status. A policy can be updated, deleted or assigned to a share only when its status is available.

SELECT
id,
name,
created_at,
description,
is_default,
rules,
status
FROM ovh.storage.netapp_snapshot_policies
WHERE service_name = '{{ service_name }}' -- required
AND snapshot_policy_id = '{{ snapshot_policy_id }}' -- required
;

INSERT examples​

Creates a policy made of rules, each with a schedule, a snapshot name prefix and a number of copies to keep. Creation is asynchronous: follow the snapshot policy status until it is available. The policy takes effect only once it is assigned to a share.

INSERT INTO ovh.storage.netapp_snapshot_policies (
description,
name,
rules,
service_name
)
SELECT
'{{ description }}',
'{{ name }}',
'{{ rules }}' /* required */,
'{{ service_name }}'
RETURNING
id,
name,
created_at,
description,
is_default,
rules,
status
;

UPDATE examples​

Updates the policy name and description. Rules cannot be changed: create a new policy instead. The policy must be available, and the default policy cannot be updated.

UPDATE ovh.storage.netapp_snapshot_policies
SET
description = '{{ description }}',
name = '{{ name }}'
WHERE
service_name = '{{ service_name }}' --required
AND snapshot_policy_id = '{{ snapshot_policy_id }}' --required;

DELETE examples​

Deletes the snapshot policy and its schedules. A policy applied to a share cannot be deleted: apply another non-default policy to the share first. The default policy cannot be deleted, and deletion is asynchronous: follow the snapshot policy status until the policy is no longer found.

DELETE FROM ovh.storage.netapp_snapshot_policies
WHERE service_name = '{{ service_name }}' --required
AND snapshot_policy_id = '{{ snapshot_policy_id }}' --required
;