Skip to content

Commit

Permalink
Adding validators to user and usergroup datasources
Browse files Browse the repository at this point in the history
  • Loading branch information
rounak-adhikary committed Nov 19, 2024
1 parent 26d33c6 commit e32c7db
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions powerscale/provider/user_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"terraform-provider-powerscale/powerscale/helper"
"terraform-provider-powerscale/powerscale/models"

"github.com/hashicorp/terraform-plugin-framework-validators/listvalidator"
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
"github.com/hashicorp/terraform-plugin-framework/datasource"
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
Expand Down Expand Up @@ -261,6 +262,9 @@ func (d *UserDataSource) Schema(ctx context.Context, req datasource.SchemaReques
},
},
},
Validators: []validator.List{
listvalidator.SizeAtLeast(1),
},
},
"name_prefix": schema.StringAttribute{
Optional: true,
Expand Down
4 changes: 4 additions & 0 deletions powerscale/provider/user_group_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"terraform-provider-powerscale/powerscale/helper"
"terraform-provider-powerscale/powerscale/models"

"github.com/hashicorp/terraform-plugin-framework-validators/listvalidator"
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
"github.com/hashicorp/terraform-plugin-framework/datasource"
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
Expand Down Expand Up @@ -184,6 +185,9 @@ func (d *UserGroupDataSource) Schema(ctx context.Context, req datasource.SchemaR
},
},
},
Validators: []validator.List{
listvalidator.SizeAtLeast(1),
},
},
"name_prefix": schema.StringAttribute{
Optional: true,
Expand Down

0 comments on commit e32c7db

Please sign in to comment.