From 485b4ba47ee5031d9dfb30c75de029b74658d46a Mon Sep 17 00:00:00 2001 From: drewmullen Date: Mon, 25 Apr 2022 13:18:59 -0400 Subject: [PATCH] build provider_meta feturea into provider --- internal/provider/provider.go | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/internal/provider/provider.go b/internal/provider/provider.go index 8ab31175c8..51051204bb 100644 --- a/internal/provider/provider.go +++ b/internal/provider/provider.go @@ -23,7 +23,7 @@ const ( defaultAssumeRoleDuration = 1 * time.Hour ) -func New() tfsdk.Provider { +func New() tfsdk.ProviderWithProviderMeta { return &AwsCloudControlApiProvider{} } @@ -355,6 +355,38 @@ func (p *AwsCloudControlApiProvider) GetDataSources(ctx context.Context) (map[st return dataSources, diags } +func (p *AwsCloudControlApiProvider) GetMetaSchema(ctx context.Context) (tfsdk.Schema, diag.Diagnostics) { + return tfsdk.Schema{ + Version: 1, + Attributes: map[string]tfsdk.Attribute{ + "user_agent": { + Attributes: tfsdk.ListNestedAttributes( + map[string]tfsdk.Attribute{ + "product_name": { + Type: types.StringType, + Description: "Product name. At least one of `product_name` or `comment` must be set.", + Required: true, + }, + "product_version": { + Type: types.StringType, + Description: "Product version. Optional, and should only be set when `product_name` is set.", + Optional: true, + }, + "comment": { + Type: types.StringType, + Description: "User-Agent comment. At least one of `comment` or `product_name` must be set.", + Optional: true, + }, + }, + tfsdk.ListNestedAttributesOptions{}, + ), + Description: "Product details to append to User-Agent string in all AWS API calls.", + Optional: true, + }, + }, + }, nil +} + func (p *AwsCloudControlApiProvider) CloudControlApiClient(_ context.Context) *cloudcontrol.Client { return p.ccClient }