@@ -16,9 +16,9 @@ import (
1616 "github.com/hashicorp/terraform-plugin-framework/tfsdk"
1717)
1818
19- // UpgradeIdentityRequest is the framework server request for the
20- // UpgradeIdentity RPC.
21- type UpgradeIdentityRequest struct {
19+ // UpgradeResourceIdentityRequest is the framework server request for the
20+ // UpgradeResourceIdentity RPC.
21+ type UpgradeResourceIdentityRequest struct {
2222 Resource resource.Resource
2323 IdentitySchema fwschema.Schema
2424 // TypeName is the type of resource that Terraform needs to upgrade the
@@ -36,15 +36,15 @@ type UpgradeIdentityRequest struct {
3636 RawState * tfprotov6.RawState
3737}
3838
39- // UpgradeIdentityResponse is the framework server response for the
40- // UpgradeIdentity RPC.
41- type UpgradeIdentityResponse struct {
39+ // UpgradeResourceIdentityResponse is the framework server response for the
40+ // UpgradeResourceIdentity RPC.
41+ type UpgradeResourceIdentityResponse struct {
4242 UpgradedIdentity * tfsdk.ResourceIdentity
4343 Diagnostics diag.Diagnostics
4444}
4545
46- // UpgradeIdentity implements the framework server UpgradeIdentity RPC.
47- func (s * Server ) UpgradeIdentity (ctx context.Context , req * UpgradeIdentityRequest , resp * UpgradeIdentityResponse ) {
46+ // UpgradeResourceIdentity implements the framework server UpgradeResourceIdentity RPC.
47+ func (s * Server ) UpgradeResourceIdentity (ctx context.Context , req * UpgradeResourceIdentityRequest , resp * UpgradeResourceIdentityResponse ) {
4848 if req == nil {
4949 return
5050 }
@@ -94,23 +94,23 @@ func (s *Server) UpgradeIdentity(ctx context.Context, req *UpgradeIdentityReques
9494 }
9595 }
9696
97- resourceWithUpgradeIdentity , ok := req .Resource .(resource.ResourceWithUpgradeIdentity )
97+ resourceWithUpgradeResourceIdentity , ok := req .Resource .(resource.ResourceWithUpgradeResourceIdentity )
9898
9999 if ! ok {
100100 resp .Diagnostics .AddError (
101101 "Unable to Upgrade Resource Identity" ,
102- "This resource was implemented without an UpgradeIdentity () method, " +
102+ "This resource was implemented without an UpgradeResourceIdentity () method, " +
103103 fmt .Sprintf ("however Terraform was expecting an implementation for version %d upgrade.\n \n " , req .Version )+
104104 "This is always an issue with the Terraform Provider and should be reported to the provider developer." ,
105105 )
106106 return
107107 }
108108
109- logging .FrameworkTrace (ctx , "Resource implements ResourceWithUpgradeIdentity " )
109+ logging .FrameworkTrace (ctx , "Resource implements ResourceWithUpgradeResourceIdentity " )
110110
111- logging .FrameworkTrace (ctx , "Calling provider defined Resource UpgradeIdentity " )
112- resourceIdentityUpgraders := resourceWithUpgradeIdentity . UpgradeIdentity (ctx )
113- logging .FrameworkTrace (ctx , "Called provider defined Resource UpgradeIdentity " )
111+ logging .FrameworkTrace (ctx , "Calling provider defined Resource UpgradeResourceIdentity " )
112+ resourceIdentityUpgraders := resourceWithUpgradeResourceIdentity . UpgradeResourceIdentity (ctx )
113+ logging .FrameworkTrace (ctx , "Called provider defined Resource UpgradeResourceIdentity " )
114114
115115 // Panic prevention
116116 if resourceIdentityUpgraders == nil {
@@ -122,27 +122,27 @@ func (s *Server) UpgradeIdentity(ctx context.Context, req *UpgradeIdentityReques
122122 if ! ok {
123123 resp .Diagnostics .AddError (
124124 "Unable to Upgrade Resource Identity" ,
125- "This resource was implemented with an UpgradeIdentity () method, " +
125+ "This resource was implemented with an UpgradeResourceIdentity () method, " +
126126 fmt .Sprintf ("however Terraform was expecting an implementation for version %d upgrade.\n \n " , req .Version )+
127127 "This is always an issue with the Terraform Provider and should be reported to the provider developer." ,
128128 )
129129 return
130130 }
131131
132- upgradeResourceIdentityRequest := resource.UpgradeIdentityRequest {
132+ upgradeResourceIdentityRequest := resource.UpgradeResourceIdentityRequest {
133133 RawIdentity : req .RawState ,
134134 }
135135
136136 if resourceIdentityUpgrader .PriorSchema != nil {
137- logging .FrameworkTrace (ctx , "Initializing populated UpgradeIdentityRequest Identity from provider defined prior schema and request RawState" )
137+ logging .FrameworkTrace (ctx , "Initializing populated UpgradeResourceIdentityRequest Identity from provider defined prior schema and request RawState" )
138138
139139 priorSchemaType := resourceIdentityUpgrader .PriorSchema .Type ().TerraformType (ctx )
140140
141141 rawIdentityValue , err := req .RawState .UnmarshalWithOpts (priorSchemaType , unmarshalOpts )
142142
143143 if err != nil {
144144 resp .Diagnostics .AddError (
145- "Unable to Read Previously Saved Identity for UpgradeIdentity " ,
145+ "Unable to Read Previously Saved Identity for UpgradeResourceIdentity " ,
146146 fmt .Sprintf ("There was an error reading the saved resource Identity using the prior resource schema defined for version %d upgrade.\n \n " , req .Version )+
147147 "Please report this to the provider developer:\n \n " + err .Error (),
148148 )
@@ -156,7 +156,7 @@ func (s *Server) UpgradeIdentity(ctx context.Context, req *UpgradeIdentityReques
156156
157157 }
158158
159- upgradeResourceIdentityResponse := resource.UpgradeIdentityResponse {
159+ upgradeResourceIdentityResponse := resource.UpgradeResourceIdentityResponse {
160160 Identity : & tfsdk.ResourceIdentity {
161161 Schema : req .IdentitySchema ,
162162 // Raw is intentionally not set.
0 commit comments