From 1ef2f66c08b4148707024d0076dd4efe30fa3872 Mon Sep 17 00:00:00 2001 From: AnikaAgiwal2711 Date: Fri, 20 Dec 2024 02:21:55 -0500 Subject: [PATCH 01/10] added file system resource --- powerstore/provider.go | 1 + powerstore/provider_test.go | 1 + powerstore/resource_filesystem.go | 638 +++++++++++++++++++++++++ powerstore/resource_filesystem_test.go | 371 ++++++++++++++ 4 files changed, 1011 insertions(+) create mode 100644 powerstore/resource_filesystem.go create mode 100644 powerstore/resource_filesystem_test.go diff --git a/powerstore/provider.go b/powerstore/provider.go index a6c6dfa0..811343de 100644 --- a/powerstore/provider.go +++ b/powerstore/provider.go @@ -148,6 +148,7 @@ func (p *Pstoreprovider) Resources(ctx context.Context) []func() resource.Resour newHostGroupResource, newVGSnapshotResource, newVolumeSnapshotResource, + newFileSystemResource, } } diff --git a/powerstore/provider_test.go b/powerstore/provider_test.go index 990ce964..7d97815d 100644 --- a/powerstore/provider_test.go +++ b/powerstore/provider_test.go @@ -54,6 +54,7 @@ var volumeGroupSnapshotName = setDefault(os.Getenv("VOLUME_GROUP_SNAPSHOT_NAME") var volumeGroupSnapshotID = setDefault(os.Getenv("VOLUME_GROUP_SNAPSHOT_ID"), "tfacc_volume_group_snapshot_id") var volumeSnapshotID = setDefault(os.Getenv("VOLUME_SNAPSHOT_ID"), "tfacc_volume_snapshot_id") var volumeSnapshotName = setDefault(os.Getenv("VOLUME_SNAPSHOT_NAME"), "tfacc_volume_snapshot_name") +var nasServerID = setDefault(os.Getenv("NAS_SERVER_ID"), "tfacc_nas_server_id") var ProviderConfigForTesting = `` diff --git a/powerstore/resource_filesystem.go b/powerstore/resource_filesystem.go new file mode 100644 index 00000000..e867a632 --- /dev/null +++ b/powerstore/resource_filesystem.go @@ -0,0 +1,638 @@ +/* +Copyright (c) 2024 Dell Inc., or its subsidiaries. All Rights Reserved. + +Licensed under the Mozilla Public License Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://mozilla.org/MPL/2.0/ + + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package powerstore + +import ( + "context" + "fmt" + "log" + client "terraform-provider-powerstore/client" + "terraform-provider-powerstore/models" + + "github.com/dell/gopowerstore" + "github.com/hashicorp/terraform-plugin-framework-validators/int32validator" + "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" + "github.com/hashicorp/terraform-plugin-framework/attr" + "github.com/hashicorp/terraform-plugin-framework/path" + "github.com/hashicorp/terraform-plugin-framework/resource" + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" + "github.com/hashicorp/terraform-plugin-framework/schema/validator" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" +) + +type fileSystemResource struct { + client *client.Client +} + +// Ensure the implementation satisfies the expected interfaces. +var ( + _ resource.Resource = &fileSystemResource{} + _ resource.ResourceWithConfigure = &fileSystemResource{} + _ resource.ResourceWithImportState = &fileSystemResource{} +) + +// newFileSystemResource is a helper function to simplify the provider implementation. +func newFileSystemResource() resource.Resource { + return &fileSystemResource{} +} + +func (r fileSystemResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { + resp.TypeName = req.ProviderTypeName + "_filesystem" +} + +func (r fileSystemResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { + resp.Schema = schema.Schema{ + Description: "This resource is used to manage the file system entity of PowerStore Array. We can Create, Update and Delete the file system using this resource. We can also import an existing file system from PowerStore array.", + MarkdownDescription: "This resource is used to manage the file system entity of PowerStore Array. We can Create, Update and Delete the file system using this resource. We can also import an existing file system from PowerStore array.", + Attributes: map[string]schema.Attribute{ + "id": schema.StringAttribute{ + Description: "Unique identifier of the file system.", + MarkdownDescription: "Unique identifier of the file system.", + Computed: true, + }, + "name": schema.StringAttribute{ + Description: "Name of the file system.", + MarkdownDescription: "Name of the file system.", + Required: true, + }, + "description": schema.StringAttribute{ + Description: "File system description.", + MarkdownDescription: "File system description.", + Optional: true, + Computed: true, + }, + "size": schema.Float64Attribute{ + Description: "Size that the file system presents to the host or end user.", + MarkdownDescription: "Size that the file system presents to the host or end user.", + Required: true, + }, + "capacity_unit": schema.StringAttribute{ + Description: "The Capacity Unit corresponding to the size.", + MarkdownDescription: "The Capacity Unit corresponding to the size.", + Computed: true, + Optional: true, + PlanModifiers: []planmodifier.String{ + DefaultAttribute("GB"), + }, + Validators: []validator.String{ + stringvalidator.OneOf([]string{ + "MB", + "GB", + "TB", + }...), + }, + }, + "nas_server_id": schema.StringAttribute{ + Description: "Unique identifier of the NAS Server on which the file system is mounted.", + MarkdownDescription: "Unique identifier of the NAS Server on which the file system is mounted.", + Required: true, + }, + "config_type": schema.StringAttribute{ + Optional: true, + Computed: true, + Description: "File system security access policies.", + MarkdownDescription: "File system security access policies.", + PlanModifiers: []planmodifier.String{ + DefaultAttribute("General"), + }, + Validators: []validator.String{ + stringvalidator.OneOf([]string{ + "General", + "VMware", + }...), + }, + }, + "access_policy": schema.StringAttribute{ + Optional: true, + Computed: true, + Description: "File system security access policies.", + MarkdownDescription: "File system security access policies.", + PlanModifiers: []planmodifier.String{ + DefaultAttribute("Native"), + }, + Validators: []validator.String{ + stringvalidator.OneOf([]string{ + "Native", + "UNIX", + "Windows", + }...), + }, + }, + + "locking_policy": schema.StringAttribute{ + Optional: true, + Computed: true, + Description: "File system locking policies.", + MarkdownDescription: "File system locking policies.", + PlanModifiers: []planmodifier.String{ + DefaultAttribute("Advisory"), + }, + Validators: []validator.String{ + stringvalidator.OneOf([]string{ + "Advisory", + "Mandatory", + }...), + }, + }, + "folder_rename_policy": schema.StringAttribute{ + Optional: true, + Computed: true, + Description: "File system folder rename policies for the file system with multiprotocol access enabled.", + MarkdownDescription: "File system folder rename policies for the file system with multiprotocol access enabled.", + PlanModifiers: []planmodifier.String{ + DefaultAttribute("All_Forbidden"), + }, + Validators: []validator.String{ + stringvalidator.OneOf([]string{ + "All_Allowed", + "SMB_Forbidden", + "All_Forbidden", + }...), + }, + }, + "is_smb_sync_writes_enabled": schema.BoolAttribute{ + Computed: true, + Optional: true, + Description: "Indicates whether the synchronous writes option is enabled on the file system.", + MarkdownDescription: "Indicates whether the synchronous writes option is enabled on the file system.", + }, + "is_smb_no_notify_enabled": schema.BoolAttribute{ + Computed: true, + Optional: true, + Description: "Indicates whether notifications of changes to directory file structure are enabled.", + MarkdownDescription: "Indicates whether notifications of changes to directory file structure are enabled.", + }, + "is_smb_op_locks_enabled": schema.BoolAttribute{ + Optional: true, + Computed: true, + Description: "Indicates whether opportunistic file locking is enabled on the file system.", + MarkdownDescription: "Indicates whether opportunistic file locking is enabled on the file system.", + }, + "is_smb_notify_on_access_enabled": schema.BoolAttribute{ + Optional: true, + Computed: true, + Description: "Indicates whether file access notifications are enabled on the file system.", + MarkdownDescription: "Indicates whether file access notifications are enabled on the file system.", + }, + "is_smb_notify_on_write_enabled": schema.BoolAttribute{ + Optional: true, + Computed: true, + Description: "Indicates whether file writes notifications are enabled on the file system.", + MarkdownDescription: "Indicates whether file writes notifications are enabled on the file system.", + }, + "smb_notify_on_change_dir_depth": schema.Int32Attribute{ + Computed: true, + Optional: true, + Description: "Lowest directory level to which the enabled notifications apply, if any.", + MarkdownDescription: "Lowest directory level to which the enabled notifications apply, if any.", + Validators: []validator.Int32{ + int32validator.AtLeast(1), + int32validator.AtMost(512), + }, + }, + "is_async_mtime_enabled": schema.BoolAttribute{ + Computed: true, + Optional: true, + Description: "Indicates whether asynchronous MTIME is enabled on the file system or protocol snaps that are mounted writeable.", + MarkdownDescription: "Indicates whether asynchronous MTIME is enabled on the file system or protocol snaps that are mounted writeable.", + }, + "protection_policy_id": schema.StringAttribute{ + Computed: true, + Optional: true, + Description: "Unique identifier of the protection policy applied to the file system.", + MarkdownDescription: "Unique identifier of the protection policy applied to the file system.", + }, + "file_events_publishing_mode": schema.StringAttribute{ + Optional: true, + Computed: true, + Description: "State of the event notification services for all file systems of the NAS server.", + MarkdownDescription: "State of the event notification services for all file systems of the NAS server.", + PlanModifiers: []planmodifier.String{ + DefaultAttribute("None"), + }, + Validators: []validator.String{ + stringvalidator.OneOf([]string{ + "None", + "SMB_Only", + "NFS_Only", + "All", + }...), + }, + }, + "host_io_size": schema.StringAttribute{ + Computed: true, + Optional: true, + Description: "Typical size of writes from the server or other computer using the VMware file system to the storage system.", + MarkdownDescription: "Typical size of writes from the server or other computer using the VMware file system to the storage system.", + Validators: []validator.String{ + stringvalidator.OneOf([]string{ + "VMware_8K", + "VMware_16K", + "VMware_32K", + "Vmware_64K", + }...), + }, + }, + "file_system_type": schema.StringAttribute{ + Computed: true, + Description: "Type of filesystem: normal or snapshot.", + MarkdownDescription: "Type of filesystem: normal or snapshot.", + }, + "flr_attributes": schema.SingleNestedAttribute{ + Optional: true, + Computed: true, + Description: "Type of filesystem: normal or snapshot.", + MarkdownDescription: "Type of filesystem: normal or snapshot.", + Attributes: map[string]schema.Attribute{ + "mode": schema.StringAttribute{ + Description: "The FLR type of the file system.", + MarkdownDescription: "The FLR type of the file system.", + Optional: true, + Computed: true, + }, + }, + }, + "parent_id": schema.StringAttribute{ + Computed: true, + Description: "Unique identifier of the parent filesystem.", + MarkdownDescription: "Unique identifier of the parent filesystem.", + }, + }, + } +} + +// Configure - defines configuration for file system resource. +func (r *fileSystemResource) Configure(_ context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { + if req.ProviderData == nil { + return + } + client, ok := req.ProviderData.(*client.Client) + if !ok { + resp.Diagnostics.AddError( + "Unexpected Resource Configure Type", + fmt.Sprintf("Expected *client.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + ) + + return + } + + r.client = client +} + +// Create - method to create file system resource +func (r fileSystemResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + + var valInBytes int64 + + log.Printf("Started Creating file system") + var plan models.FileSystem + + diags := req.Plan.Get(ctx, &plan) + resp.Diagnostics.Append(diags...) + if resp.Diagnostics.HasError() { + return + } + + valInBytes, errmsg := convertToBytesForFileSystem(plan) + if errmsg != "" { + resp.Diagnostics.AddError( + "Error creating file system", + "Could not create file system "+errmsg, + ) + return + } + + var FlrCreate models.FlrAttributes + if !plan.FlrAttributes.IsUnknown() { + plan.FlrAttributes.As(ctx, &FlrCreate, basetypes.ObjectAsOptions{UnhandledNullAsEmpty: true, UnhandledUnknownAsEmpty: true}) + } + + fileSystemCreate := &gopowerstore.FsCreate{ + Name: plan.Name.ValueString(), + Description: plan.Description.ValueString(), + Size: valInBytes, + NASServerID: plan.NASServerID.ValueString(), + ConfigType: plan.ConfigType.ValueString(), + AccessPolicy: plan.AccessPolicy.ValueString(), + LockingPolicy: plan.LockingPolicy.ValueString(), + FolderRenamePolicy: plan.FolderRenamePolicy.ValueString(), + IsAsyncMTimeEnabled: GetKnownBoolPointer(plan.IsAsyncMTimeEnabled), + ProtectionPolicyID: plan.ProtectionPolicyID.ValueString(), + FileEventsPublishingMode: plan.FileEventsPublishingMode.ValueString(), + HostIOSize: plan.HostIOSize.ValueString(), + IsSmbSyncWritesEnabled: GetKnownBoolPointer(plan.IsSmbSyncWritesEnabled), + IsSmbNoNotifyEnabled: GetKnownBoolPointer(plan.IsSmbNoNotifyEnabled), + IsSmbOpLocksEnabled: GetKnownBoolPointer(plan.IsSmbOpLocksEnabled), + IsSmbNotifyOnAccessEnabled: GetKnownBoolPointer(plan.IsSmbNotifyOnAccessEnabled), + IsSmbNotifyOnWriteEnabled: GetKnownBoolPointer(plan.IsSmbNotifyOnWriteEnabled), + SmbNotifyOnChangeDirDepth: plan.SmbNotifyOnChangeDirDepth.ValueInt32(), + FlrCreate: gopowerstore.FlrAttributes{ + Mode: FlrCreate.Mode.ValueString(), + }, + } + + // Create New FileSystem + fsCreateResponse, err := r.client.PStoreClient.CreateFS(context.Background(), fileSystemCreate) + if err != nil { + resp.Diagnostics.AddError( + "Error creating file system", + "Could not create file system, unexpected error: "+err.Error(), + ) + return + } + + // Get file system Details using ID retrieved above + fsResponse, err1 := r.client.PStoreClient.GetFS(context.Background(), fsCreateResponse.ID) + if err1 != nil { + resp.Diagnostics.AddError( + "Error getting file system after creation", + "Could not get file system, unexpected error: "+err1.Error(), + ) + return + } + + result := models.FileSystem{} + updateFsState(&result, fsResponse) + + log.Printf("Added to result: %v", result) + + diags = resp.State.Set(ctx, result) + resp.Diagnostics.Append(diags...) + if resp.Diagnostics.HasError() { + return + } + log.Printf("Done with Create") +} + +// Read - reads file system resource +func (r fileSystemResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + var state models.FileSystem + diags := req.State.Get(ctx, &state) + resp.Diagnostics.Append(diags...) + if resp.Diagnostics.HasError() { + return + } + + // Get file system details from API and then update what is in state from what the API returns + fsID := state.ID.ValueString() + fsResponse, err := r.client.PStoreClient.GetFS(context.Background(), fsID) + + if err != nil { + resp.Diagnostics.AddError( + "Error reading file system", + "Could not read file system with error "+fsID+": "+err.Error(), + ) + return + } + + updateFsState(&state, fsResponse) + + // Set state + diags = resp.State.Set(ctx, &state) + resp.Diagnostics.Append(diags...) + if resp.Diagnostics.HasError() { + return + } + log.Printf("Done with Read") +} + +// Update - updates file system resource +func (r fileSystemResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + log.Printf("Started Update") + + // Get plan values + var plan models.FileSystem + diags := req.Plan.Get(ctx, &plan) + resp.Diagnostics.Append(diags...) + if resp.Diagnostics.HasError() { + return + } + + // Get current state + var state models.FileSystem + diags = req.State.Get(ctx, &state) + resp.Diagnostics.Append(diags...) + if resp.Diagnostics.HasError() { + return + } + + if plan.Name.ValueString() != state.Name.ValueString(){ + resp.Diagnostics.AddError( + "Error updating file system", + "Name of the file system can't be updated", + ) + return + } + + if plan.NASServerID.ValueString() != state.NASServerID.ValueString(){ + resp.Diagnostics.AddError( + "Error updating file system", + "NAS server ID can't be updated", + ) + return + } + + if plan.HostIOSize.ValueString() != state.HostIOSize.ValueString(){ + resp.Diagnostics.AddError( + "Error updating file system", + "Host IO size can't be updated", + ) + return + } + if plan.ConfigType.ValueString() != state.ConfigType.ValueString(){ + resp.Diagnostics.AddError( + "Error updating file system", + "Config type can't be updated", + ) + return + } + + + var FlrCreate models.FlrAttributes + plan.FlrAttributes.As(ctx, &FlrCreate, basetypes.ObjectAsOptions{UnhandledNullAsEmpty: true, UnhandledUnknownAsEmpty: true}) + + var FlrCreateState models.FlrAttributes + state.FlrAttributes.As(ctx, &FlrCreateState, basetypes.ObjectAsOptions{UnhandledNullAsEmpty: true, UnhandledUnknownAsEmpty: true}) + + if FlrCreate.Mode.ValueString() != FlrCreateState.Mode.ValueString() { + resp.Diagnostics.AddError( + "Error updating file system", + "Mode of the flr attributes can't be updated", + ) + return + } + + valInBytes, errmsg := convertToBytesForFileSystem(plan) + if errmsg != "" { + resp.Diagnostics.AddError( + "Error updating file system", + "Could not update file system "+errmsg, + ) + return + } + + fsModify := &gopowerstore.FSModify{ + Description: plan.Description.ValueString(), + Size: int(valInBytes), + AccessPolicy: plan.AccessPolicy.ValueString(), + LockingPolicy: plan.LockingPolicy.ValueString(), + FolderRenamePolicy: plan.FolderRenamePolicy.ValueString(), + IsAsyncMtimeEnabled: GetKnownBoolPointer(plan.IsAsyncMTimeEnabled), + ProtectionPolicyId: plan.ProtectionPolicyID.ValueString(), + FileEventsPublishingMode: plan.FileEventsPublishingMode.ValueString(), + IsSmbSyncWritesEnabled: GetKnownBoolPointer(plan.IsSmbSyncWritesEnabled), + IsSmbNoNotifyEnabled: GetKnownBoolPointer(plan.IsSmbNoNotifyEnabled), + IsSmbOpLocksEnabled: GetKnownBoolPointer(plan.IsSmbOpLocksEnabled), + IsSmbNotifyOnAccessEnabled: GetKnownBoolPointer(plan.IsSmbNotifyOnAccessEnabled), + IsSmbNotifyOnWriteEnabled: GetKnownBoolPointer(plan.IsSmbNotifyOnWriteEnabled), + SmbNotifyOnChangeDirDepth: plan.SmbNotifyOnChangeDirDepth.ValueInt32(), + } + + _, err := r.client.PStoreClient.ModifyFS(context.Background(), fsModify, state.ID.ValueString()) + if err != nil { + resp.Diagnostics.AddError( + "Error updating file system", + "Could not update file system "+err.Error(), + ) + return + } + + fsResponse, err1 := r.client.PStoreClient.GetFS(context.Background(), state.ID.ValueString()) + if err1 != nil { + resp.Diagnostics.AddError( + "Error getting file system after creation", + "Could not get file system, unexpected error: "+err1.Error(), + ) + return + } + + updateFsState(&state, fsResponse) + + //Set State + diags = resp.State.Set(ctx, &state) + resp.Diagnostics.Append(diags...) + if resp.Diagnostics.HasError() { + return + } + + log.Printf("Done with Update") +} + +// Delete - method to delete file system resource +func (r fileSystemResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + log.Printf("Started with Delete") + + var state models.FileSystem + diags := req.State.Get(ctx, &state) + resp.Diagnostics.Append(diags...) + if resp.Diagnostics.HasError() { + return + } + + // Get vg ID from state + fsID := state.ID.ValueString() + + // Delete file system by calling API + _, err := r.client.PStoreClient.DeleteFS(context.Background(), fsID) + if err != nil { + resp.Diagnostics.AddError( + "Error deleting file system", + "Could not delete file system "+fsID+": "+err.Error(), + ) + return + } + + // Remove resource from state + resp.State.RemoveResource(ctx) + log.Printf("Done with Delete") +} + +// ImportState import state for existing file system +func (r fileSystemResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) +} + +func convertToBytesForFileSystem(plan models.FileSystem) (int64, string) { + var valInBytes float64 + switch plan.CapacityUnit.ValueString() { + case "MB": + valInBytes = plan.Size.ValueFloat64() * MiB + case "TB": + valInBytes = plan.Size.ValueFloat64() * TiB + case "GB": + valInBytes = plan.Size.ValueFloat64() * GiB + default: + return 0, "Invalid Capacity unit" + } + return int64(valInBytes), "" +} + +func convertFromBytesForFileSystem(bytes int64) (float64, string) { + var newSize float64 + var unit int + var units = []string{"KB", "MB", "GB", "TB"} + for newSize = float64(bytes); newSize >= 1024 && unit < len(units); unit++ { + newSize = newSize / 1024 + } + if unit > 0 { + return newSize, units[unit-1] + } + return newSize, units[unit] +} + +func updateFsState(fsState *models.FileSystem, fsResponse gopowerstore.FileSystem) { + // Update value from file system Response to State + fsState.ID = types.StringValue(fsResponse.ID) + fsState.Name = types.StringValue(fsResponse.Name) + fsState.Description = types.StringValue(fsResponse.Description) + fsState.NASServerID = types.StringValue(fsResponse.NasServerID) + size, unit := convertFromBytesForFileSystem(fsResponse.SizeTotal) + fsState.Size = types.Float64Value(size) + fsState.CapacityUnit = types.StringValue(unit) + fsState.ConfigType = types.StringValue(fsResponse.ConfigType) + fsState.AccessPolicy = types.StringValue(fsResponse.AccessPolicy) + fsState.LockingPolicy = types.StringValue(fsResponse.LockingPolicy) + fsState.FolderRenamePolicy = types.StringValue(fsResponse.FolderRenamePolicy) + fsState.IsAsyncMTimeEnabled = types.BoolValue(fsResponse.IsAsyncMTimeEnabled) + fsState.ProtectionPolicyID = types.StringValue(fsResponse.ProtectionPolicyID) + fsState.FileEventsPublishingMode = types.StringValue(fsResponse.FileEventsPublishingMode) + fsState.HostIOSize = types.StringValue(fsResponse.HostIOSize) + fsState.IsSmbSyncWritesEnabled = types.BoolValue(fsResponse.IsSmbSyncWritesEnabled) + fsState.IsSmbNoNotifyEnabled = types.BoolValue(fsResponse.IsSmbNoNotifyEnabled) + fsState.IsSmbOpLocksEnabled = types.BoolValue(fsResponse.IsSmbOpLocksEnabled) + fsState.IsSmbNotifyOnAccessEnabled = types.BoolValue(fsResponse.IsSmbNotifyOnAccessEnabled) + fsState.IsSmbNotifyOnWriteEnabled = types.BoolValue(fsResponse.IsSmbNotifyOnWriteEnabled) + fsState.SmbNotifyOnChangeDirDepth = types.Int32Value(fsResponse.SmbNotifyOnChangeDirDepth) + fsState.ParentID = types.StringValue(fsResponse.ParentID) + fsState.FilesystemType = types.StringValue(string(fsResponse.FilesystemType)) + fsState.FlrAttributes, _ = types.ObjectValue(map[string]attr.Type{ + "mode": types.StringType, + }, map[string]attr.Value{ + "mode": types.StringValue(fsResponse.FlrCreate.Mode), + }) + +} + +func GetKnownBoolPointer(in types.Bool) *bool { + if in.IsUnknown() { + return nil + } + return in.ValueBoolPointer() +} diff --git a/powerstore/resource_filesystem_test.go b/powerstore/resource_filesystem_test.go new file mode 100644 index 00000000..d4f35b1e --- /dev/null +++ b/powerstore/resource_filesystem_test.go @@ -0,0 +1,371 @@ +/* +Copyright (c) 2024 Dell Inc., or its subsidiaries. All Rights Reserved. + +Licensed under the Mozilla Public License Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://mozilla.org/MPL/2.0/ + + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package powerstore + +import ( + "os" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/stretchr/testify/assert" + "regexp" +) + +func TestAccFileSystem_CreateFS(t *testing.T) { + if os.Getenv("TF_ACC") == "" { + t.Skip("Dont run with units tests because it will try to create the context") + } + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testProviderFactory, + Steps: []resource.TestStep{ + { + Config: ProviderConfigForTesting + FsParams, + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr("powerstore_filesystem.test_fs_create", "name", "test_fs"), + resource.TestCheckResourceAttr("powerstore_filesystem.test_fs_create", "size", "5"), + ), + }, + + // Import Testing + { + Config: ProviderConfigForTesting + FsParams, + ResourceName: "powerstore_filesystem.test_fs_create", + ImportState: true, + ExpectError: nil, + ImportStateCheck: func(s []*terraform.InstanceState) error { + assert.Equal(t, "test_fs", s[0].Attributes["name"]) + return nil + }, + }, + }, + }) +} + +func TestAccFileSystem_InvalidUpdate(t *testing.T) { + if os.Getenv("TF_ACC") == "" { + t.Skip("Dont run with units tests because it will try to create the context") + } + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testProviderFactory, + Steps: []resource.TestStep{ + { + Config: ProviderConfigForTesting + FsParams, + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr("powerstore_filesystem.test_fs_create", "name", "test_fs"), + resource.TestCheckResourceAttr("powerstore_filesystem.test_fs_create", "size", "5"), + ), + }, + { + Config: ProviderConfigForTesting + FsParamsUpdate, + ExpectError: regexp.MustCompile(".*Name of the file system can't be updated.*"), + }, + { + Config: ProviderConfigForTesting + FsParamsUpdate2, + ExpectError: regexp.MustCompile(".*NAS server ID can't be updated.*"), + }, + { + Config: ProviderConfigForTesting + FsParamsUpdate3, + ExpectError: regexp.MustCompile(".*Mode of the flr attributes can't be updated.*"), + }, + { + Config: ProviderConfigForTesting + FsParamsUpdate4, + ExpectError: regexp.MustCompile(".*Config type can't be updated.*"), + }, + { + Config: ProviderConfigForTesting + FsParamsUpdate5, + ExpectError: regexp.MustCompile(".*Host IO size can't be updated.*"), + }, + }, + }) +} + +func TestAccFileSystem_Update(t *testing.T) { + if os.Getenv("TF_ACC") == "" { + t.Skip("Dont run with units tests because it will try to create the context") + } + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testProviderFactory, + Steps: []resource.TestStep{ + { + Config: ProviderConfigForTesting + FsParams, + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr("powerstore_filesystem.test_fs_create", "name", "test_fs"), + resource.TestCheckResourceAttr("powerstore_filesystem.test_fs_create", "size", "5"), + ), + }, + { + Config: ProviderConfigForTesting + FsParamsValidUpdate, + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr("powerstore_filesystem.test_fs_create", "description", "testing file system Update"), + ), + }, + }, + }) +} + +func TestAccFileSystem_CreateErr(t *testing.T) { + if os.Getenv("TF_ACC") == "" { + t.Skip("Dont run with units tests because it will try to create the context") + } + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testProviderFactory, + Steps: []resource.TestStep{ + { + Config: ProviderConfigForTesting + FsParamsCreateErr, + ExpectError: regexp.MustCompile(".*Error creating file system.*"), + }, + { + Config: ProviderConfigForTesting + FsParams, + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr("powerstore_filesystem.test_fs_create", "name", "test_fs"), + resource.TestCheckResourceAttr("powerstore_filesystem.test_fs_create", "size", "5"), + ), + }, + { + Config: ProviderConfigForTesting + FsParamsModifyErr, + ExpectError: regexp.MustCompile(".*Error updating file system.*"), + }, + }, + }) +} + + +var FsParams = ` +resource "powerstore_filesystem" "test_fs_create" { + name = "test_fs" + description = "testing file system" + size = 5 + nas_server_id = "` + nasServerID + `" + flr_attributes = { + mode = "Enterprise" + } + config_type = "General" + access_policy = "UNIX" + locking_policy = "Advisory" + folder_rename_policy = "All_Allowed" + is_smb_sync_writes_enabled = true + is_smb_no_notify_enabled = true + is_smb_op_locks_enabled = false + is_smb_notify_on_access_enabled = true + is_smb_notify_on_write_enabled = true + smb_notify_on_change_dir_depth = 12 + is_async_mtime_enabled = true + file_events_publishing_mode = "All" +} +` + +var FsParamsUpdate = ` +resource "powerstore_filesystem" "test_fs_create" { + name = "test_fs_rename" + description = "testing file system" + size = 5 + nas_server_id = "` + nasServerID + `" + flr_attributes = { + mode = "Enterprise" + } + config_type = "General" + access_policy = "UNIX" + locking_policy = "Advisory" + folder_rename_policy = "All_Allowed" + is_smb_sync_writes_enabled = false + is_smb_no_notify_enabled = false + is_smb_op_locks_enabled = false + is_smb_notify_on_access_enabled = true + is_smb_notify_on_write_enabled = true + smb_notify_on_change_dir_depth = 12 + is_async_mtime_enabled = false + file_events_publishing_mode = "All" +} +` + +var FsParamsUpdate2 = ` +resource "powerstore_filesystem" "test_fs_create" { + name = "test_fs" + description = "testing file system update" + size = 5 + nas_server_id = "Id Updated" + flr_attributes = { + mode = "Enterprise" + } + config_type = "General" + access_policy = "UNIX" + locking_policy = "Advisory" + folder_rename_policy = "All_Allowed" + is_smb_sync_writes_enabled = false + is_smb_no_notify_enabled = false + is_smb_op_locks_enabled = false + is_smb_notify_on_access_enabled = true + is_smb_notify_on_write_enabled = true + smb_notify_on_change_dir_depth = 12 + is_async_mtime_enabled = false + file_events_publishing_mode = "All" +} +` + +var FsParamsUpdate3 = ` +resource "powerstore_filesystem" "test_fs_create" { + name = "test_fs" + description = "testing file system update" + size = 5 + nas_server_id = "` + nasServerID + `" + flr_attributes = { + mode = "None" + } + config_type = "General" + access_policy = "UNIX" + locking_policy = "Advisory" + folder_rename_policy = "All_Allowed" + is_smb_sync_writes_enabled = false + is_smb_no_notify_enabled = false + is_smb_op_locks_enabled = false + is_smb_notify_on_access_enabled = true + is_smb_notify_on_write_enabled = true + smb_notify_on_change_dir_depth = 12 + is_async_mtime_enabled = false + file_events_publishing_mode = "All" +} +` + +var FsParamsUpdate4 = ` +resource "powerstore_filesystem" "test_fs_create" { + name = "test_fs" + description = "testing file system update" + size = 5 + nas_server_id = "` + nasServerID + `" + flr_attributes = { + mode = "Enterprise" + } + config_type = "VMware" + access_policy = "UNIX" + locking_policy = "Advisory" + folder_rename_policy = "All_Allowed" + is_smb_sync_writes_enabled = false + is_smb_no_notify_enabled = false + is_smb_op_locks_enabled = false + is_smb_notify_on_access_enabled = true + is_smb_notify_on_write_enabled = true + smb_notify_on_change_dir_depth = 12 + is_async_mtime_enabled = false + file_events_publishing_mode = "All" +} +` + +var FsParamsUpdate5 = ` +resource "powerstore_filesystem" "test_fs_create" { + name = "test_fs" + description = "testing file system update" + size = 5 + nas_server_id = "` + nasServerID + `" + flr_attributes = { + mode = "Enterprise" + } + config_type = "General" + access_policy = "UNIX" + locking_policy = "Advisory" + folder_rename_policy = "All_Allowed" + is_smb_sync_writes_enabled = false + is_smb_no_notify_enabled = false + is_smb_op_locks_enabled = false + is_smb_notify_on_access_enabled = true + is_smb_notify_on_write_enabled = true + smb_notify_on_change_dir_depth = 12 + is_async_mtime_enabled = false + file_events_publishing_mode = "All" + host_io_size = "VMware_8K" +} +` + +var FsParamsValidUpdate = ` +resource "powerstore_filesystem" "test_fs_create" { + name = "test_fs" + description = "testing file system Update" + size = 4 + nas_server_id = "` + nasServerID + `" + flr_attributes = { + mode = "Enterprise" + } + config_type = "General" + access_policy = "UNIX" + locking_policy = "Advisory" + folder_rename_policy = "All_Allowed" + is_smb_sync_writes_enabled = false + is_smb_no_notify_enabled = false + is_smb_op_locks_enabled = true + is_smb_notify_on_access_enabled = false + is_smb_notify_on_write_enabled = false + smb_notify_on_change_dir_depth = 12 + is_async_mtime_enabled = false + file_events_publishing_mode = "All" +} +` + +var FsParamsCreateErr = ` +resource "powerstore_filesystem" "test_fs_create" { + name = "test_fs" + description = "testing file system" + size = 5 + nas_server_id = "` + nasServerID + `" + flr_attributes = { + mode = "Enterprise" + } + config_type = "VMware" + access_policy = "UNIX" + locking_policy = "Advisory" + folder_rename_policy = "All_Allowed" + is_smb_sync_writes_enabled = true + is_smb_no_notify_enabled = true + is_smb_op_locks_enabled = false + is_smb_notify_on_access_enabled = true + is_smb_notify_on_write_enabled = true + smb_notify_on_change_dir_depth = 12 + is_async_mtime_enabled = true + file_events_publishing_mode = "All" +} +` + +var FsParamsModifyErr= ` +resource "powerstore_filesystem" "test_fs_create" { + name = "test_fs" + description = "testing file system" + size = 1 + nas_server_id = "` + nasServerID + `" + flr_attributes = { + mode = "Enterprise" + } + config_type = "General" + access_policy = "UNIX" + locking_policy = "Advisory" + folder_rename_policy = "All_Allowed" + is_smb_sync_writes_enabled = true + is_smb_no_notify_enabled = true + is_smb_op_locks_enabled = false + is_smb_notify_on_access_enabled = true + is_smb_notify_on_write_enabled = true + smb_notify_on_change_dir_depth = 12 + is_async_mtime_enabled = true + file_events_publishing_mode = "All" +} +` \ No newline at end of file From 6a205464799e500d8445057b91bac2f001f9de3d Mon Sep 17 00:00:00 2001 From: AnikaAgiwal2711 Date: Fri, 20 Dec 2024 05:15:49 -0500 Subject: [PATCH 02/10] updated go mod --- client/client.go | 2 +- docs/resources/filesystem.md | 80 +++++++++++++++++++ .../resources/powerstore_filesystem/import.sh | 26 ++++++ .../powerstore_filesystem/provider.tf | 33 ++++++++ .../powerstore_filesystem/resource.tf | 42 ++++++++++ .../powerstore_filesystem/variables.tf | 36 +++++++++ go.mod | 15 ++-- go.sum | 57 +++---------- models/filesystem.go | 51 ++++++++++++ powerstore/resource_filesystem.go | 2 +- 10 files changed, 290 insertions(+), 54 deletions(-) create mode 100644 docs/resources/filesystem.md create mode 100644 examples/resources/powerstore_filesystem/import.sh create mode 100644 examples/resources/powerstore_filesystem/provider.tf create mode 100644 examples/resources/powerstore_filesystem/resource.tf create mode 100644 examples/resources/powerstore_filesystem/variables.tf create mode 100644 models/filesystem.go diff --git a/client/client.go b/client/client.go index 1800763e..74d78a5c 100644 --- a/client/client.go +++ b/client/client.go @@ -38,7 +38,7 @@ func NewClient(endpoint string, username string, password string, insecure bool, if timeout == 0 { timeout = int64(clientOptions.DefaultTimeout()) } - clientOptions.SetDefaultTimeout(uint64(timeout)) + clientOptions.SetDefaultTimeout(int64(timeout)) pstoreClient, err := newClientWithArgs(endpoint, username, password, clientOptions) if err != nil { diff --git a/docs/resources/filesystem.md b/docs/resources/filesystem.md new file mode 100644 index 00000000..3c29a2fb --- /dev/null +++ b/docs/resources/filesystem.md @@ -0,0 +1,80 @@ +--- +# Copyright (c) 2024 Dell Inc., or its subsidiaries. All Rights Reserved. +# +# Licensed under the Mozilla Public License Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://mozilla.org/MPL/2.0/ +# +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +title: "powerstore_filesystem resource" +linkTitle: "powerstore_filesystem" +page_title: "powerstore_filesystem Resource - powerstore" +subcategory: "" +description: |- + This resource is used to manage the file system entity of PowerStore Array. We can Create, Update and Delete the file system using this resource. We can also import an existing file system from PowerStore array. +--- + +# powerstore_filesystem (Resource) + +This resource is used to manage the file system entity of PowerStore Array. We can Create, Update and Delete the file system using this resource. We can also import an existing file system from PowerStore array. + + +## Example Usage + +{{tffile "/root/newworkspace2/terraform-provider-powerstore/examples/resources/powerstore_filesystem/resource.tf"}} + + +## Schema + +### Required + +- `name` (String) Name of the file system. +- `nas_server_id` (String) Unique identifier of the NAS Server on which the file system is mounted. +- `size` (Number) Size that the file system presents to the host or end user. + +### Optional + +- `access_policy` (String) File system security access policies. +- `capacity_unit` (String) The Capacity Unit corresponding to the size. +- `config_type` (String) File system security access policies. +- `description` (String) File system description. +- `file_events_publishing_mode` (String) State of the event notification services for all file systems of the NAS server. +- `flr_attributes` (Attributes) Type of filesystem: normal or snapshot. (see [below for nested schema](#nestedatt--flr_attributes)) +- `folder_rename_policy` (String) File system folder rename policies for the file system with multiprotocol access enabled. +- `host_io_size` (String) Typical size of writes from the server or other computer using the VMware file system to the storage system. +- `is_async_mtime_enabled` (Boolean) Indicates whether asynchronous MTIME is enabled on the file system or protocol snaps that are mounted writeable. +- `is_smb_no_notify_enabled` (Boolean) Indicates whether notifications of changes to directory file structure are enabled. +- `is_smb_notify_on_access_enabled` (Boolean) Indicates whether file access notifications are enabled on the file system. +- `is_smb_notify_on_write_enabled` (Boolean) Indicates whether file writes notifications are enabled on the file system. +- `is_smb_op_locks_enabled` (Boolean) Indicates whether opportunistic file locking is enabled on the file system. +- `is_smb_sync_writes_enabled` (Boolean) Indicates whether the synchronous writes option is enabled on the file system. +- `locking_policy` (String) File system locking policies. +- `protection_policy_id` (String) Unique identifier of the protection policy applied to the file system. +- `smb_notify_on_change_dir_depth` (Number) Lowest directory level to which the enabled notifications apply, if any. + +### Read-Only + +- `file_system_type` (String) Type of filesystem: normal or snapshot. +- `id` (String) Unique identifier of the file system. +- `parent_id` (String) Unique identifier of the parent filesystem. + + +### Nested Schema for `flr_attributes` + +Optional: + +- `mode` (String) The FLR type of the file system. + +## Import + +Import is supported using the following syntax: + +{{codefile "shell" "/root/newworkspace2/terraform-provider-powerstore/examples/resources/powerstore_filesystem/import.sh"}} \ No newline at end of file diff --git a/examples/resources/powerstore_filesystem/import.sh b/examples/resources/powerstore_filesystem/import.sh new file mode 100644 index 00000000..41b064a5 --- /dev/null +++ b/examples/resources/powerstore_filesystem/import.sh @@ -0,0 +1,26 @@ +#Copyright (c) 2024 Dell Inc., or its subsidiaries. All Rights Reserved. +# +#Licensed under the Mozilla Public License Version 2.0 (the "License"); +#you may not use this file except in compliance with the License. +#You may obtain a copy of the License at +# +# http://mozilla.org/MPL/2.0/ +# +# +#Unless required by applicable law or agreed to in writing, software +#distributed under the License is distributed on an "AS IS" BASIS, +#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +#See the License for the specific language governing permissions and +#limitations under the License. + + +# Below are the steps to import file system : +# Step 1 - To import a file system , we need the id of that file system +# Step 2 - To check the id of the file system we can make use of file system datasource to read required/all file system ids. Alternatively, we can make GET request to file system endpoint. eg. https://10.0.0.1/api/rest/file_system which will return list of all file system ids. +# Step 3 - Add empty resource block in tf file. +# eg. +# resource "powerstore_filesystem" "resource_block_name" { + # (resource arguments) +# } +# Step 4 - Execute the command: terraform import "powerstore_filesystem.resource_block_name" "id_of_the_file_system" (resource_block_name must be taken from step 3 and id must be taken from step 2) +# Step 5 - After successful execution of the command , check the state file diff --git a/examples/resources/powerstore_filesystem/provider.tf b/examples/resources/powerstore_filesystem/provider.tf new file mode 100644 index 00000000..d00ded0a --- /dev/null +++ b/examples/resources/powerstore_filesystem/provider.tf @@ -0,0 +1,33 @@ +/* +Copyright (c) 2024 Dell Inc., or its subsidiaries. All Rights Reserved. + +Licensed under the Mozilla Public License Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://mozilla.org/MPL/2.0/ + + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +terraform { + required_providers { + powerstore = { + version = "1.1.0" + source = "registry.terraform.io/dell/powerstore" + } + } +} + +provider "powerstore" { + username = var.username + password = var.password + endpoint = var.endpoint + insecure = true + timeout = var.timeout +} \ No newline at end of file diff --git a/examples/resources/powerstore_filesystem/resource.tf b/examples/resources/powerstore_filesystem/resource.tf new file mode 100644 index 00000000..1ccbfd70 --- /dev/null +++ b/examples/resources/powerstore_filesystem/resource.tf @@ -0,0 +1,42 @@ +/* +Copyright (c) 2024 Dell Inc., or its subsidiaries. All Rights Reserved. + +Licensed under the Mozilla Public License Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://mozilla.org/MPL/2.0/ + + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +# Commands to run this tf file : terraform init && terraform plan && terraform apply +# Create, Update, Delete and Import is supported for this resource + + +resource "powerstore_filesystem" "test" { + name = "test_fs" + description = "testing file system" + size = 5 + nas_server_id = "654b2182-f674-f39a-66fc-52518d324736" + flr_attributes = { + mode = "Enterprise" + } + config_type = "General" + access_policy = "UNIX" + locking_policy = "Advisory" + folder_rename_policy = "All_Allowed" + is_smb_sync_writes_enabled = false + is_smb_no_notify_enabled = false + is_smb_op_locks_enabled = false + is_smb_notify_on_access_enabled = true + is_smb_notify_on_write_enabled = true + smb_notify_on_change_dir_depth = 12 + is_async_mtime_enabled = false + file_events_publishing_mode = "All" +} diff --git a/examples/resources/powerstore_filesystem/variables.tf b/examples/resources/powerstore_filesystem/variables.tf new file mode 100644 index 00000000..b079f08a --- /dev/null +++ b/examples/resources/powerstore_filesystem/variables.tf @@ -0,0 +1,36 @@ +/* +Copyright (c) 2024 Dell Inc., or its subsidiaries. All Rights Reserved. + +Licensed under the Mozilla Public License Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://mozilla.org/MPL/2.0/ + + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +variable "username" { + type = string + description = "Stores the username of PowerStore host." +} + +variable "password" { + type = string + description = "Stores the password of PowerStore host." +} + +variable "timeout" { + type = string + description = "Stores the timeout of PowerStore host." +} + +variable "endpoint" { + type = string + description = "Stores the endpoint of PowerStore host. eg: https://10.1.1.1/api/rest" +} \ No newline at end of file diff --git a/go.mod b/go.mod index 3c1162af..4356f9fd 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.23 toolchain go1.23.2 require ( - github.com/dell/gopowerstore v1.15.1 + github.com/dell/gopowerstore v1.16.1-0.20241220100440-f96bf943d846 github.com/hashicorp/terraform-plugin-docs v0.20.1 github.com/hashicorp/terraform-plugin-framework v1.13.0 github.com/hashicorp/terraform-plugin-framework-validators v0.15.0 @@ -43,14 +43,13 @@ require ( github.com/Masterminds/sprig/v3 v3.2.3 // indirect github.com/agext/levenshtein v1.2.2 // indirect github.com/armon/go-radix v1.0.0 // indirect - github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d // indirect + github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect github.com/bgentry/speakeasy v0.1.0 // indirect github.com/bmatcuk/doublestar/v4 v4.7.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/fatih/color v1.16.0 // indirect - github.com/go-openapi/errors v0.20.2 // indirect - github.com/go-openapi/strfmt v0.21.2 // indirect - github.com/go-stack/stack v1.8.1 // indirect + github.com/go-openapi/errors v0.22.0 // indirect + github.com/go-openapi/strfmt v0.23.0 // indirect github.com/golang/protobuf v1.5.4 // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/google/uuid v1.6.0 // indirect @@ -91,13 +90,15 @@ require ( github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect github.com/zclconf/go-cty v1.15.0 // indirect go.abhg.dev/goldmark/frontmatter v0.2.0 // indirect - go.mongodb.org/mongo-driver v1.9.1 // indirect + go.mongodb.org/mongo-driver v1.17.1 // indirect golang.org/x/net v0.28.0 // indirect golang.org/x/sync v0.9.0 // indirect - golang.org/x/sys v0.26.0 // indirect + golang.org/x/sys v0.28.0 // indirect golang.org/x/text v0.20.0 // indirect golang.org/x/tools v0.22.0 // indirect google.golang.org/appengine v1.6.8 // indirect google.golang.org/grpc v1.67.1 // indirect google.golang.org/protobuf v1.35.1 // indirect ) + +replace github.com/dell/gopowerstore => ../gopowerstore diff --git a/go.sum b/go.sum index f1aea625..ce927ffc 100644 --- a/go.sum +++ b/go.sum @@ -21,9 +21,8 @@ github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4= github.com/armon/go-radix v1.0.0 h1:F4z6KzEeeQIMeLFa97iZU6vupzoecKdU5TX24SNppXI= github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= -github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d h1:Byv0BzEl3/e6D5CLfI0j/7hiIEtvGVFPCZ7Ei2oq8iQ= -github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= +github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so= +github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bmatcuk/doublestar/v4 v4.7.1 h1:fdDeAqgT47acgwd9bd9HxJRDmc9UAmPpc+2m0CXv75Q= @@ -38,8 +37,6 @@ github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxG github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dell/gopowerstore v1.15.1 h1:m7pxlXqakt6ILy1W35VzXobOsvPOWIOImdhHBa8R38E= -github.com/dell/gopowerstore v1.15.1/go.mod h1:6oAr11lwtpjmlE+s+pDKx7qfQ1HvLFWtlFoNdI03ByQ= github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= @@ -53,14 +50,10 @@ github.com/go-git/go-billy/v5 v5.5.0 h1:yEY4yhzCDuMGSv83oGxiBotRzhwhNr8VZyphhiu+ github.com/go-git/go-billy/v5 v5.5.0/go.mod h1:hmexnoNsr2SJU1Ju67OaNz5ASJY3+sHgFRpCtpDCKow= github.com/go-git/go-git/v5 v5.12.0 h1:7Md+ndsjrzZxbddRDZjF14qK+NN56sy6wkqaVrjZtys= github.com/go-git/go-git/v5 v5.12.0/go.mod h1:FTM9VKtnI2m65hNI/TenDDDnUf2Q9FHnXYjuz9i5OEY= -github.com/go-openapi/errors v0.19.8/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= -github.com/go-openapi/errors v0.20.2 h1:dxy7PGTqEh94zj2E3h1cUmQQWiM1+aeCROfAr02EmK8= -github.com/go-openapi/errors v0.20.2/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= -github.com/go-openapi/strfmt v0.21.2 h1:5NDNgadiX1Vhemth/TH4gCGopWSTdDjxl60H3B7f+os= -github.com/go-openapi/strfmt v0.21.2/go.mod h1:I/XVKeLc5+MM5oPNN7P6urMOpuLXEcNrCX/rPGuWb0k= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/go-stack/stack v1.8.1 h1:ntEHSVwIt7PNXNpgPmVfMrNhLtgjlmnZha2kOpuRiDw= -github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4= +github.com/go-openapi/errors v0.22.0 h1:c4xY/OLxUBSTiepAg3j/MHuAv5mJhnf53LLMWFB+u/w= +github.com/go-openapi/errors v0.22.0/go.mod h1:J3DmZScxCDufmIMsdOuDHxJbdOGC0xtUynjIx092vXE= +github.com/go-openapi/strfmt v0.23.0 h1:nlUS6BCqcnAk0pyhi9Y+kdDVZdZMHfEKQiS4HaMgO/c= +github.com/go-openapi/strfmt v0.23.0/go.mod h1:NrtIpfKtWIygRkKVsxh7XQMDQW5HKQl6S5ik2elW+K4= github.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68= github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= @@ -70,9 +63,7 @@ github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaS github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= -github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= @@ -138,15 +129,14 @@ github.com/huandu/xstrings v1.3.3/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/imdario/mergo v0.3.15 h1:M8XP7IuFNsqUx6VPK2P9OSmsYsI/YFaGil0uD21V3dM= github.com/imdario/mergo v0.3.15/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= -github.com/jarcoal/httpmock v1.2.0 h1:gSvTxxFR/MEMfsGrvRbdfpRUMBStovlSRLw0Ep1bwwc= -github.com/jarcoal/httpmock v1.2.0/go.mod h1:oCoTsnAz4+UoOUIf5lJOWV2QQIW5UoeUI6aM2YnWAZk= +github.com/jarcoal/httpmock v1.3.1 h1:iUx3whfZWVf3jT01hQTO/Eo5sAYtB2/rqaUuOtpInww= +github.com/jarcoal/httpmock v1.3.1/go.mod h1:3yb8rc4BI7TCBhFY8ng0gjuLKJNquuDNiPaZjnENuYg= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= github.com/jhump/protoreflect v1.15.1 h1:HUMERORf3I3ZdX05WaQ6MIpd/NJ434hTp5YiKgfCL6c= github.com/jhump/protoreflect v1.15.1/go.mod h1:jD/2GMKKE6OqX8qTjhADU1e6DShO+gavG9e0Q693nKo= github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4= github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= -github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= @@ -173,14 +163,11 @@ github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJ github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8= github.com/mitchellh/go-wordwrap v1.0.0 h1:6GlHJ/LTGMrIJbwgdqdl2eEH8o+Exx/0m8ir9Gns0u4= github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= -github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= -github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/oklog/run v1.0.0 h1:Ru7dDtJNOyC66gQ5dQmaCa0qIsAUFY3sFpK1Xk8igrw= github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= @@ -188,7 +175,6 @@ github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4= github.com/pjbgf/sha1cd v0.3.0/go.mod h1:nZ1rrWOcGJ5uZgEEVL1VUM9iRQiZvWdbZjkKyFzPPsI= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.2.3 h1:NP0eAhjcjImqslEwo/1hq7gpajME0fTLTezBKDqfXqo= @@ -212,13 +198,10 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4= -github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= github.com/vmihailenco/msgpack v4.0.4+incompatible h1:dSLoQfGFAo3F6OoNhwUmLwVgaUXK79GlxNBwueZn0xI= github.com/vmihailenco/msgpack v4.0.4+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= @@ -228,10 +211,6 @@ github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAh github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM= github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw= -github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= -github.com/xdg-go/scram v1.0.2/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs= -github.com/xdg-go/stringprep v1.0.2/go.mod h1:8F9zXuvzgwmyT5DUm4GUfZGDdT3W+LCvS6+da4O5kxM= -github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/yuin/goldmark v1.7.7 h1:5m9rrB1sW3JUMToKFQfb+FGt1U7r57IHu5GrYrG2nqU= github.com/yuin/goldmark v1.7.7/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E= @@ -243,12 +222,9 @@ github.com/zclconf/go-cty-debug v0.0.0-20240509010212-0d6042c53940 h1:4r45xpDWB6 github.com/zclconf/go-cty-debug v0.0.0-20240509010212-0d6042c53940/go.mod h1:CmBdvvj3nqzfzJ6nTCIwDTPZ56aVGvDrmztiO5g3qrM= go.abhg.dev/goldmark/frontmatter v0.2.0 h1:P8kPG0YkL12+aYk2yU3xHv4tcXzeVnN+gU0tJ5JnxRw= go.abhg.dev/goldmark/frontmatter v0.2.0/go.mod h1:XqrEkZuM57djk7zrlRUB02x8I5J0px76YjkOzhB4YlU= -go.mongodb.org/mongo-driver v1.7.5/go.mod h1:VXEWRZ6URJIkUq2SCAyapmhH0ZLRBP+FT4xhp5Zvxng= -go.mongodb.org/mongo-driver v1.9.1 h1:m078y9v7sBItkt1aaoe2YlvWEXcD263e1a4E1fBrJ1c= -go.mongodb.org/mongo-driver v1.9.1/go.mod h1:0sQWfOeY63QTntERDJJ/0SuKK0T1uVSgKCuAROlKEPY= +go.mongodb.org/mongo-driver v1.17.1 h1:Wic5cJIwJgSpBhe3lx3+/RybR5PiYRMpVFgO7cOHyIM= +go.mongodb.org/mongo-driver v1.17.1/go.mod h1:wwWm/+BuOddhcq3n68LKRmgk2wXzmF6s0SFOa0GINL4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20201216223049-8b5274cf687f/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw= @@ -258,7 +234,6 @@ golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df/go.mod h1:FXUEEKJgO7OQYeo8N0 golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0= golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= @@ -268,13 +243,10 @@ golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.9.0 h1:fEo0HyrW1GIgZdpbhCRO0PkJajUS5H9IFUztCgEo2jQ= golang.org/x/sync v0.9.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -288,23 +260,20 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= -golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= +golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= +golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.20.0 h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug= golang.org/x/text v0.20.0/go.mod h1:D4IsuqiFMhST5bX19pQ9ikHC2GsaKyk/oF+pn3ducp4= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190531172133-b3315ee88b7d/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA= @@ -324,7 +293,6 @@ google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFyt google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME= @@ -333,6 +301,5 @@ gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/models/filesystem.go b/models/filesystem.go new file mode 100644 index 00000000..ec041161 --- /dev/null +++ b/models/filesystem.go @@ -0,0 +1,51 @@ +/* +Copyright (c) 2024 Dell Inc., or its subsidiaries. All Rights Reserved. + +Licensed under the Mozilla Public License Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://mozilla.org/MPL/2.0/ + + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package models + +import "github.com/hashicorp/terraform-plugin-framework/types" + +// Volume - volume properties +type FileSystem struct { + ID types.String `tfsdk:"id"` + Name types.String `tfsdk:"name"` + Size types.Float64 `tfsdk:"size"` + CapacityUnit types.String `tfsdk:"capacity_unit"` + Description types.String `tfsdk:"description"` + NASServerID types.String `tfsdk:"nas_server_id"` + ConfigType types.String `tfsdk:"config_type"` + AccessPolicy types.String `tfsdk:"access_policy"` + LockingPolicy types.String `tfsdk:"locking_policy"` + FolderRenamePolicy types.String `tfsdk:"folder_rename_policy"` + IsAsyncMTimeEnabled types.Bool `tfsdk:"is_async_mtime_enabled"` + ProtectionPolicyID types.String `tfsdk:"protection_policy_id"` + FileEventsPublishingMode types.String `tfsdk:"file_events_publishing_mode"` + HostIOSize types.String `tfsdk:"host_io_size"` + IsSmbSyncWritesEnabled types.Bool `tfsdk:"is_smb_sync_writes_enabled"` + IsSmbNoNotifyEnabled types.Bool `tfsdk:"is_smb_no_notify_enabled"` + IsSmbOpLocksEnabled types.Bool `tfsdk:"is_smb_op_locks_enabled"` + IsSmbNotifyOnAccessEnabled types.Bool `tfsdk:"is_smb_notify_on_access_enabled"` + IsSmbNotifyOnWriteEnabled types.Bool `tfsdk:"is_smb_notify_on_write_enabled"` + SmbNotifyOnChangeDirDepth types.Int32 `tfsdk:"smb_notify_on_change_dir_depth"` + FilesystemType types.String `tfsdk:"file_system_type"` + ParentID types.String `tfsdk:"parent_id"` + FlrAttributes types.Object `tfsdk:"flr_attributes"` +} + +type FlrAttributes struct { + Mode types.String `tfsdk:"mode"` +} diff --git a/powerstore/resource_filesystem.go b/powerstore/resource_filesystem.go index e867a632..0ae7c79d 100644 --- a/powerstore/resource_filesystem.go +++ b/powerstore/resource_filesystem.go @@ -495,7 +495,7 @@ func (r fileSystemResource) Update(ctx context.Context, req resource.UpdateReque LockingPolicy: plan.LockingPolicy.ValueString(), FolderRenamePolicy: plan.FolderRenamePolicy.ValueString(), IsAsyncMtimeEnabled: GetKnownBoolPointer(plan.IsAsyncMTimeEnabled), - ProtectionPolicyId: plan.ProtectionPolicyID.ValueString(), + ProtectionPolicyID: plan.ProtectionPolicyID.ValueString(), FileEventsPublishingMode: plan.FileEventsPublishingMode.ValueString(), IsSmbSyncWritesEnabled: GetKnownBoolPointer(plan.IsSmbSyncWritesEnabled), IsSmbNoNotifyEnabled: GetKnownBoolPointer(plan.IsSmbNoNotifyEnabled), From 9a6f24ee0c72f11903cb2e2f640e5bd38d9e8944 Mon Sep 17 00:00:00 2001 From: AnikaAgiwal2711 Date: Mon, 23 Dec 2024 01:25:42 -0500 Subject: [PATCH 03/10] fixed go mod file --- go.mod | 2 -- go.sum | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 4356f9fd..b09a9888 100644 --- a/go.mod +++ b/go.mod @@ -100,5 +100,3 @@ require ( google.golang.org/grpc v1.67.1 // indirect google.golang.org/protobuf v1.35.1 // indirect ) - -replace github.com/dell/gopowerstore => ../gopowerstore diff --git a/go.sum b/go.sum index ce927ffc..88fc0e13 100644 --- a/go.sum +++ b/go.sum @@ -37,6 +37,8 @@ github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxG github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dell/gopowerstore v1.16.1-0.20241220100440-f96bf943d846 h1:NxYOPiMO3I7lbs+/ps+d1v/gwCrwaaLzr2hoqvmgwso= +github.com/dell/gopowerstore v1.16.1-0.20241220100440-f96bf943d846/go.mod h1:RYodZ8GgJG5p85AviydL43Mt8ldcTqr5a+Cv+vqWacE= github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= From 6d879c1a0c883139857d6b35c6f1257acd4bc65d Mon Sep 17 00:00:00 2001 From: AnikaAgiwal2711 Date: Mon, 23 Dec 2024 01:31:21 -0500 Subject: [PATCH 04/10] fixed formatting issue --- powerstore/resource_filesystem.go | 17 ++++++++--------- powerstore/resource_filesystem_test.go | 19 +++++++++---------- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/powerstore/resource_filesystem.go b/powerstore/resource_filesystem.go index 0ae7c79d..c0510906 100644 --- a/powerstore/resource_filesystem.go +++ b/powerstore/resource_filesystem.go @@ -433,38 +433,37 @@ func (r fileSystemResource) Update(ctx context.Context, req resource.UpdateReque return } - if plan.Name.ValueString() != state.Name.ValueString(){ + if plan.Name.ValueString() != state.Name.ValueString() { resp.Diagnostics.AddError( "Error updating file system", "Name of the file system can't be updated", ) - return + return } - if plan.NASServerID.ValueString() != state.NASServerID.ValueString(){ + if plan.NASServerID.ValueString() != state.NASServerID.ValueString() { resp.Diagnostics.AddError( "Error updating file system", "NAS server ID can't be updated", ) - return + return } - if plan.HostIOSize.ValueString() != state.HostIOSize.ValueString(){ + if plan.HostIOSize.ValueString() != state.HostIOSize.ValueString() { resp.Diagnostics.AddError( "Error updating file system", "Host IO size can't be updated", ) - return + return } - if plan.ConfigType.ValueString() != state.ConfigType.ValueString(){ + if plan.ConfigType.ValueString() != state.ConfigType.ValueString() { resp.Diagnostics.AddError( "Error updating file system", "Config type can't be updated", ) - return + return } - var FlrCreate models.FlrAttributes plan.FlrAttributes.As(ctx, &FlrCreate, basetypes.ObjectAsOptions{UnhandledNullAsEmpty: true, UnhandledUnknownAsEmpty: true}) diff --git a/powerstore/resource_filesystem_test.go b/powerstore/resource_filesystem_test.go index d4f35b1e..4fe578b8 100644 --- a/powerstore/resource_filesystem_test.go +++ b/powerstore/resource_filesystem_test.go @@ -22,9 +22,9 @@ import ( "testing" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" - "github.com/stretchr/testify/assert" - "regexp" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/stretchr/testify/assert" + "regexp" ) func TestAccFileSystem_CreateFS(t *testing.T) { @@ -68,7 +68,7 @@ func TestAccFileSystem_InvalidUpdate(t *testing.T) { ProtoV6ProviderFactories: testProviderFactory, Steps: []resource.TestStep{ { - Config: ProviderConfigForTesting + FsParams, + Config: ProviderConfigForTesting + FsParams, Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("powerstore_filesystem.test_fs_create", "name", "test_fs"), resource.TestCheckResourceAttr("powerstore_filesystem.test_fs_create", "size", "5"), @@ -108,14 +108,14 @@ func TestAccFileSystem_Update(t *testing.T) { ProtoV6ProviderFactories: testProviderFactory, Steps: []resource.TestStep{ { - Config: ProviderConfigForTesting + FsParams, + Config: ProviderConfigForTesting + FsParams, Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("powerstore_filesystem.test_fs_create", "name", "test_fs"), resource.TestCheckResourceAttr("powerstore_filesystem.test_fs_create", "size", "5"), ), }, { - Config: ProviderConfigForTesting + FsParamsValidUpdate, + Config: ProviderConfigForTesting + FsParamsValidUpdate, Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("powerstore_filesystem.test_fs_create", "description", "testing file system Update"), ), @@ -138,7 +138,7 @@ func TestAccFileSystem_CreateErr(t *testing.T) { ExpectError: regexp.MustCompile(".*Error creating file system.*"), }, { - Config: ProviderConfigForTesting + FsParams, + Config: ProviderConfigForTesting + FsParams, Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("powerstore_filesystem.test_fs_create", "name", "test_fs"), resource.TestCheckResourceAttr("powerstore_filesystem.test_fs_create", "size", "5"), @@ -152,7 +152,6 @@ func TestAccFileSystem_CreateErr(t *testing.T) { }) } - var FsParams = ` resource "powerstore_filesystem" "test_fs_create" { name = "test_fs" @@ -346,7 +345,7 @@ resource "powerstore_filesystem" "test_fs_create" { } ` -var FsParamsModifyErr= ` +var FsParamsModifyErr = ` resource "powerstore_filesystem" "test_fs_create" { name = "test_fs" description = "testing file system" @@ -368,4 +367,4 @@ resource "powerstore_filesystem" "test_fs_create" { is_async_mtime_enabled = true file_events_publishing_mode = "All" } -` \ No newline at end of file +` From 7770a418843a2fe296a2cc4e12e7832afae5f085 Mon Sep 17 00:00:00 2001 From: AnikaAgiwal2711 Date: Mon, 23 Dec 2024 01:47:57 -0500 Subject: [PATCH 05/10] fixed documentation --- docs/resources/filesystem.md | 77 +++++++++++++++++++++++++- templates/resources/filesystem.md.tmpl | 46 +++++++++++++++ 2 files changed, 120 insertions(+), 3 deletions(-) create mode 100644 templates/resources/filesystem.md.tmpl diff --git a/docs/resources/filesystem.md b/docs/resources/filesystem.md index 3c29a2fb..7c9e9cc1 100644 --- a/docs/resources/filesystem.md +++ b/docs/resources/filesystem.md @@ -26,10 +26,54 @@ description: |- This resource is used to manage the file system entity of PowerStore Array. We can Create, Update and Delete the file system using this resource. We can also import an existing file system from PowerStore array. - ## Example Usage -{{tffile "/root/newworkspace2/terraform-provider-powerstore/examples/resources/powerstore_filesystem/resource.tf"}} +```terraform +/* +Copyright (c) 2024 Dell Inc., or its subsidiaries. All Rights Reserved. + +Licensed under the Mozilla Public License Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://mozilla.org/MPL/2.0/ + + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +# Commands to run this tf file : terraform init && terraform plan && terraform apply +# Create, Update, Delete and Import is supported for this resource + + +resource "powerstore_filesystem" "test" { + name = "test_fs" + description = "testing file system" + size = 5 + nas_server_id = "654b2182-f674-f39a-66fc-52518d324736" + flr_attributes = { + mode = "Enterprise" + } + config_type = "General" + access_policy = "UNIX" + locking_policy = "Advisory" + folder_rename_policy = "All_Allowed" + is_smb_sync_writes_enabled = false + is_smb_no_notify_enabled = false + is_smb_op_locks_enabled = false + is_smb_notify_on_access_enabled = true + is_smb_notify_on_write_enabled = true + smb_notify_on_change_dir_depth = 12 + is_async_mtime_enabled = false + file_events_publishing_mode = "All" +} +``` + +After the execution of above resource block replication rule would have been created on the PowerStore array. For more information, Please check the terraform state file. ## Schema @@ -77,4 +121,31 @@ Optional: Import is supported using the following syntax: -{{codefile "shell" "/root/newworkspace2/terraform-provider-powerstore/examples/resources/powerstore_filesystem/import.sh"}} \ No newline at end of file +```shell +#Copyright (c) 2024 Dell Inc., or its subsidiaries. All Rights Reserved. +# +#Licensed under the Mozilla Public License Version 2.0 (the "License"); +#you may not use this file except in compliance with the License. +#You may obtain a copy of the License at +# +# http://mozilla.org/MPL/2.0/ +# +# +#Unless required by applicable law or agreed to in writing, software +#distributed under the License is distributed on an "AS IS" BASIS, +#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +#See the License for the specific language governing permissions and +#limitations under the License. + + +# Below are the steps to import file system : +# Step 1 - To import a file system , we need the id of that file system +# Step 2 - To check the id of the file system we can make use of file system datasource to read required/all file system ids. Alternatively, we can make GET request to file system endpoint. eg. https://10.0.0.1/api/rest/file_system which will return list of all file system ids. +# Step 3 - Add empty resource block in tf file. +# eg. +# resource "powerstore_filesystem" "resource_block_name" { + # (resource arguments) +# } +# Step 4 - Execute the command: terraform import "powerstore_filesystem.resource_block_name" "id_of_the_file_system" (resource_block_name must be taken from step 3 and id must be taken from step 2) +# Step 5 - After successful execution of the command , check the state file +``` \ No newline at end of file diff --git a/templates/resources/filesystem.md.tmpl b/templates/resources/filesystem.md.tmpl new file mode 100644 index 00000000..263dac6e --- /dev/null +++ b/templates/resources/filesystem.md.tmpl @@ -0,0 +1,46 @@ +--- +# Copyright (c) 2024 Dell Inc., or its subsidiaries. All Rights Reserved. +# +# Licensed under the Mozilla Public License Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://mozilla.org/MPL/2.0/ +# +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +title: "{{.Name }} {{.Type | lower}}" +linkTitle: "{{.Name }}" +page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}" +subcategory: "" +description: |- +{{ .Description | plainmarkdown | trimspace | prefixlines " " }} +--- + +# {{.Name }} ({{.Type}}) + +{{ .Description | trimspace }} + +{{ if .HasExample -}} +## Example Usage + +{{tffile .ExampleFile }} + +After the execution of above resource block replication rule would have been created on the PowerStore array. For more information, Please check the terraform state file. +{{- end }} + +{{ .SchemaMarkdown | trimspace }} + +{{ if .HasImport -}} +## Import + +Import is supported using the following syntax: + +{{codefile "shell" .ImportFile }} + +{{- end }} \ No newline at end of file From 797703a9d4767c3da9be29cbedb4998ec13a4fc0 Mon Sep 17 00:00:00 2001 From: AnikaAgiwal2711 Date: Mon, 23 Dec 2024 06:47:20 -0500 Subject: [PATCH 06/10] added more attributes to flr attributes --- docs/resources/filesystem.md | 36 +++++---- .../powerstore_filesystem/resource.tf | 33 +++++---- go.mod | 2 +- go.sum | 4 +- models/filesystem.go | 8 +- powerstore/resource_filesystem.go | 73 ++++++++++++++++++- 6 files changed, 118 insertions(+), 38 deletions(-) diff --git a/docs/resources/filesystem.md b/docs/resources/filesystem.md index 7c9e9cc1..17444f13 100644 --- a/docs/resources/filesystem.md +++ b/docs/resources/filesystem.md @@ -51,22 +51,25 @@ limitations under the License. resource "powerstore_filesystem" "test" { - name = "test_fs" - description = "testing file system" - size = 5 - nas_server_id = "654b2182-f674-f39a-66fc-52518d324736" - flr_attributes = { - mode = "Enterprise" + name = "test_fs" + description = "testing file system updated" + size = 4 + nas_server_id = "654b2182-f674-f39a-66fc-52518d324736" + flr_attributes = { + mode = "Enterprise" + minimum_retention = "1D" + default_retention = "1D" + maximum_retention = "infinite" } - config_type = "General" - access_policy = "UNIX" - locking_policy = "Advisory" - folder_rename_policy = "All_Allowed" - is_smb_sync_writes_enabled = false - is_smb_no_notify_enabled = false - is_smb_op_locks_enabled = false - is_smb_notify_on_access_enabled = true - is_smb_notify_on_write_enabled = true + config_type = "General" + access_policy = "UNIX" + locking_policy = "Advisory" + folder_rename_policy = "All_Allowed" + is_smb_sync_writes_enabled = false + is_smb_no_notify_enabled = false + is_smb_op_locks_enabled = true + is_smb_notify_on_access_enabled = false + is_smb_notify_on_write_enabled = false smb_notify_on_change_dir_depth = 12 is_async_mtime_enabled = false file_events_publishing_mode = "All" @@ -115,6 +118,9 @@ After the execution of above resource block replication rule would have been cre Optional: +- `default_retention` (String) The FLR type of the file system. +- `maximum_retention` (String) The FLR type of the file system. +- `minimum_retention` (String) The FLR type of the file system. - `mode` (String) The FLR type of the file system. ## Import diff --git a/examples/resources/powerstore_filesystem/resource.tf b/examples/resources/powerstore_filesystem/resource.tf index 1ccbfd70..2ffb35d1 100644 --- a/examples/resources/powerstore_filesystem/resource.tf +++ b/examples/resources/powerstore_filesystem/resource.tf @@ -20,22 +20,25 @@ limitations under the License. resource "powerstore_filesystem" "test" { - name = "test_fs" - description = "testing file system" - size = 5 - nas_server_id = "654b2182-f674-f39a-66fc-52518d324736" - flr_attributes = { - mode = "Enterprise" + name = "test_fs" + description = "testing file system updated" + size = 4 + nas_server_id = "654b2182-f674-f39a-66fc-52518d324736" + flr_attributes = { + mode = "Enterprise" + minimum_retention = "1D" + default_retention = "1D" + maximum_retention = "infinite" } - config_type = "General" - access_policy = "UNIX" - locking_policy = "Advisory" - folder_rename_policy = "All_Allowed" - is_smb_sync_writes_enabled = false - is_smb_no_notify_enabled = false - is_smb_op_locks_enabled = false - is_smb_notify_on_access_enabled = true - is_smb_notify_on_write_enabled = true + config_type = "General" + access_policy = "UNIX" + locking_policy = "Advisory" + folder_rename_policy = "All_Allowed" + is_smb_sync_writes_enabled = false + is_smb_no_notify_enabled = false + is_smb_op_locks_enabled = true + is_smb_notify_on_access_enabled = false + is_smb_notify_on_write_enabled = false smb_notify_on_change_dir_depth = 12 is_async_mtime_enabled = false file_events_publishing_mode = "All" diff --git a/go.mod b/go.mod index b09a9888..7d12d271 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.23 toolchain go1.23.2 require ( - github.com/dell/gopowerstore v1.16.1-0.20241220100440-f96bf943d846 + github.com/dell/gopowerstore v1.16.1-0.20241223113701-1ee187fc74cd github.com/hashicorp/terraform-plugin-docs v0.20.1 github.com/hashicorp/terraform-plugin-framework v1.13.0 github.com/hashicorp/terraform-plugin-framework-validators v0.15.0 diff --git a/go.sum b/go.sum index 88fc0e13..a0d40d17 100644 --- a/go.sum +++ b/go.sum @@ -37,8 +37,8 @@ github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxG github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dell/gopowerstore v1.16.1-0.20241220100440-f96bf943d846 h1:NxYOPiMO3I7lbs+/ps+d1v/gwCrwaaLzr2hoqvmgwso= -github.com/dell/gopowerstore v1.16.1-0.20241220100440-f96bf943d846/go.mod h1:RYodZ8GgJG5p85AviydL43Mt8ldcTqr5a+Cv+vqWacE= +github.com/dell/gopowerstore v1.16.1-0.20241223113701-1ee187fc74cd h1:OkJXOzNoLCbF6qn0VDuC5sIXjGgnYYBHRW0cKRhKuKk= +github.com/dell/gopowerstore v1.16.1-0.20241223113701-1ee187fc74cd/go.mod h1:RYodZ8GgJG5p85AviydL43Mt8ldcTqr5a+Cv+vqWacE= github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= diff --git a/models/filesystem.go b/models/filesystem.go index ec041161..f8d3d689 100644 --- a/models/filesystem.go +++ b/models/filesystem.go @@ -19,7 +19,7 @@ package models import "github.com/hashicorp/terraform-plugin-framework/types" -// Volume - volume properties +// FileSystem - file system properties type FileSystem struct { ID types.String `tfsdk:"id"` Name types.String `tfsdk:"name"` @@ -46,6 +46,10 @@ type FileSystem struct { FlrAttributes types.Object `tfsdk:"flr_attributes"` } +// FlrAttributes - struct for flr attributes type FlrAttributes struct { - Mode types.String `tfsdk:"mode"` + Mode types.String `tfsdk:"mode"` + MinimumRetention types.String `tfsdk:"minimum_retention"` + DefaultRetention types.String `tfsdk:"default_retention"` + MaximumRetention types.String `tfsdk:"maximum_retention"` } diff --git a/powerstore/resource_filesystem.go b/powerstore/resource_filesystem.go index c0510906..2a5a6089 100644 --- a/powerstore/resource_filesystem.go +++ b/powerstore/resource_filesystem.go @@ -21,6 +21,7 @@ import ( "context" "fmt" "log" + "regexp" client "terraform-provider-powerstore/client" "terraform-provider-powerstore/models" @@ -266,6 +267,58 @@ func (r fileSystemResource) Schema(ctx context.Context, req resource.SchemaReque MarkdownDescription: "The FLR type of the file system.", Optional: true, Computed: true, + Validators: []validator.String{ + stringvalidator.OneOf([]string{ + "None", + "Enterprise", + "Compliance", + }...), + }, + PlanModifiers: []planmodifier.String{ + DefaultAttribute("Enterprise"), + }, + }, + "minimum_retention": schema.StringAttribute{ + Description: "The FLR type of the file system.", + MarkdownDescription: "The FLR type of the file system.", + Optional: true, + Computed: true, + Validators: []validator.String{ + stringvalidator.RegexMatches( + regexp.MustCompile(`(^\d+[DMY])|(^infinite$)`), + "must only contain only alphanumeric characters", + ), + }, + PlanModifiers: []planmodifier.String{ + DefaultAttribute("1D"), + }, + }, + "default_retention": schema.StringAttribute{ + Description: "The FLR type of the file system.", + MarkdownDescription: "The FLR type of the file system.", + Optional: true, + Computed: true, + Validators: []validator.String{ + stringvalidator.RegexMatches( + regexp.MustCompile(`(^\d+[DMY])|(^infinite$)`), + "must only contain only alphanumeric characters", + ), + }, + }, + "maximum_retention": schema.StringAttribute{ + Description: "The FLR type of the file system.", + MarkdownDescription: "The FLR type of the file system.", + Optional: true, + Computed: true, + Validators: []validator.String{ + stringvalidator.RegexMatches( + regexp.MustCompile(`(^\d+[DMY])|(^infinite$)`), + "must only contain only alphanumeric characters", + ), + }, + PlanModifiers: []planmodifier.String{ + DefaultAttribute("infinite"), + }, }, }, }, @@ -344,7 +397,10 @@ func (r fileSystemResource) Create(ctx context.Context, req resource.CreateReque IsSmbNotifyOnWriteEnabled: GetKnownBoolPointer(plan.IsSmbNotifyOnWriteEnabled), SmbNotifyOnChangeDirDepth: plan.SmbNotifyOnChangeDirDepth.ValueInt32(), FlrCreate: gopowerstore.FlrAttributes{ - Mode: FlrCreate.Mode.ValueString(), + Mode: FlrCreate.Mode.ValueString(), + MinimumRetention: FlrCreate.MinimumRetention.ValueString(), + DefaultRetention: FlrCreate.DefaultRetention.ValueString(), + MaximumRetention: FlrCreate.MaximumRetention.ValueString(), }, } @@ -502,6 +558,11 @@ func (r fileSystemResource) Update(ctx context.Context, req resource.UpdateReque IsSmbNotifyOnAccessEnabled: GetKnownBoolPointer(plan.IsSmbNotifyOnAccessEnabled), IsSmbNotifyOnWriteEnabled: GetKnownBoolPointer(plan.IsSmbNotifyOnWriteEnabled), SmbNotifyOnChangeDirDepth: plan.SmbNotifyOnChangeDirDepth.ValueInt32(), + FlrCreate: gopowerstore.FlrAttributes{ + MinimumRetention: FlrCreate.MinimumRetention.ValueString(), + DefaultRetention: FlrCreate.DefaultRetention.ValueString(), + MaximumRetention: FlrCreate.MaximumRetention.ValueString(), + }, } _, err := r.client.PStoreClient.ModifyFS(context.Background(), fsModify, state.ID.ValueString()) @@ -622,9 +683,15 @@ func updateFsState(fsState *models.FileSystem, fsResponse gopowerstore.FileSyste fsState.ParentID = types.StringValue(fsResponse.ParentID) fsState.FilesystemType = types.StringValue(string(fsResponse.FilesystemType)) fsState.FlrAttributes, _ = types.ObjectValue(map[string]attr.Type{ - "mode": types.StringType, + "mode": types.StringType, + "minimum_retention": types.StringType, + "default_retention": types.StringType, + "maximum_retention": types.StringType, }, map[string]attr.Value{ - "mode": types.StringValue(fsResponse.FlrCreate.Mode), + "mode": types.StringValue(fsResponse.FlrCreate.Mode), + "minimum_retention": types.StringValue(fsResponse.FlrCreate.MinimumRetention), + "default_retention": types.StringValue(fsResponse.FlrCreate.DefaultRetention), + "maximum_retention": types.StringValue(fsResponse.FlrCreate.MaximumRetention), }) } From 8c3dc0c020db32cd09dc1b7bc5b47a9eb6b266e8 Mon Sep 17 00:00:00 2001 From: AnikaAgiwal2711 Date: Thu, 2 Jan 2025 09:41:24 -0500 Subject: [PATCH 07/10] worked on comments --- .../powerstore_filesystem/resource.tf | 14 ++++----- go.mod | 2 +- go.sum | 4 +-- powerstore/resource_filesystem.go | 2 +- powerstore/resource_filesystem_test.go | 30 ++++++++++++++++++- 5 files changed, 40 insertions(+), 12 deletions(-) diff --git a/examples/resources/powerstore_filesystem/resource.tf b/examples/resources/powerstore_filesystem/resource.tf index 2ffb35d1..0c3b9e07 100644 --- a/examples/resources/powerstore_filesystem/resource.tf +++ b/examples/resources/powerstore_filesystem/resource.tf @@ -21,8 +21,8 @@ limitations under the License. resource "powerstore_filesystem" "test" { name = "test_fs" - description = "testing file system updated" - size = 4 + description = "testing file system" + size = 3 nas_server_id = "654b2182-f674-f39a-66fc-52518d324736" flr_attributes = { mode = "Enterprise" @@ -34,12 +34,12 @@ resource "powerstore_filesystem" "test" { access_policy = "UNIX" locking_policy = "Advisory" folder_rename_policy = "All_Allowed" - is_smb_sync_writes_enabled = false - is_smb_no_notify_enabled = false - is_smb_op_locks_enabled = true - is_smb_notify_on_access_enabled = false + is_smb_sync_writes_enabled = true + is_smb_no_notify_enabled = true + is_smb_op_locks_enabled = false + is_smb_notify_on_access_enabled = true is_smb_notify_on_write_enabled = false smb_notify_on_change_dir_depth = 12 - is_async_mtime_enabled = false + is_async_mtime_enabled = true file_events_publishing_mode = "All" } diff --git a/go.mod b/go.mod index 404a02c2..e5764f1b 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.23 toolchain go1.23.2 require ( - github.com/dell/gopowerstore v1.16.1-0.20241223113701-1ee187fc74cd + github.com/dell/gopowerstore v1.16.1-0.20241227083619-36c4ea66275f github.com/hashicorp/terraform-plugin-docs v0.20.1 github.com/hashicorp/terraform-plugin-framework v1.13.0 github.com/hashicorp/terraform-plugin-framework-validators v0.15.0 diff --git a/go.sum b/go.sum index a0d40d17..0e758f34 100644 --- a/go.sum +++ b/go.sum @@ -37,8 +37,8 @@ github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxG github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dell/gopowerstore v1.16.1-0.20241223113701-1ee187fc74cd h1:OkJXOzNoLCbF6qn0VDuC5sIXjGgnYYBHRW0cKRhKuKk= -github.com/dell/gopowerstore v1.16.1-0.20241223113701-1ee187fc74cd/go.mod h1:RYodZ8GgJG5p85AviydL43Mt8ldcTqr5a+Cv+vqWacE= +github.com/dell/gopowerstore v1.16.1-0.20241227083619-36c4ea66275f h1:wr07YuRpeBb5sEgBahBGPWMZKomPC2TfbpBjMWMqwVE= +github.com/dell/gopowerstore v1.16.1-0.20241227083619-36c4ea66275f/go.mod h1:RYodZ8GgJG5p85AviydL43Mt8ldcTqr5a+Cv+vqWacE= github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= diff --git a/powerstore/resource_filesystem.go b/powerstore/resource_filesystem.go index 2a5a6089..4bca716e 100644 --- a/powerstore/resource_filesystem.go +++ b/powerstore/resource_filesystem.go @@ -386,7 +386,7 @@ func (r fileSystemResource) Create(ctx context.Context, req resource.CreateReque AccessPolicy: plan.AccessPolicy.ValueString(), LockingPolicy: plan.LockingPolicy.ValueString(), FolderRenamePolicy: plan.FolderRenamePolicy.ValueString(), - IsAsyncMTimeEnabled: GetKnownBoolPointer(plan.IsAsyncMTimeEnabled), + IsAsyncMTimeEnabled: plan.IsAsyncMTimeEnabled.ValueBool(), ProtectionPolicyID: plan.ProtectionPolicyID.ValueString(), FileEventsPublishingMode: plan.FileEventsPublishingMode.ValueString(), HostIOSize: plan.HostIOSize.ValueString(), diff --git a/powerstore/resource_filesystem_test.go b/powerstore/resource_filesystem_test.go index 4fe578b8..7501836f 100644 --- a/powerstore/resource_filesystem_test.go +++ b/powerstore/resource_filesystem_test.go @@ -21,10 +21,11 @@ import ( "os" "testing" + "regexp" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/stretchr/testify/assert" - "regexp" ) func TestAccFileSystem_CreateFS(t *testing.T) { @@ -160,6 +161,9 @@ resource "powerstore_filesystem" "test_fs_create" { nas_server_id = "` + nasServerID + `" flr_attributes = { mode = "Enterprise" + minimum_retention = "1D" + default_retention = "1D" + maximum_retention = "infinite" } config_type = "General" access_policy = "UNIX" @@ -184,6 +188,9 @@ resource "powerstore_filesystem" "test_fs_create" { nas_server_id = "` + nasServerID + `" flr_attributes = { mode = "Enterprise" + minimum_retention = "1D" + default_retention = "1D" + maximum_retention = "infinite" } config_type = "General" access_policy = "UNIX" @@ -208,6 +215,9 @@ resource "powerstore_filesystem" "test_fs_create" { nas_server_id = "Id Updated" flr_attributes = { mode = "Enterprise" + minimum_retention = "1D" + default_retention = "1D" + maximum_retention = "infinite" } config_type = "General" access_policy = "UNIX" @@ -232,6 +242,9 @@ resource "powerstore_filesystem" "test_fs_create" { nas_server_id = "` + nasServerID + `" flr_attributes = { mode = "None" + minimum_retention = "1D" + default_retention = "1D" + maximum_retention = "infinite" } config_type = "General" access_policy = "UNIX" @@ -256,6 +269,9 @@ resource "powerstore_filesystem" "test_fs_create" { nas_server_id = "` + nasServerID + `" flr_attributes = { mode = "Enterprise" + minimum_retention = "1D" + default_retention = "1D" + maximum_retention = "infinite" } config_type = "VMware" access_policy = "UNIX" @@ -280,6 +296,9 @@ resource "powerstore_filesystem" "test_fs_create" { nas_server_id = "` + nasServerID + `" flr_attributes = { mode = "Enterprise" + minimum_retention = "1D" + default_retention = "1D" + maximum_retention = "infinite" } config_type = "General" access_policy = "UNIX" @@ -305,6 +324,9 @@ resource "powerstore_filesystem" "test_fs_create" { nas_server_id = "` + nasServerID + `" flr_attributes = { mode = "Enterprise" + minimum_retention = "1D" + default_retention = "1D" + maximum_retention = "infinite" } config_type = "General" access_policy = "UNIX" @@ -329,6 +351,9 @@ resource "powerstore_filesystem" "test_fs_create" { nas_server_id = "` + nasServerID + `" flr_attributes = { mode = "Enterprise" + minimum_retention = "1D" + default_retention = "1D" + maximum_retention = "infinite" } config_type = "VMware" access_policy = "UNIX" @@ -353,6 +378,9 @@ resource "powerstore_filesystem" "test_fs_create" { nas_server_id = "` + nasServerID + `" flr_attributes = { mode = "Enterprise" + minimum_retention = "1D" + default_retention = "1D" + maximum_retention = "infinite" } config_type = "General" access_policy = "UNIX" From 32451d9b96dc68c95210ffd607e0423de6f1dac4 Mon Sep 17 00:00:00 2001 From: AnikaAgiwal2711 Date: Thu, 2 Jan 2025 09:42:50 -0500 Subject: [PATCH 08/10] fixed make generate --- docs/resources/filesystem.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/resources/filesystem.md b/docs/resources/filesystem.md index 17444f13..f7246a7a 100644 --- a/docs/resources/filesystem.md +++ b/docs/resources/filesystem.md @@ -52,8 +52,8 @@ limitations under the License. resource "powerstore_filesystem" "test" { name = "test_fs" - description = "testing file system updated" - size = 4 + description = "testing file system" + size = 3 nas_server_id = "654b2182-f674-f39a-66fc-52518d324736" flr_attributes = { mode = "Enterprise" @@ -65,13 +65,13 @@ resource "powerstore_filesystem" "test" { access_policy = "UNIX" locking_policy = "Advisory" folder_rename_policy = "All_Allowed" - is_smb_sync_writes_enabled = false - is_smb_no_notify_enabled = false - is_smb_op_locks_enabled = true - is_smb_notify_on_access_enabled = false + is_smb_sync_writes_enabled = true + is_smb_no_notify_enabled = true + is_smb_op_locks_enabled = false + is_smb_notify_on_access_enabled = true is_smb_notify_on_write_enabled = false smb_notify_on_change_dir_depth = 12 - is_async_mtime_enabled = false + is_async_mtime_enabled = true file_events_publishing_mode = "All" } ``` From 5fecff326bea71a612115372e74c4bec723a741d Mon Sep 17 00:00:00 2001 From: AnikaAgiwal2711 Date: Mon, 6 Jan 2025 03:22:15 -0500 Subject: [PATCH 09/10] worked on comments --- examples/resources/powerstore_filesystem/provider.tf | 2 +- powerstore/resource_filesystem.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/resources/powerstore_filesystem/provider.tf b/examples/resources/powerstore_filesystem/provider.tf index d00ded0a..dde25fa9 100644 --- a/examples/resources/powerstore_filesystem/provider.tf +++ b/examples/resources/powerstore_filesystem/provider.tf @@ -18,7 +18,7 @@ limitations under the License. terraform { required_providers { powerstore = { - version = "1.1.0" + version = "1.2.0" source = "registry.terraform.io/dell/powerstore" } } diff --git a/powerstore/resource_filesystem.go b/powerstore/resource_filesystem.go index 4bca716e..e42aa95a 100644 --- a/powerstore/resource_filesystem.go +++ b/powerstore/resource_filesystem.go @@ -367,7 +367,7 @@ func (r fileSystemResource) Create(ctx context.Context, req resource.CreateReque if errmsg != "" { resp.Diagnostics.AddError( "Error creating file system", - "Could not create file system "+errmsg, + "Error in converting the given size into bytes"+errmsg, ) return } @@ -538,7 +538,7 @@ func (r fileSystemResource) Update(ctx context.Context, req resource.UpdateReque if errmsg != "" { resp.Diagnostics.AddError( "Error updating file system", - "Could not update file system "+errmsg, + "Error in converting the given size into bytes "+errmsg, ) return } From f89d4422cb3b756961558a428f9dc4091584abd3 Mon Sep 17 00:00:00 2001 From: AnikaAgiwal2711 Date: Mon, 6 Jan 2025 03:25:27 -0500 Subject: [PATCH 10/10] removed vg --- powerstore/resource_filesystem.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/powerstore/resource_filesystem.go b/powerstore/resource_filesystem.go index e42aa95a..b93e6b5b 100644 --- a/powerstore/resource_filesystem.go +++ b/powerstore/resource_filesystem.go @@ -606,7 +606,7 @@ func (r fileSystemResource) Delete(ctx context.Context, req resource.DeleteReque return } - // Get vg ID from state + // Get ID from state fsID := state.ID.ValueString() // Delete file system by calling API