Skip to content

Commit cf33d95

Browse files
committed
review comments
1 parent 4a2267f commit cf33d95

File tree

3 files changed

+122
-140
lines changed

3 files changed

+122
-140
lines changed

stackit/internal/services/cdn/distribution/datasource.go

+17-37
Original file line numberDiff line numberDiff line change
@@ -73,109 +73,89 @@ func (r *distributionDataSource) Metadata(_ context.Context, req datasource.Meta
7373
}
7474

7575
func (r *distributionDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) {
76-
descriptions := map[string]string{
77-
"id": "Terrform resource ID",
78-
"distribution_id": "CDN distribution ID",
79-
"project_id": "STACKIT project ID associated with the distribution",
80-
"status": "Status of the distribution",
81-
"created_at": "Time when the distribution was created",
82-
"updated_at": "Time when the distribution was last updated",
83-
"errors": "List of distribution errors",
84-
"domains": "List of configured domains for the distribution",
85-
"config": "The distribution configuration",
86-
"config_backend": "The configured backend for the distribution",
87-
"config_regions": "The configured regions where content will be hosted",
88-
"config_backend_type": "the ",
89-
"config_backend_origin_url": "The configured backend type for the distribution",
90-
"config_backend_origin_request_headers": "The configured origin request headers for the backend",
91-
"domain_name": "The name of the domain",
92-
"domain_status": "The status of the domain",
93-
"domain_type": "The type of the domain. Each distribution has one domain of type \"managed\", and domains of type \"custom\" may be additionally created by the user",
94-
"domain_errors": "List of domain errors",
95-
}
9676
resp.Schema = schema.Schema{
9777
MarkdownDescription: features.AddBetaDescription("CDN distribution data source schema."),
9878
Description: "CDN distribution data source schema.",
9979
Attributes: map[string]schema.Attribute{
10080
"id": schema.StringAttribute{
101-
Description: descriptions["id"],
81+
Description: schemaDescriptions["id"],
10282
Computed: true,
10383
},
10484
"distribution_id": schema.StringAttribute{
105-
Description: descriptions["project_id"],
85+
Description: schemaDescriptions["project_id"],
10686
Required: true,
10787
Validators: []validator.String{
10888
validate.UUID(),
10989
},
11090
},
11191
"project_id": schema.StringAttribute{
112-
Description: descriptions["project_id"],
92+
Description: schemaDescriptions["project_id"],
11393
Required: true,
11494
Validators: []validator.String{
11595
validate.UUID(),
11696
},
11797
},
11898
"status": schema.StringAttribute{
11999
Computed: true,
120-
Description: descriptions["status"],
100+
Description: schemaDescriptions["status"],
121101
},
122102
"created_at": schema.StringAttribute{
123103
Computed: true,
124-
Description: descriptions["created_at"],
104+
Description: schemaDescriptions["created_at"],
125105
},
126106
"updated_at": schema.StringAttribute{
127107
Computed: true,
128-
Description: descriptions["updated_at"],
108+
Description: schemaDescriptions["updated_at"],
129109
},
130110
"errors": schema.ListAttribute{
131111
ElementType: types.StringType,
132112
Computed: true,
133-
Description: descriptions["errors"],
113+
Description: schemaDescriptions["errors"],
134114
},
135115
"domains": schema.ListNestedAttribute{
136116
Computed: true,
137-
Description: descriptions["domains"],
117+
Description: schemaDescriptions["domains"],
138118
NestedObject: schema.NestedAttributeObject{
139119
Attributes: map[string]schema.Attribute{
140120
"name": schema.StringAttribute{
141121
Computed: true,
142-
Description: descriptions["domain_name"],
122+
Description: schemaDescriptions["domain_name"],
143123
},
144124
"status": schema.StringAttribute{
145125
Computed: true,
146-
Description: descriptions["domain_status"],
126+
Description: schemaDescriptions["domain_status"],
147127
},
148128
"type": schema.StringAttribute{
149129
Computed: true,
150-
Description: descriptions["domain_type"],
130+
Description: schemaDescriptions["domain_type"],
151131
},
152132
"errors": schema.ListAttribute{
153133
Computed: true,
154-
Description: descriptions["domain_errors"],
134+
Description: schemaDescriptions["domain_errors"],
155135
ElementType: types.StringType,
156136
},
157137
},
158138
},
159139
},
160140
"config": schema.SingleNestedAttribute{
161141
Computed: true,
162-
Description: descriptions["config"],
142+
Description: schemaDescriptions["config"],
163143
Attributes: map[string]schema.Attribute{
164144
"backend": schema.SingleNestedAttribute{
165145
Computed: true,
166-
Description: descriptions["config_backend"],
146+
Description: schemaDescriptions["config_backend"],
167147
Attributes: map[string]schema.Attribute{
168148
"type": schema.StringAttribute{
169149
Computed: true,
170-
Description: descriptions["config_backend_type"],
150+
Description: schemaDescriptions["config_backend_type"],
171151
},
172152
"origin_url": schema.StringAttribute{
173153
Computed: true,
174-
Description: descriptions["config_backend_origin_url"],
154+
Description: schemaDescriptions["config_backend_origin_url"],
175155
},
176156
"origin_request_headers": schema.MapAttribute{
177157
Computed: true,
178-
Description: descriptions["config_backend_origin_request_headers"],
158+
Description: schemaDescriptions["config_backend_origin_request_headers"],
179159
ElementType: types.StringType,
180160
},
181161
},

0 commit comments

Comments
 (0)