Skip to content

Commit

Permalink
d/fsx_common_schema: Migrate to AWS SDK v2
Browse files Browse the repository at this point in the history
  • Loading branch information
mattburgess committed Jul 15, 2024
1 parent 63fc671 commit e191e20
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions internal/service/fsx/common_schema_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,23 @@
package fsx

import (
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/service/fsx"
awstypes "github.com/aws/aws-sdk-go-v2/service/fsx/types"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-provider-aws/internal/flex"
tfslices "github.com/hashicorp/terraform-provider-aws/internal/slices"
"github.com/hashicorp/terraform-provider-aws/names"
)

func newSnapshotFilterList(s *schema.Set) []*awstypes.SnapshotFilter {
func newSnapshotFilterList(s *schema.Set) []awstypes.SnapshotFilter {
if s == nil {
return []*awstypes.SnapshotFilter{}
return []awstypes.SnapshotFilter{}
}

return tfslices.ApplyToAll(s.List(), func(tfList interface{}) *awstypes.SnapshotFilter {
return tfslices.ApplyToAll(s.List(), func(tfList interface{}) awstypes.SnapshotFilter {
tfMap := tfList.(map[string]interface{})
return &awstypes.SnapshotFilter{
Name: aws.String(tfMap[names.AttrName].(string)),
Values: flex.ExpandStringList(tfMap[names.AttrValues].([]interface{})),
return awstypes.SnapshotFilter{
Name: awstypes.SnapshotFilterName(tfMap[names.AttrName].(string)),
Values: flex.ExpandStringValueList(tfMap[names.AttrValues].([]interface{})),
}
})
}
Expand All @@ -49,16 +47,16 @@ func snapshotFiltersSchema() *schema.Schema {
}
}

func newStorageVirtualMachineFilterList(s *schema.Set) []*awstypes.StorageVirtualMachineFilter {
func newStorageVirtualMachineFilterList(s *schema.Set) []awstypes.StorageVirtualMachineFilter {
if s == nil {
return []*awstypes.StorageVirtualMachineFilter{}
return []awstypes.StorageVirtualMachineFilter{}
}

return tfslices.ApplyToAll(s.List(), func(tfList interface{}) *awstypes.StorageVirtualMachineFilter {
return tfslices.ApplyToAll(s.List(), func(tfList interface{}) awstypes.StorageVirtualMachineFilter {
tfMap := tfList.(map[string]interface{})
return &awstypes.StorageVirtualMachineFilter{
Name: aws.String(tfMap[names.AttrName].(string)),
Values: flex.ExpandStringList(tfMap[names.AttrValues].([]interface{})),
return awstypes.StorageVirtualMachineFilter{
Name: awstypes.StorageVirtualMachineFilterName(tfMap[names.AttrName].(string)),
Values: flex.ExpandStringValueList(tfMap[names.AttrValues].([]interface{})),
}
})
}
Expand Down

0 comments on commit e191e20

Please sign in to comment.