Skip to content

Commit

Permalink
seems to be working
Browse files Browse the repository at this point in the history
  • Loading branch information
Malcolm Morgan committed Jan 16, 2024
1 parent 8070dc3 commit ca5f353
Showing 1 changed file with 48 additions and 14 deletions.
62 changes: 48 additions & 14 deletions internal/services/netapp/netapp_volume_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,22 @@ func resourceNetAppVolume() *pluginsdk.Resource {
}, false),
},

"smb_non_browsable": {
Type: pluginsdk.TypeString,
ForceNew: true,
Optional: true,
Computed: true,
ValidateFunc: validation.StringInSlice(volumes.PossibleValuesForSmbNonBrowsable(), false),
},

"smb_access_based_enumeration": {
Type: pluginsdk.TypeString,
ForceNew: true,
Optional: true,
Computed: true,
ValidateFunc: validation.StringInSlice(volumes.PossibleValuesForSmbAccessBasedEnumeration(), false),
},

"protocols": {
Type: pluginsdk.TypeSet,
ForceNew: true,
Expand Down Expand Up @@ -328,6 +344,20 @@ func resourceNetAppVolumeCreate(d *pluginsdk.ResourceData, meta interface{}) err
}
networkFeatures = volumes.NetworkFeatures(networkFeaturesString)

var smbNonBrowsable volumes.SmbNonBrowsable
smbNonBrowsableString := d.Get("smb_non_browsable").(string)
if smbNonBrowsableString == "" {
smbNonBrowsable = volumes.SmbNonBrowsableDisabled
}
smbNonBrowsable = volumes.SmbNonBrowsable(smbNonBrowsableString)

var smbAccessBasedEnumeration volumes.SmbAccessBasedEnumeration
smbAccessBasedEnumerationString := d.Get("smb_access_based_enumeration").(string)
if smbAccessBasedEnumerationString == "" {
smbAccessBasedEnumeration = volumes.SmbAccessBasedEnumerationDisabled
}
smbAccessBasedEnumeration = volumes.SmbAccessBasedEnumeration(smbAccessBasedEnumerationString)

protocols := d.Get("protocols").(*pluginsdk.Set).List()
if len(protocols) == 0 {
protocols = append(protocols, "NFSv3")
Expand Down Expand Up @@ -438,23 +468,25 @@ func resourceNetAppVolumeCreate(d *pluginsdk.ResourceData, meta interface{}) err

parameters := volumes.Volume{
Location: location,
Properties: volumes.VolumeProperties{
CreationToken: volumePath,
ServiceLevel: &serviceLevel,
SubnetId: subnetID,
NetworkFeatures: &networkFeatures,
ProtocolTypes: utils.ExpandStringSlice(protocols),
SecurityStyle: &securityStyle,
UsageThreshold: storageQuotaInGB,
ExportPolicy: exportPolicyRule,
VolumeType: utils.String(volumeType),
SnapshotId: utils.String(snapshotID),
DataProtection: &volumes.VolumePropertiesDataProtection{
Properties: volumes.VolumeProperties{
CreationToken: volumePath,
ServiceLevel: &serviceLevel,
SubnetId: subnetID,
NetworkFeatures: &networkFeatures,
SmbNonBrowsable: &smbNonBrowsable,
SmbAccessBasedEnumeration: &smbAccessBasedEnumeration,
ProtocolTypes: utils.ExpandStringSlice(protocols),
SecurityStyle: &securityStyle,
UsageThreshold: storageQuotaInGB,
ExportPolicy: exportPolicyRule,
VolumeType: utils.String(volumeType),
SnapshotId: utils.String(snapshotID),
DataProtection: &volumes.VolumePropertiesDataProtection{
Replication: dataProtectionReplication.Replication,
Snapshot: dataProtectionSnapshotPolicy.Snapshot,
},
AvsDataStore: &avsDataStoreEnabled,
SnapshotDirectoryVisible: utils.Bool(snapshotDirectoryVisible),
AvsDataStore: &avsDataStoreEnabled,
SnapshotDirectoryVisible: utils.Bool(snapshotDirectoryVisible),
},
Tags: tags.Expand(d.Get("tags").(map[string]interface{})),
Zones: zones,
Expand Down Expand Up @@ -614,6 +646,8 @@ func resourceNetAppVolumeRead(d *pluginsdk.ResourceData, meta interface{}) error
d.Set("service_level", string(pointer.From(props.ServiceLevel)))
d.Set("subnet_id", props.SubnetId)
d.Set("network_features", string(pointer.From(props.NetworkFeatures)))
d.Set("smb_non_browsable", string(pointer.From(props.SmbNonBrowsable)))
d.Set("smb_access_based_enumeration", string(pointer.From(props.SmbAccessBasedEnumeration)))
d.Set("protocols", props.ProtocolTypes)
d.Set("security_style", string(pointer.From(props.SecurityStyle)))
d.Set("snapshot_directory_visible", props.SnapshotDirectoryVisible)
Expand Down

0 comments on commit ca5f353

Please sign in to comment.