Skip to content

Commit f92a3c6

Browse files
committed
fix: extra org fields
1 parent 73d5f91 commit f92a3c6

File tree

6 files changed

+28
-15
lines changed

6 files changed

+28
-15
lines changed

docs/data-sources/organization.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,5 @@ data "openai_organization" "example" {
3434

3535
- `description` (String) Description of the organization.
3636
- `is_default` (Boolean) Whether this organization is the default organization for the user.
37-
- `name` (String) Human-friendly label for your organization, shown in user interfaces.
37+
- `name` (String) Internal label for your organization.
38+
- `title` (String) Human-friendly label for your organization, shown in user interfaces.

docs/data-sources/organizations.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,5 @@ Read-Only:
3232
- `description` (String) Description of the organization.
3333
- `id` (String) Organization ID used in API requests.
3434
- `is_default` (Boolean) Whether this organization is the default organization for the user.
35-
- `name` (String) Human-friendly label for your organization, shown in user interfaces.
35+
- `name` (String) Internal label for your organization.
36+
- `title` (String) Human-friendly label for your organization, shown in user interfaces.

internal/provider/data_source_organization.go

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,17 @@ type OrganizationDataSource struct {
2323

2424
type OrganizationDataSourceModel struct {
2525
Id types.String `tfsdk:"id"`
26-
Name types.String `tfsdk:"name"`
2726
IsDefault types.Bool `tfsdk:"is_default"`
27+
Name types.String `tfsdk:"name"`
28+
Title types.String `tfsdk:"title"`
2829
Description types.String `tfsdk:"description"`
2930
}
3031

3132
func (m *OrganizationDataSourceModel) Fill(organization apiclient.Organization) error {
3233
m.Id = types.StringValue(organization.Id)
33-
m.Name = types.StringValue(organization.Title)
3434
m.IsDefault = types.BoolValue(organization.IsDefault)
35+
m.Name = types.StringValue(organization.Name)
36+
m.Title = types.StringValue(organization.Title)
3537
m.Description = types.StringValue(organization.Description)
3638
return nil
3739
}
@@ -49,12 +51,16 @@ func (d *OrganizationDataSource) Schema(ctx context.Context, req datasource.Sche
4951
MarkdownDescription: "The unique identifier for the organization. If omitted, the default organization is used.",
5052
Optional: true,
5153
},
54+
"is_default": schema.BoolAttribute{
55+
MarkdownDescription: "Whether this organization is the default organization for the user.",
56+
Computed: true,
57+
},
5258
"name": schema.StringAttribute{
53-
MarkdownDescription: "Human-friendly label for your organization, shown in user interfaces.",
59+
MarkdownDescription: "Internal label for your organization.",
5460
Computed: true,
5561
},
56-
"is_default": schema.BoolAttribute{
57-
MarkdownDescription: "Whether this organization is the default organization for the user.",
62+
"title": schema.StringAttribute{
63+
MarkdownDescription: "Human-friendly label for your organization, shown in user interfaces.",
5864
Computed: true,
5965
},
6066
"description": schema.StringAttribute{

internal/provider/data_source_organization_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ func TestAccOrganizationDataSource(t *testing.T) {
2222
Config: testAccOrganizationDataSourceConfig,
2323
ConfigStateChecks: []statecheck.StateCheck{
2424
statecheck.ExpectKnownValue(rn, tfjsonpath.New("id"), knownvalue.StringExact(acctest.TestOrganizationId)),
25-
statecheck.ExpectKnownValue(rn, tfjsonpath.New("name"), knownvalue.NotNull()),
2625
statecheck.ExpectKnownValue(rn, tfjsonpath.New("is_default"), knownvalue.Bool(true)),
26+
statecheck.ExpectKnownValue(rn, tfjsonpath.New("name"), knownvalue.NotNull()),
27+
statecheck.ExpectKnownValue(rn, tfjsonpath.New("title"), knownvalue.NotNull()),
2728
statecheck.ExpectKnownValue(rn, tfjsonpath.New("description"), knownvalue.NotNull()),
2829
},
2930
},
@@ -42,8 +43,9 @@ func TestAccOrganizationDataSource_default(t *testing.T) {
4243
Config: testAccOrganizationDataSourceConfig_default,
4344
ConfigStateChecks: []statecheck.StateCheck{
4445
statecheck.ExpectKnownValue(rn, tfjsonpath.New("id"), knownvalue.NotNull()),
45-
statecheck.ExpectKnownValue(rn, tfjsonpath.New("name"), knownvalue.NotNull()),
4646
statecheck.ExpectKnownValue(rn, tfjsonpath.New("is_default"), knownvalue.Bool(true)),
47+
statecheck.ExpectKnownValue(rn, tfjsonpath.New("name"), knownvalue.NotNull()),
48+
statecheck.ExpectKnownValue(rn, tfjsonpath.New("title"), knownvalue.NotNull()),
4749
statecheck.ExpectKnownValue(rn, tfjsonpath.New("description"), knownvalue.NotNull()),
4850
},
4951
},

internal/provider/data_source_organizations.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,10 @@ func NewOrganizationsDataSource() datasource.DataSource {
1616
return &OrganizationsDataSource{}
1717
}
1818

19-
// OrganizationsDataSource defines the data source implementation.
2019
type OrganizationsDataSource struct {
2120
baseDataSource
2221
}
2322

24-
// OrganizationsDataSourceModel describes the data source data model.
2523
type OrganizationsDataSourceModel struct {
2624
Organizations []OrganizationDataSourceModel `tfsdk:"organizations"`
2725
}
@@ -54,12 +52,16 @@ func (d *OrganizationsDataSource) Schema(ctx context.Context, req datasource.Sch
5452
MarkdownDescription: "Organization ID used in API requests.",
5553
Computed: true,
5654
},
55+
"is_default": schema.BoolAttribute{
56+
MarkdownDescription: "Whether this organization is the default organization for the user.",
57+
Computed: true,
58+
},
5759
"name": schema.StringAttribute{
58-
MarkdownDescription: "Human-friendly label for your organization, shown in user interfaces.",
60+
MarkdownDescription: "Internal label for your organization.",
5961
Computed: true,
6062
},
61-
"is_default": schema.BoolAttribute{
62-
MarkdownDescription: "Whether this organization is the default organization for the user.",
63+
"title": schema.StringAttribute{
64+
MarkdownDescription: "Human-friendly label for your organization, shown in user interfaces.",
6365
Computed: true,
6466
},
6567
"description": schema.StringAttribute{

internal/provider/data_source_organizations_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ func TestAccOrganizationsDataSource(t *testing.T) {
2323
statecheck.ExpectKnownValue(rn, tfjsonpath.New("organizations"), knownvalue.SetPartial([]knownvalue.Check{
2424
knownvalue.ObjectExact(map[string]knownvalue.Check{
2525
"id": knownvalue.StringExact(acctest.TestOrganizationId),
26-
"name": knownvalue.NotNull(),
2726
"is_default": knownvalue.Bool(true),
27+
"name": knownvalue.NotNull(),
28+
"title": knownvalue.NotNull(),
2829
"description": knownvalue.NotNull(),
2930
}),
3031
})),

0 commit comments

Comments
 (0)