Skip to content

Commit fdddc77

Browse files
committed
Replace list with set for roles
1 parent d0f373a commit fdddc77

File tree

10 files changed

+12
-12
lines changed

10 files changed

+12
-12
lines changed

docs/data-sources/user.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ data "nginxproxymanager_user" "user" {
3636
- `name` (String) The name of the user.
3737
- `nickname` (String) The nickname of the user.
3838
- `permissions` (Attributes) The permissions of the user. (see [below for nested schema](#nestedatt--permissions))
39-
- `roles` (List of String) The roles of the user.
39+
- `roles` (Set of String) The roles of the user.
4040

4141
<a id="nestedatt--permissions"></a>
4242
### Nested Schema for `permissions`

docs/data-sources/user_me.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ data "nginxproxymanager_user_me" "user_me" {}
3131
- `name` (String) The name of the user.
3232
- `nickname` (String) The nickname of the user.
3333
- `permissions` (Attributes) The permissions of the user. (see [below for nested schema](#nestedatt--permissions))
34-
- `roles` (List of String) The roles of the user.
34+
- `roles` (Set of String) The roles of the user.
3535

3636
<a id="nestedatt--permissions"></a>
3737
### Nested Schema for `permissions`

docs/data-sources/users.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Read-Only:
3838
- `name` (String) The name of the user.
3939
- `nickname` (String) The nickname of the user.
4040
- `permissions` (Attributes) The permissions of the user. (see [below for nested schema](#nestedatt--users--permissions))
41-
- `roles` (List of String) The roles of the user.
41+
- `roles` (Set of String) The roles of the user.
4242

4343
<a id="nestedatt--users--permissions"></a>
4444
### Nested Schema for `users.permissions`

internal/provider/models/user.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ type User struct {
2121
Email types.String `tfsdk:"email"`
2222
Avatar types.String `tfsdk:"avatar"`
2323
IsDisabled types.Bool `tfsdk:"is_disabled"`
24-
Roles types.List `tfsdk:"roles"`
24+
Roles types.Set `tfsdk:"roles"`
2525
Permissions types.Object `tfsdk:"permissions"`
2626
}
2727

@@ -35,7 +35,7 @@ func (_ User) GetType() attr.Type {
3535
"email": types.StringType,
3636
"avatar": types.StringType,
3737
"is_disabled": types.BoolType,
38-
"roles": types.ListType{ElemType: types.StringType},
38+
"roles": types.SetType{ElemType: types.StringType},
3939
"permissions": types.ObjectType{AttrTypes: UserPermissions{}.GetType().AttributeTypes()},
4040
})
4141
}
@@ -53,7 +53,7 @@ func (m *User) Write(ctx context.Context, user *nginxproxymanager.GetAccessLists
5353
m.Avatar = types.StringValue(user.GetAvatar())
5454
m.IsDisabled = types.BoolValue(user.GetIsDisabled())
5555

56-
m.Roles, tmpDiags = types.ListValueFrom(ctx, types.StringType, user.GetRoles())
56+
m.Roles, tmpDiags = types.SetValueFrom(ctx, types.StringType, user.GetRoles())
5757
diags.Append(tmpDiags...)
5858

5959
if user.HasPermissions() {

internal/provider/user_data_source.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ func (d *UserDataSource) Schema(ctx context.Context, req datasource.SchemaReques
6565
MarkdownDescription: "Whether the user is disabled.",
6666
Computed: true,
6767
},
68-
"roles": schema.ListAttribute{
68+
"roles": schema.SetAttribute{
6969
MarkdownDescription: "The roles of the user.",
7070
Computed: true,
7171
ElementType: types.StringType,

internal/provider/user_data_source_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func TestAccUserDataSource(t *testing.T) {
7070
statecheck.ExpectKnownValue(
7171
"data.nginxproxymanager_user.test",
7272
tfjsonpath.New("roles"),
73-
knownvalue.ListExact([]knownvalue.Check{
73+
knownvalue.SetExact([]knownvalue.Check{
7474
knownvalue.StringExact("admin"),
7575
}),
7676
),

internal/provider/user_me_data_source.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ func (d *UserMeDataSource) Schema(ctx context.Context, req datasource.SchemaRequ
6565
MarkdownDescription: "Whether the user is disabled.",
6666
Computed: true,
6767
},
68-
"roles": schema.ListAttribute{
68+
"roles": schema.SetAttribute{
6969
MarkdownDescription: "The roles of the user.",
7070
Computed: true,
7171
ElementType: types.StringType,

internal/provider/user_me_data_source_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func TestAccUserMeDataSource(t *testing.T) {
7070
statecheck.ExpectKnownValue(
7171
"data.nginxproxymanager_user_me.test",
7272
tfjsonpath.New("roles"),
73-
knownvalue.ListExact([]knownvalue.Check{
73+
knownvalue.SetExact([]knownvalue.Check{
7474
knownvalue.StringExact("admin"),
7575
}),
7676
),

internal/provider/users_data_source.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func (d *UsersDataSource) Schema(ctx context.Context, req datasource.SchemaReque
7070
MarkdownDescription: "Whether the user is disabled.",
7171
Computed: true,
7272
},
73-
"roles": schema.ListAttribute{
73+
"roles": schema.SetAttribute{
7474
MarkdownDescription: "The roles of the user.",
7575
Computed: true,
7676
ElementType: types.StringType,

internal/provider/users_data_source_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func TestAccUsersDataSource(t *testing.T) {
4040
"email": knownvalue.StringExact("admin@example.com"),
4141
"avatar": knownvalue.StringExact(""),
4242
"is_disabled": knownvalue.Bool(false),
43-
"roles": knownvalue.ListExact([]knownvalue.Check{
43+
"roles": knownvalue.SetExact([]knownvalue.Check{
4444
knownvalue.StringExact("admin"),
4545
}),
4646
"permissions": knownvalue.ObjectExact(map[string]knownvalue.Check{

0 commit comments

Comments
 (0)