Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions docs/data-sources/volume.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,16 @@ data "netapp-ontap_volume" "storage_volume" {
- `nas` (Attributes) (see [below for nested schema](#nestedatt--nas))
- `qos_policy_group` (String) Specifies a QoS policy group to be set on volume
- `snaplock` (Attributes) (see [below for nested schema](#nestedatt--snaplock))
- `snapshot_locking_enabled` (Boolean) Whether or not snapshot copy locking is enabled on the volume.
- `snapshot_policy` (String) The name of the snapshot policy
- `space` (Attributes) (see [below for nested schema](#nestedatt--space))
- `space_guarantee` (String) Space guarantee style for the volume
- `state` (String) Whether the specified volume is online, or not
- `tags` (Set of String) Set of tags associated with the volume
- `tiering` (Attributes) (see [below for nested schema](#nestedatt--tiering))
- `type` (String) The volume type, either read-write (RW) or data-protection (DP)
- `snapshot_locking_enabled` (Boolean) Whether or not snapshot copy locking is enabled on the volume

<a id="nestedatt--aggregates"></a>

### Nested Schema for `aggregates`

Read-Only:
Expand Down Expand Up @@ -93,10 +93,11 @@ Read-Only:

Read-Only:

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


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

Expand Down Expand Up @@ -146,4 +147,5 @@ Read-Only:
Read-Only:

- `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
- `object_tags` (Set of String) Object tags are applied to objects in tiered storage
- `policy_name` (String) The tiering policy that is to be associated with the volume
18 changes: 13 additions & 5 deletions docs/data-sources/volumes.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ Optional:

- `name` (String) StorageVolume name
- `svm_name` (String) StorageVolume svm name
- `tags` (String) StorageVolume tag value
- `tiering_object_tags` (String) StorageVolume tiering object tag value


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

Expand All @@ -63,7 +66,7 @@ Required:

Read-Only:

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

Expand All @@ -97,8 +102,8 @@ Read-Only:

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

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

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

Read-Only:
Expand All @@ -107,9 +112,9 @@ Read-Only:
- `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.
- `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.
- `mode` (String) Autosize mode for the volume.
grow - Volume automatically grows when the amount of used space is above the 'grow_threshold' value.
grow_shrink - Volume grows or shrinks in response to the amount of space used.
off - Autosizing of the volume is disabled.
grow - Volume automatically grows when the amount of used space is above the 'grow_threshold' value.
grow_shrink - Volume grows or shrinks in response to the amount of space used.
off - Autosizing of the volume is disabled.
- `shrink_threshold` (Number) Used space threshold size, in percentage, for the automatic shrinkage of the volume.
- `size_unit` (String) The unit used to interpret the minimum or maximum size parameters.

Expand All @@ -119,7 +124,9 @@ Read-Only:

Read-Only:

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

<a id="nestedatt--storage_volumes--nas"></a>
Expand Down Expand Up @@ -172,4 +179,5 @@ Read-Only:
Read-Only:

- `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
- `object_tags` (Set of String) Object tags are applied to objects in tiered storage
- `policy_name` (String) The tiering policy that is to be associated with the volume
12 changes: 7 additions & 5 deletions docs/resources/volume.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ resource "netapp-ontap_volume" "example" {

### Required

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

### Read-Only

- `id` (String) Volume identifier

<a id="nestedatt--aggregates"></a>

### Nested Schema for `aggregates`

Required:
Expand Down Expand Up @@ -167,10 +167,11 @@ Optional:

Optional:

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


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

Expand Down Expand Up @@ -200,6 +201,7 @@ Optional:
Optional:

- `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
- `object_tags` (Set of String) Object tags are applied to objects in tiered storage
- `policy_name` (String) The tiering policy that is to be associated with the volume

## Import
Expand Down
97 changes: 51 additions & 46 deletions internal/interfaces/storage_volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,49 +14,51 @@ import (

// StorageVolumeGetDataModelONTAP describes the GET record data model using go types for mapping.
type StorageVolumeGetDataModelONTAP struct {
Name string
SVM svm
Space Space
State string
Type string
Comment string
SpaceGuarantee Guarantee `mapstructure:"guarantee"`
NAS NAS
QOS QOS
Encryption Encryption
Efficiency Efficiency
SnapshotPolicy SnapshotPolicy `mapstructure:"snapshot_policy,omitempty"`
TieringPolicy TieringPolicy `mapstructure:"tiering,omitempty"`
Snaplock Snaplock
Analytics Analytics
Language string
Aggregates []Aggregate
Autosize Autosize `mapstructure:"autosize,omitempty"`
UUID string
SnapshotLockingEnabled *bool `mapstructure:"snapshot_locking_enabled,omitempty"`
Name string
SVM svm
Space Space
State string
Type string
Comment string
SpaceGuarantee Guarantee `mapstructure:"guarantee"`
NAS NAS
QOS QOS
Encryption Encryption
Efficiency Efficiency
SnapshotPolicy SnapshotPolicy `mapstructure:"snapshot_policy,omitempty"`
TieringPolicy TieringPolicy `mapstructure:"tiering,omitempty"`
Snaplock Snaplock
Analytics Analytics
Language string
Aggregates []Aggregate
Autosize Autosize `mapstructure:"autosize,omitempty"`
UUID string
SnapshotLockingEnabled *bool `mapstructure:"snapshot_locking_enabled,omitempty"`
Tags []string `mapstructure:"_tags,omitempty"`
}

// StorageVolumeResourceModel describes the resource data model.
type StorageVolumeResourceModel struct {
Name string `mapstructure:"name,omitempty"`
SVM svm `mapstructure:"svm,omitempty"`
Space Space `mapstructure:"space,omitempty"`
State string `mapstructure:"state,omitempty"`
Type string `mapstructure:"type,omitempty"`
Comment string `mapstructure:"comment,omitempty"`
SpaceGuarantee Guarantee `mapstructure:"guarantee,omitempty"`
NAS NAS `mapstructure:"nas,omitempty"`
QOS QOS `mapstructure:"qos,omitempty"`
Encryption Encryption `mapstructure:"encryption,omitempty"`
Efficiency Efficiency `mapstructure:"efficiency,omitempty"`
SnapshotPolicy SnapshotPolicy `mapstructure:"snapshot_policy,omitempty"`
TieringPolicy TieringPolicy `mapstructure:"tiering,omitempty"`
Snaplock Snaplock `mapstructure:"snaplock,omitempty"`
Analytics Analytics `mapstructure:"analytics,omitempty"`
Language string `mapstructure:"language,omitempty"`
Aggregates []map[string]interface{} `mapstructure:"aggregates,omitempty"`
Autosize Autosize `mapstructure:"autosize,omitempty"`
SnapshotLockingEnabled *bool `mapstructure:"snapshot_locking_enabled,omitempty"`
Name string `mapstructure:"name,omitempty"`
SVM svm `mapstructure:"svm,omitempty"`
Space Space `mapstructure:"space,omitempty"`
State string `mapstructure:"state,omitempty"`
Type string `mapstructure:"type,omitempty"`
Comment string `mapstructure:"comment,omitempty"`
SpaceGuarantee Guarantee `mapstructure:"guarantee,omitempty"`
NAS NAS `mapstructure:"nas,omitempty"`
QOS QOS `mapstructure:"qos,omitempty"`
Encryption Encryption `mapstructure:"encryption,omitempty"`
Efficiency Efficiency `mapstructure:"efficiency,omitempty"`
SnapshotPolicy SnapshotPolicy `mapstructure:"snapshot_policy,omitempty"`
TieringPolicy TieringPolicy `mapstructure:"tiering,omitempty"`
Snaplock Snaplock `mapstructure:"snaplock,omitempty"`
Analytics Analytics `mapstructure:"analytics,omitempty"`
Language string `mapstructure:"language,omitempty"`
Aggregates []map[string]interface{} `mapstructure:"aggregates,omitempty"`
Autosize Autosize `mapstructure:"autosize,omitempty"`
SnapshotLockingEnabled *bool `mapstructure:"snapshot_locking_enabled,omitempty"`
Tags []string `mapstructure:"tags,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mapstructure:"tags,omitempty", this works, but let's change it to '_tags' to match the API reference, unless there is a good reason to use 'tags'

}

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

// TieringPolicy describes the resource data model.
type TieringPolicy struct {
Policy string `mapstructure:"policy,omitempty"`
MinCoolingDays int `mapstructure:"min_cooling_days,omitempty"`
Policy string `mapstructure:"policy,omitempty"`
MinCoolingDays int `mapstructure:"min_cooling_days,omitempty"`
ObjectTags []string `mapstructure:"object_tags,omitempty"`
}

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

// StorageVolumeDataSourceFilterModel describes the data source data model for queries.
type StorageVolumeDataSourceFilterModel struct {
Name string `mapstructure:"name"`
SVMName string `mapstructure:"svm.name"`
Name string `mapstructure:"name"`
SVMName string `mapstructure:"svm.name"`
Tags string `mapstructure:"_tags"`
TieringObjectTags string `mapstructure:"tiering.object_tags"`
}

// GetUUIDVolumeByName get a volumes UUID by volume name
Expand Down Expand Up @@ -226,7 +231,7 @@ func GetStorageVolume(errorHandler *utils.ErrorHandler, r restclient.RestClient,
query := r.NewQuery()
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",
"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",
"tiering.policy", "comment", "efficiency.compression", "tiering.min_cooling_days", "space.logical_space.enforcement", "space.logical_space.reporting", "snaplock.type", "analytics.state", "autosize"})
"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"})
statusCode, response, err := r.GetNilOrOneRecord("storage/volumes/"+uuid, query, nil)
if err != nil {
return nil, errorHandler.MakeAndReportError("error reading volume info", fmt.Sprintf("error on GET storage/volumes: %s", err))
Expand All @@ -251,7 +256,7 @@ func GetStorageVolumeByName(errorHandler *utils.ErrorHandler, r restclient.RestC
query.Add("return_records", "true")
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",
"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",
"tiering.policy", "comment", "efficiency.compression", "tiering.min_cooling_days", "space.logical_space.enforcement", "space.logical_space.reporting", "snaplock.type", "analytics.state", "autosize"})
"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"})
statusCode, response, err := r.GetNilOrOneRecord("storage/volumes", query, nil)
if err != nil {
return nil, errorHandler.MakeAndReportError("error reading volume info by name", fmt.Sprintf("error on GET storage/volumes: %s", err))
Expand All @@ -278,7 +283,7 @@ func GetStorageVolumes(errorHandler *utils.ErrorHandler, r restclient.RestClient
query := r.NewQuery()
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",
"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",
"tiering.policy", "comment", "efficiency.compression", "tiering.min_cooling_days", "space.logical_space.enforcement", "space.logical_space.reporting", "snaplock.type", "analytics.state", "autosize"})
"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"})

if filter != nil {
var filterMap map[string]interface{}
Expand Down
Loading