Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardfeng-db committed Aug 21, 2024
1 parent a53bfdc commit 664d4d5
Show file tree
Hide file tree
Showing 14 changed files with 156 additions and 20 deletions.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type AttributeBuilder interface {
SetDeprecated(string) AttributeBuilder
}

// BuildDataSourceAttributeMap takes a map from string to AttributeBuilder and returns a map from string to datasource.schema.Attribute
// BuildDataSourceAttributeMap takes a map from string to AttributeBuilder and returns a map from string to datasource.schema.Attribute.
func BuildDataSourceAttributeMap(attributes map[string]AttributeBuilder) map[string]dataschema.Attribute {
dataSourceAttributes := make(map[string]dataschema.Attribute)

Expand All @@ -30,7 +30,7 @@ func BuildDataSourceAttributeMap(attributes map[string]AttributeBuilder) map[str
return dataSourceAttributes
}

// BuildResourceAttributeMap takes a map from string to AttributeBuilder and returns a map from string to resource.schema.Attribute
// BuildResourceAttributeMap takes a map from string to AttributeBuilder and returns a map from string to resource.schema.Attribute.
func BuildResourceAttributeMap(attributes map[string]AttributeBuilder) map[string]schema.Attribute {
resourceAttributes := make(map[string]schema.Attribute)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,25 @@ type BoolAttributeBuilder struct {
}

func (a BoolAttributeBuilder) BuildDataSourceAttribute() dataschema.Attribute {
return dataschema.BoolAttribute{Optional: a.Optional, Required: a.Required, Sensitive: a.Sensitive, DeprecationMessage: a.DeprecationMessage, Computed: a.Computed, Validators: a.Validators}
return dataschema.BoolAttribute{
Optional: a.Optional,
Required: a.Required,
Sensitive: a.Sensitive,
DeprecationMessage: a.DeprecationMessage,
Computed: a.Computed,
Validators: a.Validators,
}
}

func (a BoolAttributeBuilder) BuildResourceAttribute() schema.Attribute {
return schema.BoolAttribute{Optional: a.Optional, Required: a.Required, Sensitive: a.Sensitive, DeprecationMessage: a.DeprecationMessage, Computed: a.Computed, Validators: a.Validators}
return schema.BoolAttribute{
Optional: a.Optional,
Required: a.Required,
Sensitive: a.Sensitive,
DeprecationMessage: a.DeprecationMessage,
Computed: a.Computed,
Validators: a.Validators,
}
}

func (a BoolAttributeBuilder) SetOptional() AttributeBuilder {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,25 @@ type Float64AttributeBuilder struct {
}

func (a Float64AttributeBuilder) BuildDataSourceAttribute() dataschema.Attribute {
return dataschema.Float64Attribute{Optional: a.Optional, Required: a.Required, Sensitive: a.Sensitive, DeprecationMessage: a.DeprecationMessage, Computed: a.Computed, Validators: a.Validators}
return dataschema.Float64Attribute{
Optional: a.Optional,
Required: a.Required,
Sensitive: a.Sensitive,
DeprecationMessage: a.DeprecationMessage,
Computed: a.Computed,
Validators: a.Validators,
}
}

func (a Float64AttributeBuilder) BuildResourceAttribute() schema.Attribute {
return schema.Float64Attribute{Optional: a.Optional, Required: a.Required, Sensitive: a.Sensitive, DeprecationMessage: a.DeprecationMessage, Computed: a.Computed, Validators: a.Validators}
return schema.Float64Attribute{
Optional: a.Optional,
Required: a.Required,
Sensitive: a.Sensitive,
DeprecationMessage: a.DeprecationMessage,
Computed: a.Computed,
Validators: a.Validators,
}
}

func (a Float64AttributeBuilder) SetOptional() AttributeBuilder {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,25 @@ type Int64AttributeBuilder struct {
}

func (a Int64AttributeBuilder) BuildDataSourceAttribute() dataschema.Attribute {
return dataschema.Int64Attribute{Optional: a.Optional, Required: a.Required, Sensitive: a.Sensitive, DeprecationMessage: a.DeprecationMessage, Computed: a.Computed, Validators: a.Validators}
return dataschema.Int64Attribute{
Optional: a.Optional,
Required: a.Required,
Sensitive: a.Sensitive,
DeprecationMessage: a.DeprecationMessage,
Computed: a.Computed,
Validators: a.Validators,
}
}

func (a Int64AttributeBuilder) BuildResourceAttribute() schema.Attribute {
return schema.Int64Attribute{Optional: a.Optional, Required: a.Required, Sensitive: a.Sensitive, DeprecationMessage: a.DeprecationMessage, Computed: a.Computed, Validators: a.Validators}
return schema.Int64Attribute{
Optional: a.Optional,
Required: a.Required,
Sensitive: a.Sensitive,
DeprecationMessage: a.DeprecationMessage,
Computed: a.Computed,
Validators: a.Validators,
}
}

func (a Int64AttributeBuilder) SetOptional() AttributeBuilder {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,27 @@ type ListAttributeBuilder struct {
}

func (a ListAttributeBuilder) BuildDataSourceAttribute() dataschema.Attribute {
return dataschema.ListAttribute{ElementType: a.ElementType, Optional: a.Optional, Required: a.Required, Sensitive: a.Sensitive, DeprecationMessage: a.DeprecationMessage, Computed: a.Computed, Validators: a.Validators}
return dataschema.ListAttribute{
ElementType: a.ElementType,
Optional: a.Optional,
Required: a.Required,
Sensitive: a.Sensitive,
DeprecationMessage: a.DeprecationMessage,
Computed: a.Computed,
Validators: a.Validators,
}
}

func (a ListAttributeBuilder) BuildResourceAttribute() schema.Attribute {
return schema.ListAttribute{ElementType: a.ElementType, Optional: a.Optional, Required: a.Required, Sensitive: a.Sensitive, DeprecationMessage: a.DeprecationMessage, Computed: a.Computed, Validators: a.Validators}
return schema.ListAttribute{
ElementType: a.ElementType,
Optional: a.Optional,
Required: a.Required,
Sensitive: a.Sensitive,
DeprecationMessage: a.DeprecationMessage,
Computed: a.Computed,
Validators: a.Validators,
}
}

func (a ListAttributeBuilder) SetOptional() AttributeBuilder {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,27 @@ type ListNestedAttributeBuilder struct {
}

func (a ListNestedAttributeBuilder) BuildDataSourceAttribute() dataschema.Attribute {
return dataschema.ListNestedAttribute{NestedObject: a.NestedObject.BuildDataSourceAttribute(), Optional: a.Optional, Required: a.Required, Sensitive: a.Sensitive, DeprecationMessage: a.DeprecationMessage, Computed: a.Computed, Validators: a.Validators}
return dataschema.ListNestedAttribute{
NestedObject: a.NestedObject.BuildDataSourceAttribute(),
Optional: a.Optional,
Required: a.Required,
Sensitive: a.Sensitive,
DeprecationMessage: a.DeprecationMessage,
Computed: a.Computed,
Validators: a.Validators,
}
}

func (a ListNestedAttributeBuilder) BuildResourceAttribute() schema.Attribute {
return schema.ListNestedAttribute{NestedObject: a.NestedObject.BuildResourceAttribute(), Optional: a.Optional, Required: a.Required, Sensitive: a.Sensitive, DeprecationMessage: a.DeprecationMessage, Computed: a.Computed, Validators: a.Validators}
return schema.ListNestedAttribute{
NestedObject: a.NestedObject.BuildResourceAttribute(),
Optional: a.Optional,
Required: a.Required,
Sensitive: a.Sensitive,
DeprecationMessage: a.DeprecationMessage,
Computed: a.Computed,
Validators: a.Validators,
}
}

func (a ListNestedAttributeBuilder) SetOptional() AttributeBuilder {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,27 @@ type MapAttributeBuilder struct {
}

func (a MapAttributeBuilder) BuildDataSourceAttribute() dataschema.Attribute {
return dataschema.MapAttribute{ElementType: a.ElementType, Optional: a.Optional, Required: a.Required, Sensitive: a.Sensitive, DeprecationMessage: a.DeprecationMessage, Computed: a.Computed, Validators: a.Validators}
return dataschema.MapAttribute{
ElementType: a.ElementType,
Optional: a.Optional,
Required: a.Required,
Sensitive: a.Sensitive,
DeprecationMessage: a.DeprecationMessage,
Computed: a.Computed,
Validators: a.Validators,
}
}

func (a MapAttributeBuilder) BuildResourceAttribute() schema.Attribute {
return schema.MapAttribute{ElementType: a.ElementType, Optional: a.Optional, Required: a.Required, Sensitive: a.Sensitive, DeprecationMessage: a.DeprecationMessage, Computed: a.Computed, Validators: a.Validators}
return schema.MapAttribute{
ElementType: a.ElementType,
Optional: a.Optional,
Required: a.Required,
Sensitive: a.Sensitive,
DeprecationMessage: a.DeprecationMessage,
Computed: a.Computed,
Validators: a.Validators,
}
}

func (a MapAttributeBuilder) SetOptional() AttributeBuilder {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,27 @@ type MapNestedAttributeBuilder struct {
}

func (a MapNestedAttributeBuilder) BuildDataSourceAttribute() dataschema.Attribute {
return dataschema.MapNestedAttribute{NestedObject: a.NestedObject.BuildDataSourceAttribute(), Optional: a.Optional, Required: a.Required, Sensitive: a.Sensitive, DeprecationMessage: a.DeprecationMessage, Computed: a.Computed, Validators: a.Validators}
return dataschema.MapNestedAttribute{
NestedObject: a.NestedObject.BuildDataSourceAttribute(),
Optional: a.Optional,
Required: a.Required,
Sensitive: a.Sensitive,
DeprecationMessage: a.DeprecationMessage,
Computed: a.Computed,
Validators: a.Validators,
}
}

func (a MapNestedAttributeBuilder) BuildResourceAttribute() schema.Attribute {
return schema.MapNestedAttribute{NestedObject: a.NestedObject.BuildResourceAttribute(), Optional: a.Optional, Required: a.Required, Sensitive: a.Sensitive, DeprecationMessage: a.DeprecationMessage, Computed: a.Computed, Validators: a.Validators}
return schema.MapNestedAttribute{
NestedObject: a.NestedObject.BuildResourceAttribute(),
Optional: a.Optional,
Required: a.Required,
Sensitive: a.Sensitive,
DeprecationMessage: a.DeprecationMessage,
Computed: a.Computed,
Validators: a.Validators,
}
}

func (a MapNestedAttributeBuilder) SetOptional() AttributeBuilder {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,27 @@ type SingleNestedAttributeBuilder struct {
}

func (a SingleNestedAttributeBuilder) BuildDataSourceAttribute() dataschema.Attribute {
return dataschema.SingleNestedAttribute{Attributes: BuildDataSourceAttributeMap(a.Attributes), Optional: a.Optional, Required: a.Required, Sensitive: a.Sensitive, DeprecationMessage: a.DeprecationMessage, Computed: a.Computed, Validators: a.Validators}
return dataschema.SingleNestedAttribute{
Attributes: BuildDataSourceAttributeMap(a.Attributes),
Optional: a.Optional,
Required: a.Required,
Sensitive: a.Sensitive,
DeprecationMessage: a.DeprecationMessage,
Computed: a.Computed,
Validators: a.Validators,
}
}

func (a SingleNestedAttributeBuilder) BuildResourceAttribute() schema.Attribute {
return schema.SingleNestedAttribute{Attributes: BuildResourceAttributeMap(a.Attributes), Optional: a.Optional, Required: a.Required, Sensitive: a.Sensitive, DeprecationMessage: a.DeprecationMessage, Computed: a.Computed, Validators: a.Validators}
return schema.SingleNestedAttribute{
Attributes: BuildResourceAttributeMap(a.Attributes),
Optional: a.Optional,
Required: a.Required,
Sensitive: a.Sensitive,
DeprecationMessage: a.DeprecationMessage,
Computed: a.Computed,
Validators: a.Validators,
}
}

func (a SingleNestedAttributeBuilder) SetOptional() AttributeBuilder {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,25 @@ type StringAttributeBuilder struct {
}

func (a StringAttributeBuilder) BuildDataSourceAttribute() dataschema.Attribute {
return dataschema.StringAttribute{Optional: a.Optional, Required: a.Required, Sensitive: a.Sensitive, DeprecationMessage: a.DeprecationMessage, Computed: a.Computed, Validators: a.Validators}
return dataschema.StringAttribute{
Optional: a.Optional,
Required: a.Required,
Sensitive: a.Sensitive,
DeprecationMessage: a.DeprecationMessage,
Computed: a.Computed,
Validators: a.Validators,
}
}

func (a StringAttributeBuilder) BuildResourceAttribute() schema.Attribute {
return schema.StringAttribute{Optional: a.Optional, Required: a.Required, Sensitive: a.Sensitive, DeprecationMessage: a.DeprecationMessage, Computed: a.Computed, Validators: a.Validators}
return schema.StringAttribute{
Optional: a.Optional,
Required: a.Required,
Sensitive: a.Sensitive,
DeprecationMessage: a.DeprecationMessage,
Computed: a.Computed,
Validators: a.Validators,
}
}

func (a StringAttributeBuilder) SetOptional() AttributeBuilder {
Expand Down

0 comments on commit 664d4d5

Please sign in to comment.