Skip to content

Commit 485b4ba

Browse files
committed
build provider_meta feturea into provider
1 parent fb57d50 commit 485b4ba

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

internal/provider/provider.go

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const (
2323
defaultAssumeRoleDuration = 1 * time.Hour
2424
)
2525

26-
func New() tfsdk.Provider {
26+
func New() tfsdk.ProviderWithProviderMeta {
2727
return &AwsCloudControlApiProvider{}
2828
}
2929

@@ -355,6 +355,38 @@ func (p *AwsCloudControlApiProvider) GetDataSources(ctx context.Context) (map[st
355355
return dataSources, diags
356356
}
357357

358+
func (p *AwsCloudControlApiProvider) GetMetaSchema(ctx context.Context) (tfsdk.Schema, diag.Diagnostics) {
359+
return tfsdk.Schema{
360+
Version: 1,
361+
Attributes: map[string]tfsdk.Attribute{
362+
"user_agent": {
363+
Attributes: tfsdk.ListNestedAttributes(
364+
map[string]tfsdk.Attribute{
365+
"product_name": {
366+
Type: types.StringType,
367+
Description: "Product name. At least one of `product_name` or `comment` must be set.",
368+
Required: true,
369+
},
370+
"product_version": {
371+
Type: types.StringType,
372+
Description: "Product version. Optional, and should only be set when `product_name` is set.",
373+
Optional: true,
374+
},
375+
"comment": {
376+
Type: types.StringType,
377+
Description: "User-Agent comment. At least one of `comment` or `product_name` must be set.",
378+
Optional: true,
379+
},
380+
},
381+
tfsdk.ListNestedAttributesOptions{},
382+
),
383+
Description: "Product details to append to User-Agent string in all AWS API calls.",
384+
Optional: true,
385+
},
386+
},
387+
}, nil
388+
}
389+
358390
func (p *AwsCloudControlApiProvider) CloudControlApiClient(_ context.Context) *cloudcontrol.Client {
359391
return p.ccClient
360392
}

0 commit comments

Comments
 (0)