Skip to content

Commit 6170362

Browse files
committed
Use block syntax for OAT filters
1 parent 0b8d770 commit 6170362

2 files changed

Lines changed: 23 additions & 22 deletions

File tree

docs/data-sources/org_access_token.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ data "docker_org_access_token" "by_label" {
6666

6767
### Optional
6868

69-
- `filter` (Attributes List) One or more name/value filter blocks. Exactly one of `id` or `filter` must be set. Filters are applied with OR semantics within `values` and AND semantics across blocks. Only `label` is supported in v1. (see [below for nested schema](#nestedatt--filter))
69+
- `filter` (Block List) One or more name/value filter blocks. Exactly one of `id` or `filter` must be set. Filters are applied with OR semantics within `values` and AND semantics across blocks. Only `label` is supported in v1. (see [below for nested schema](#nestedblock--filter))
7070
- `id` (String) The ID of the organization access token. Set this for a direct lookup, or omit it when using `filter`.
7171

7272
### Read-Only
@@ -80,7 +80,7 @@ data "docker_org_access_token" "by_label" {
8080
- `last_used_at` (String) The last time the access token was used, if available.
8181
- `resources` (Attributes List) Resources this token has access to. (see [below for nested schema](#nestedatt--resources))
8282

83-
<a id="nestedatt--filter"></a>
83+
<a id="nestedblock--filter"></a>
8484
### Nested Schema for `filter`
8585

8686
Required:

internal/provider/data_source_org_access_token.go

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -112,26 +112,6 @@ data "docker_org_access_token" "by_label" {
112112
Optional: true,
113113
Computed: true,
114114
},
115-
"filter": schema.ListNestedAttribute{
116-
MarkdownDescription: "One or more name/value filter blocks. Exactly one of `id` or `filter` must be set. Filters are applied with OR semantics within `values` and AND semantics across blocks. Only `label` is supported in v1.",
117-
Optional: true,
118-
NestedObject: schema.NestedAttributeObject{
119-
Attributes: map[string]schema.Attribute{
120-
"name": schema.StringAttribute{
121-
MarkdownDescription: "Name of the field to filter by. Only `label` is supported.",
122-
Required: true,
123-
Validators: []validator.String{
124-
stringvalidator.OneOf(orgAccessTokenFilterNameLabel),
125-
},
126-
},
127-
"values": schema.ListAttribute{
128-
MarkdownDescription: "Accepted values for the given filter name.",
129-
Required: true,
130-
ElementType: types.StringType,
131-
},
132-
},
133-
},
134-
},
135115
"label": schema.StringAttribute{
136116
MarkdownDescription: "The label of the access token.",
137117
Computed: true,
@@ -182,6 +162,27 @@ data "docker_org_access_token" "by_label" {
182162
},
183163
},
184164
},
165+
Blocks: map[string]schema.Block{
166+
"filter": schema.ListNestedBlock{
167+
MarkdownDescription: "One or more name/value filter blocks. Exactly one of `id` or `filter` must be set. Filters are applied with OR semantics within `values` and AND semantics across blocks. Only `label` is supported in v1.",
168+
NestedObject: schema.NestedBlockObject{
169+
Attributes: map[string]schema.Attribute{
170+
"name": schema.StringAttribute{
171+
MarkdownDescription: "Name of the field to filter by. Only `label` is supported.",
172+
Required: true,
173+
Validators: []validator.String{
174+
stringvalidator.OneOf(orgAccessTokenFilterNameLabel),
175+
},
176+
},
177+
"values": schema.ListAttribute{
178+
MarkdownDescription: "Accepted values for the given filter name.",
179+
Required: true,
180+
ElementType: types.StringType,
181+
},
182+
},
183+
},
184+
},
185+
},
185186
}
186187
}
187188

0 commit comments

Comments
 (0)