Skip to content

Commit 1088256

Browse files
committed
Add support for tags and tiering_object_tags
Signed-off-by: Brinn Joyce <[email protected]>
1 parent 196e9ff commit 1088256

File tree

7 files changed

+296
-112
lines changed

7 files changed

+296
-112
lines changed

docs/data-sources/volume.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,16 @@ data "netapp-ontap_volume" "storage_volume" {
4747
- `nas` (Attributes) (see [below for nested schema](#nestedatt--nas))
4848
- `qos_policy_group` (String) Specifies a QoS policy group to be set on volume
4949
- `snaplock` (Attributes) (see [below for nested schema](#nestedatt--snaplock))
50+
- `snapshot_locking_enabled` (Boolean) Whether or not snapshot copy locking is enabled on the volume.
5051
- `snapshot_policy` (String) The name of the snapshot policy
5152
- `space` (Attributes) (see [below for nested schema](#nestedatt--space))
5253
- `space_guarantee` (String) Space guarantee style for the volume
5354
- `state` (String) Whether the specified volume is online, or not
55+
- `tags` (List of String) List of tags associated with the volume
5456
- `tiering` (Attributes) (see [below for nested schema](#nestedatt--tiering))
5557
- `type` (String) The volume type, either read-write (RW) or data-protection (DP)
56-
- `snapshot_locking_enabled` (Boolean) Whether or not snapshot copy locking is enabled on the volume
5758

5859
<a id="nestedatt--aggregates"></a>
59-
6060
### Nested Schema for `aggregates`
6161

6262
Read-Only:
@@ -93,10 +93,11 @@ Read-Only:
9393

9494
Read-Only:
9595

96+
- `compaction` (String) The system can be enabled/disabled compaction
9697
- `compression` (String) Whether to enable compression for the volume (HDD and Flash Pool aggregates)
97-
- `policy_name` (String) Allows a storage efficiency policy to be set on volume creation
9898
- `dedupe` (String) The system can be enabled/disabled dedupe
99-
- `compaction` (String) The system can be enabled/disabled compression
99+
- `policy_name` (String) Allows a storage efficiency policy to be set on volume creation
100+
100101

101102
<a id="nestedatt--nas"></a>
102103

@@ -146,4 +147,5 @@ Read-Only:
146147
Read-Only:
147148

148149
- `minimum_cooling_days` (Number) Determines how many days must pass before inactive data in a volume using the Auto or Snapshot-Only policy is considered cold and eligible for tiering
150+
- `object_tags` (List of String) Object tags are applied to objects in tiered storage
149151
- `policy_name` (String) The tiering policy that is to be associated with the volume

docs/data-sources/volumes.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ Optional:
5050

5151
- `name` (String) StorageVolume name
5252
- `svm_name` (String) StorageVolume svm name
53+
- `tags` (String) StorageVolume tag value
54+
- `tiering_object_tags` (String) StorageVolume tiering object tag value
55+
5356

5457
<a id="nestedatt--storage_volumes"></a>
5558

@@ -63,7 +66,7 @@ Required:
6366

6467
Read-Only:
6568

66-
- `aggregates` (Attributes List) Aggregates the volume is on (see [below for nested schema](#nestedatt--aggregates))
69+
- `aggregates` (Attributes List) List of aggregates that the volume is on (see [below for nested schema](#nestedatt--storage_volumes--aggregates))
6770
- `analytics` (Attributes) (see [below for nested schema](#nestedatt--storage_volumes--analytics))
6871
- `autosize` (Attributes) (see [below for nested schema](#nestedatt--storage_volumes--autosize))
6972
- `comment` (String) Sets a comment associated with the volume
@@ -74,10 +77,12 @@ Read-Only:
7477
- `nas` (Attributes) (see [below for nested schema](#nestedatt--storage_volumes--nas))
7578
- `qos_policy_group` (String) Specifies a QoS policy group to be set on volume
7679
- `snaplock` (Attributes) (see [below for nested schema](#nestedatt--storage_volumes--snaplock))
80+
- `snapshot_locking_enabled` (Boolean) Whether or not snapshot copy locking is enabled on the volume.
7781
- `snapshot_policy` (String) The name of the snapshot policy
7882
- `space` (Attributes) (see [below for nested schema](#nestedatt--storage_volumes--space))
7983
- `space_guarantee` (String) Space guarantee style for the volume
8084
- `state` (String) Whether the specified volume is online, or not
85+
- `tags` (List of String) List of tags associated with the volume
8186
- `tiering` (Attributes) (see [below for nested schema](#nestedatt--storage_volumes--tiering))
8287
- `type` (String) The volume type, either read-write (RW) or data-protection (DP)
8388

@@ -97,8 +102,8 @@ Read-Only:
97102

98103
- `state` (String) Set file system analytics state of the volume
99104

100-
<a id="nestedatt--storage_volumes--autosize"></a>
101105

106+
<a id="nestedatt--storage_volumes--autosize"></a>
102107
### Nested Schema for `storage_volumes.autosize`
103108

104109
Read-Only:
@@ -107,9 +112,9 @@ Read-Only:
107112
- `maximum` (Number) Maximum size up to which a volume grows automatically. This size cannot be less than the current volume size, or less than or equal to the minimum size of volume.
108113
- `minimum` (Number) Minimum size up to which the volume shrinks automatically. This size cannot be greater than or equal to the maximum size of volume.
109114
- `mode` (String) Autosize mode for the volume.
110-
grow - Volume automatically grows when the amount of used space is above the 'grow_threshold' value.
111-
grow_shrink - Volume grows or shrinks in response to the amount of space used.
112-
off - Autosizing of the volume is disabled.
115+
grow - Volume automatically grows when the amount of used space is above the 'grow_threshold' value.
116+
grow_shrink - Volume grows or shrinks in response to the amount of space used.
117+
off - Autosizing of the volume is disabled.
113118
- `shrink_threshold` (Number) Used space threshold size, in percentage, for the automatic shrinkage of the volume.
114119
- `size_unit` (String) The unit used to interpret the minimum or maximum size parameters.
115120

@@ -119,7 +124,9 @@ Read-Only:
119124

120125
Read-Only:
121126

127+
- `compaction` (String) The system can be enabled/disabled compaction
122128
- `compression` (String) Whether to enable compression for the volume (HDD and Flash Pool aggregates)
129+
- `dedupe` (String) The system can be enabled/disabled dedupe
123130
- `policy_name` (String) Allows a storage efficiency policy to be set on volume creation
124131

125132
<a id="nestedatt--storage_volumes--nas"></a>
@@ -172,4 +179,5 @@ Read-Only:
172179
Read-Only:
173180

174181
- `minimum_cooling_days` (Number) Determines how many days must pass before inactive data in a volume using the Auto or Snapshot-Only policy is considered cold and eligible for tiering
182+
- `object_tags` (List of String) Object tags are applied to objects in tiered storage
175183
- `policy_name` (String) The tiering policy that is to be associated with the volume

docs/resources/volume.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ resource "netapp-ontap_volume" "example" {
7878

7979
### Required
8080

81-
- `aggregates` (Attributes List) Aggregates the volume is on (see [below for nested schema](#nestedatt--aggregates))
81+
- `aggregates` (Attributes Set) List of aggregates to place volume on (see [below for nested schema](#nestedatt--aggregates))
8282
- `cx_profile_name` (String) Connection profile name
8383
- `name` (String) The name of the volume to manage
8484
- `space` (Attributes) (see [below for nested schema](#nestedatt--space))
@@ -95,19 +95,19 @@ resource "netapp-ontap_volume" "example" {
9595
- `nas` (Attributes) (see [below for nested schema](#nestedatt--nas))
9696
- `qos_policy_group` (String) Specifies a QoS policy group to be set on volume
9797
- `snaplock` (Attributes) (see [below for nested schema](#nestedatt--snaplock))
98+
- `snapshot_locking_enabled` (Boolean) Whether or not snapshot copy locking is enabled on the volume.
9899
- `snapshot_policy` (String) The name of the snapshot policy
99100
- `space_guarantee` (String) Space guarantee style for the volume
100101
- `state` (String) Whether the specified volume is online, or not
102+
- `tags` (List of String) List of tags associated with the volume
101103
- `tiering` (Attributes) (see [below for nested schema](#nestedatt--tiering))
102104
- `type` (String) The volume type, either read-write (RW) or data-protection (DP)
103-
- `snapshot_locking_enabled` (Boolean) Whether or not snapshot copy locking is enabled on the volume
104105

105106
### Read-Only
106107

107108
- `id` (String) Volume identifier
108109

109110
<a id="nestedatt--aggregates"></a>
110-
111111
### Nested Schema for `aggregates`
112112

113113
Required:
@@ -167,10 +167,11 @@ Optional:
167167

168168
Optional:
169169

170+
- `compaction` (String) The system can be enabled/disabled compaction
170171
- `compression` (String) Whether to enable compression for the volume (HDD and Flash Pool aggregates)
171-
- `policy_name` (String) Allows a storage efficiency policy to be set on volume creation
172172
- `dedupe` (String) The system can be enabled/disabled dedupe
173-
- `compaction` (String) The system can be enabled/disabled compression
173+
- `policy_name` (String) Allows a storage efficiency policy to be set on volume creation
174+
174175

175176
<a id="nestedatt--nas"></a>
176177

@@ -200,6 +201,7 @@ Optional:
200201
Optional:
201202

202203
- `minimum_cooling_days` (Number) Determines how many days must pass before inactive data in a volume using the Auto or Snapshot-Only policy is considered cold and eligible for tiering
204+
- `object_tags` (List of String) Object tags are applied to objects in tiered storage
203205
- `policy_name` (String) The tiering policy that is to be associated with the volume
204206

205207
## Import

internal/interfaces/storage_volume.go

Lines changed: 51 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -14,49 +14,51 @@ import (
1414

1515
// StorageVolumeGetDataModelONTAP describes the GET record data model using go types for mapping.
1616
type StorageVolumeGetDataModelONTAP struct {
17-
Name string
18-
SVM svm
19-
Space Space
20-
State string
21-
Type string
22-
Comment string
23-
SpaceGuarantee Guarantee `mapstructure:"guarantee"`
24-
NAS NAS
25-
QOS QOS
26-
Encryption Encryption
27-
Efficiency Efficiency
28-
SnapshotPolicy SnapshotPolicy `mapstructure:"snapshot_policy,omitempty"`
29-
TieringPolicy TieringPolicy `mapstructure:"tiering,omitempty"`
30-
Snaplock Snaplock
31-
Analytics Analytics
32-
Language string
33-
Aggregates []Aggregate
34-
Autosize Autosize `mapstructure:"autosize,omitempty"`
35-
UUID string
36-
SnapshotLockingEnabled *bool `mapstructure:"snapshot_locking_enabled,omitempty"`
17+
Name string
18+
SVM svm
19+
Space Space
20+
State string
21+
Type string
22+
Comment string
23+
SpaceGuarantee Guarantee `mapstructure:"guarantee"`
24+
NAS NAS
25+
QOS QOS
26+
Encryption Encryption
27+
Efficiency Efficiency
28+
SnapshotPolicy SnapshotPolicy `mapstructure:"snapshot_policy,omitempty"`
29+
TieringPolicy TieringPolicy `mapstructure:"tiering,omitempty"`
30+
Snaplock Snaplock
31+
Analytics Analytics
32+
Language string
33+
Aggregates []Aggregate
34+
Autosize Autosize `mapstructure:"autosize,omitempty"`
35+
UUID string
36+
SnapshotLockingEnabled *bool `mapstructure:"snapshot_locking_enabled,omitempty"`
37+
Tags []string `mapstructure:"_tags,omitempty"`
3738
}
3839

3940
// StorageVolumeResourceModel describes the resource data model.
4041
type StorageVolumeResourceModel struct {
41-
Name string `mapstructure:"name,omitempty"`
42-
SVM svm `mapstructure:"svm,omitempty"`
43-
Space Space `mapstructure:"space,omitempty"`
44-
State string `mapstructure:"state,omitempty"`
45-
Type string `mapstructure:"type,omitempty"`
46-
Comment string `mapstructure:"comment,omitempty"`
47-
SpaceGuarantee Guarantee `mapstructure:"guarantee,omitempty"`
48-
NAS NAS `mapstructure:"nas,omitempty"`
49-
QOS QOS `mapstructure:"qos,omitempty"`
50-
Encryption Encryption `mapstructure:"encryption,omitempty"`
51-
Efficiency Efficiency `mapstructure:"efficiency,omitempty"`
52-
SnapshotPolicy SnapshotPolicy `mapstructure:"snapshot_policy,omitempty"`
53-
TieringPolicy TieringPolicy `mapstructure:"tiering,omitempty"`
54-
Snaplock Snaplock `mapstructure:"snaplock,omitempty"`
55-
Analytics Analytics `mapstructure:"analytics,omitempty"`
56-
Language string `mapstructure:"language,omitempty"`
57-
Aggregates []map[string]interface{} `mapstructure:"aggregates,omitempty"`
58-
Autosize Autosize `mapstructure:"autosize,omitempty"`
59-
SnapshotLockingEnabled *bool `mapstructure:"snapshot_locking_enabled,omitempty"`
42+
Name string `mapstructure:"name,omitempty"`
43+
SVM svm `mapstructure:"svm,omitempty"`
44+
Space Space `mapstructure:"space,omitempty"`
45+
State string `mapstructure:"state,omitempty"`
46+
Type string `mapstructure:"type,omitempty"`
47+
Comment string `mapstructure:"comment,omitempty"`
48+
SpaceGuarantee Guarantee `mapstructure:"guarantee,omitempty"`
49+
NAS NAS `mapstructure:"nas,omitempty"`
50+
QOS QOS `mapstructure:"qos,omitempty"`
51+
Encryption Encryption `mapstructure:"encryption,omitempty"`
52+
Efficiency Efficiency `mapstructure:"efficiency,omitempty"`
53+
SnapshotPolicy SnapshotPolicy `mapstructure:"snapshot_policy,omitempty"`
54+
TieringPolicy TieringPolicy `mapstructure:"tiering,omitempty"`
55+
Snaplock Snaplock `mapstructure:"snaplock,omitempty"`
56+
Analytics Analytics `mapstructure:"analytics,omitempty"`
57+
Language string `mapstructure:"language,omitempty"`
58+
Aggregates []map[string]interface{} `mapstructure:"aggregates,omitempty"`
59+
Autosize Autosize `mapstructure:"autosize,omitempty"`
60+
SnapshotLockingEnabled *bool `mapstructure:"snapshot_locking_enabled,omitempty"`
61+
Tags []string `mapstructure:"tags,omitempty"`
6062
}
6163

6264
// Aggregate describes the resource data model.
@@ -102,8 +104,9 @@ type Policy struct {
102104

103105
// TieringPolicy describes the resource data model.
104106
type TieringPolicy struct {
105-
Policy string `mapstructure:"policy,omitempty"`
106-
MinCoolingDays int `mapstructure:"min_cooling_days,omitempty"`
107+
Policy string `mapstructure:"policy,omitempty"`
108+
MinCoolingDays int `mapstructure:"min_cooling_days,omitempty"`
109+
ObjectTags []string `mapstructure:"object_tags,omitempty"`
107110
}
108111

109112
// Snapshot describes the resource data model.
@@ -190,8 +193,10 @@ var POW2BYTEMAP = map[string]int{
190193

191194
// StorageVolumeDataSourceFilterModel describes the data source data model for queries.
192195
type StorageVolumeDataSourceFilterModel struct {
193-
Name string `mapstructure:"name"`
194-
SVMName string `mapstructure:"svm.name"`
196+
Name string `mapstructure:"name"`
197+
SVMName string `mapstructure:"svm.name"`
198+
Tags string `mapstructure:"_tags"`
199+
TieringObjectTags string `mapstructure:"tiering.object_tags"`
195200
}
196201

197202
// GetUUIDVolumeByName get a volumes UUID by volume name
@@ -226,7 +231,7 @@ func GetStorageVolume(errorHandler *utils.ErrorHandler, r restclient.RestClient,
226231
query := r.NewQuery()
227232
query.Fields([]string{"name", "svm.name", "aggregates", "space.size", "state", "type", "nas.export_policy.name", "nas.path", "guarantee.type", "space.snapshot.reserve_percent", "efficiency.dedupe", "efficiency.compaction",
228233
"nas.security_style", "encryption.enabled", "efficiency.policy.name", "nas.unix_permissions", "nas.gid", "nas.uid", "snapshot_policy.name", "language", "qos.policy.name", "snapshot_locking_enabled",
229-
"tiering.policy", "comment", "efficiency.compression", "tiering.min_cooling_days", "space.logical_space.enforcement", "space.logical_space.reporting", "snaplock.type", "analytics.state", "autosize"})
234+
"tiering.policy", "comment", "efficiency.compression", "tiering.min_cooling_days", "tiering.object_tags", "space.logical_space.enforcement", "space.logical_space.reporting", "snaplock.type", "analytics.state", "autosize", "_tags"})
230235
statusCode, response, err := r.GetNilOrOneRecord("storage/volumes/"+uuid, query, nil)
231236
if err != nil {
232237
return nil, errorHandler.MakeAndReportError("error reading volume info", fmt.Sprintf("error on GET storage/volumes: %s", err))
@@ -251,7 +256,7 @@ func GetStorageVolumeByName(errorHandler *utils.ErrorHandler, r restclient.RestC
251256
query.Add("return_records", "true")
252257
query.Fields([]string{"name", "uuid", "svm.name", "aggregates", "space.size", "state", "type", "nas.export_policy.name", "nas.path", "guarantee.type", "space.snapshot.reserve_percent", "efficiency.dedupe", "efficiency.compaction",
253258
"nas.security_style", "encryption.enabled", "efficiency.policy.name", "nas.unix_permissions", "nas.gid", "nas.uid", "snapshot_policy.name", "language", "qos.policy.name", "snapshot_locking_enabled",
254-
"tiering.policy", "comment", "efficiency.compression", "tiering.min_cooling_days", "space.logical_space.enforcement", "space.logical_space.reporting", "snaplock.type", "analytics.state", "autosize"})
259+
"tiering.policy", "comment", "efficiency.compression", "tiering.min_cooling_days", "tiering.object_tags", "space.logical_space.enforcement", "space.logical_space.reporting", "snaplock.type", "analytics.state", "autosize", "_tags"})
255260
statusCode, response, err := r.GetNilOrOneRecord("storage/volumes", query, nil)
256261
if err != nil {
257262
return nil, errorHandler.MakeAndReportError("error reading volume info by name", fmt.Sprintf("error on GET storage/volumes: %s", err))
@@ -278,7 +283,7 @@ func GetStorageVolumes(errorHandler *utils.ErrorHandler, r restclient.RestClient
278283
query := r.NewQuery()
279284
query.Fields([]string{"name", "svm.name", "aggregates", "space.size", "state", "type", "nas.export_policy.name", "nas.path", "guarantee.type", "space.snapshot.reserve_percent", "efficiency.dedupe", "efficiency.compaction",
280285
"nas.security_style", "encryption.enabled", "efficiency.policy.name", "nas.unix_permissions", "nas.gid", "nas.uid", "snapshot_policy.name", "language", "qos.policy.name", "snapshot_locking_enabled",
281-
"tiering.policy", "comment", "efficiency.compression", "tiering.min_cooling_days", "space.logical_space.enforcement", "space.logical_space.reporting", "snaplock.type", "analytics.state", "autosize"})
286+
"tiering.policy", "comment", "efficiency.compression", "tiering.min_cooling_days", "tiering.object_tags", "space.logical_space.enforcement", "space.logical_space.reporting", "snaplock.type", "analytics.state", "autosize", "_tags"})
282287

283288
if filter != nil {
284289
var filterMap map[string]interface{}

0 commit comments

Comments
 (0)