@@ -6,18 +6,19 @@ package schema
66import (
77 "context"
88
9+ "github.com/hashicorp/terraform-plugin-go/tftypes"
10+
911 "github.com/hashicorp/terraform-plugin-framework/attr"
1012 "github.com/hashicorp/terraform-plugin-framework/diag"
1113 "github.com/hashicorp/terraform-plugin-framework/internal/fwschema"
1214 "github.com/hashicorp/terraform-plugin-framework/path"
13- "github.com/hashicorp/terraform-plugin-go/tftypes"
1415)
1516
16- var _ SchemaType = UnlinkedSchema {}
17+ var _ fwschema. Schema = Schema {}
1718
18- // UnlinkedSchema defines the structure and value types of an unlinked action. An unlinked action
19+ // Schema defines the structure and value types of an action. An action currently
1920// cannot cause changes to resource state.
20- type UnlinkedSchema struct {
21+ type Schema struct {
2122 // Attributes is the mapping of underlying attribute names to attribute
2223 // definitions.
2324 //
@@ -58,78 +59,76 @@ type UnlinkedSchema struct {
5859 DeprecationMessage string
5960}
6061
61- func (s UnlinkedSchema ) isActionSchemaType () {}
62-
6362// ApplyTerraform5AttributePathStep applies the given AttributePathStep to the
6463// schema.
65- func (s UnlinkedSchema ) ApplyTerraform5AttributePathStep (step tftypes.AttributePathStep ) (any , error ) {
64+ func (s Schema ) ApplyTerraform5AttributePathStep (step tftypes.AttributePathStep ) (any , error ) {
6665 return fwschema .SchemaApplyTerraform5AttributePathStep (s , step )
6766}
6867
6968// AttributeAtPath returns the Attribute at the passed path. If the path points
7069// to an element or attribute of a complex type, rather than to an Attribute,
7170// it will return an ErrPathInsideAtomicAttribute error.
72- func (s UnlinkedSchema ) AttributeAtPath (ctx context.Context , p path.Path ) (fwschema.Attribute , diag.Diagnostics ) {
71+ func (s Schema ) AttributeAtPath (ctx context.Context , p path.Path ) (fwschema.Attribute , diag.Diagnostics ) {
7372 return fwschema .SchemaAttributeAtPath (ctx , s , p )
7473}
7574
7675// AttributeAtPath returns the Attribute at the passed path. If the path points
7776// to an element or attribute of a complex type, rather than to an Attribute,
7877// it will return an ErrPathInsideAtomicAttribute error.
79- func (s UnlinkedSchema ) AttributeAtTerraformPath (ctx context.Context , p * tftypes.AttributePath ) (fwschema.Attribute , error ) {
78+ func (s Schema ) AttributeAtTerraformPath (ctx context.Context , p * tftypes.AttributePath ) (fwschema.Attribute , error ) {
8079 return fwschema .SchemaAttributeAtTerraformPath (ctx , s , p )
8180}
8281
8382// GetAttributes returns the Attributes field value.
84- func (s UnlinkedSchema ) GetAttributes () map [string ]fwschema.Attribute {
83+ func (s Schema ) GetAttributes () map [string ]fwschema.Attribute {
8584 return schemaAttributes (s .Attributes )
8685}
8786
8887// GetBlocks returns the Blocks field value.
89- func (s UnlinkedSchema ) GetBlocks () map [string ]fwschema.Block {
88+ func (s Schema ) GetBlocks () map [string ]fwschema.Block {
9089 return schemaBlocks (s .Blocks )
9190}
9291
9392// GetDeprecationMessage returns the DeprecationMessage field value.
94- func (s UnlinkedSchema ) GetDeprecationMessage () string {
93+ func (s Schema ) GetDeprecationMessage () string {
9594 return s .DeprecationMessage
9695}
9796
9897// GetDescription returns the Description field value.
99- func (s UnlinkedSchema ) GetDescription () string {
98+ func (s Schema ) GetDescription () string {
10099 return s .Description
101100}
102101
103102// GetMarkdownDescription returns the MarkdownDescription field value.
104- func (s UnlinkedSchema ) GetMarkdownDescription () string {
103+ func (s Schema ) GetMarkdownDescription () string {
105104 return s .MarkdownDescription
106105}
107106
108107// GetVersion always returns 0 as action schemas cannot be versioned.
109- func (s UnlinkedSchema ) GetVersion () int64 {
108+ func (s Schema ) GetVersion () int64 {
110109 return 0
111110}
112111
113112// Type returns the framework type of the schema.
114- func (s UnlinkedSchema ) Type () attr.Type {
113+ func (s Schema ) Type () attr.Type {
115114 return fwschema .SchemaType (s )
116115}
117116
118117// TypeAtPath returns the framework type at the given schema path.
119- func (s UnlinkedSchema ) TypeAtPath (ctx context.Context , p path.Path ) (attr.Type , diag.Diagnostics ) {
118+ func (s Schema ) TypeAtPath (ctx context.Context , p path.Path ) (attr.Type , diag.Diagnostics ) {
120119 return fwschema .SchemaTypeAtPath (ctx , s , p )
121120}
122121
123122// TypeAtTerraformPath returns the framework type at the given tftypes path.
124- func (s UnlinkedSchema ) TypeAtTerraformPath (ctx context.Context , p * tftypes.AttributePath ) (attr.Type , error ) {
123+ func (s Schema ) TypeAtTerraformPath (ctx context.Context , p * tftypes.AttributePath ) (attr.Type , error ) {
125124 return fwschema .SchemaTypeAtTerraformPath (ctx , s , p )
126125}
127126
128127// ValidateImplementation contains logic for validating the provider-defined
129128// implementation of the schema and underlying attributes and blocks to prevent
130129// unexpected errors or panics. This logic runs during the GetProviderSchema RPC,
131130// or via provider-defined unit testing, and should never include false positives.
132- func (s UnlinkedSchema ) ValidateImplementation (ctx context.Context ) diag.Diagnostics {
131+ func (s Schema ) ValidateImplementation (ctx context.Context ) diag.Diagnostics {
133132 var diags diag.Diagnostics
134133
135134 for attributeName , attribute := range s .GetAttributes () {
0 commit comments