Skip to content

Commit

Permalink
fix: Fixed golint
Browse files Browse the repository at this point in the history
  • Loading branch information
YanniHu1996 committed Jun 8, 2023
1 parent f39d924 commit 4072841
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions pkg/provider/resource_region.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type regionResource struct {
client *api.API
}

func (r regionResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) {
func (r *regionResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) {
resp.Schema = fschema.Schema{
MarkdownDescription: "The region resource is used to manage regions for a given cloud provider. See [Activating regions](https://www.enterprisedb.com/docs/biganimal/latest/getting_started/activating_regions/) for more details.",
Blocks: map[string]fschema.Block{
Expand Down Expand Up @@ -87,11 +87,11 @@ type Region struct {
Timeouts timeouts.Value `tfsdk:"timeouts"`
}

func (r regionResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) {
func (r *regionResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) {
resp.TypeName = req.ProviderTypeName + "_region"
}

func (r regionResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) {
func (r *regionResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) {
var config Region
diags := req.Config.Get(ctx, &config)
resp.Diagnostics.Append(diags...)
Expand All @@ -101,10 +101,9 @@ func (r regionResource) Create(ctx context.Context, req resource.CreateRequest,

diags = r.update(ctx, config, resp.State)
resp.Diagnostics.Append(diags...)
return
}

func (r regionResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) {
func (r *regionResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) {
var state Region
diags := req.State.Get(ctx, &state)
resp.Diagnostics.Append(diags...)
Expand All @@ -115,7 +114,7 @@ func (r regionResource) Read(ctx context.Context, req resource.ReadRequest, resp
resp.Diagnostics.Append(r.read(ctx, state, resp.State)...)
}

func (r regionResource) read(ctx context.Context, region Region, state tfsdk.State) fdiag.Diagnostics {
func (r *regionResource) read(ctx context.Context, region Region, state tfsdk.State) fdiag.Diagnostics {
read, err := r.client.RegionClient().Read(ctx, region.ProjectID, region.CloudProvider, region.RegionID)
if err != nil {
return fromErr(err, "Error reading region %v", region.RegionID)
Expand All @@ -127,7 +126,7 @@ func (r regionResource) read(ctx context.Context, region Region, state tfsdk.Sta
return state.Set(ctx, &region)
}

func (r regionResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) {
func (r *regionResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) {
var plan Region
diags := req.Plan.Get(ctx, &plan)
resp.Diagnostics.Append(diags...)
Expand All @@ -138,7 +137,7 @@ func (r regionResource) Update(ctx context.Context, req resource.UpdateRequest,
resp.Diagnostics.Append(r.update(ctx, plan, resp.State)...)
}

func (r regionResource) update(ctx context.Context, region Region, state tfsdk.State) fdiag.Diagnostics {
func (r *regionResource) update(ctx context.Context, region Region, state tfsdk.State) fdiag.Diagnostics {
current, err := r.client.RegionClient().Read(ctx, region.ProjectID, region.CloudProvider, region.RegionID)
if err != nil {
return fromErr(err, "Error reading region %v", region.RegionID)
Expand Down Expand Up @@ -169,7 +168,7 @@ func (r regionResource) update(ctx context.Context, region Region, state tfsdk.S
return r.read(ctx, region, state)
}

func (r regionResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) {
func (r *regionResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) {
var state Region
diags := req.State.Get(ctx, &state)
resp.Diagnostics.Append(diags...)
Expand Down Expand Up @@ -201,15 +200,15 @@ func (r regionResource) Delete(ctx context.Context, req resource.DeleteRequest,
}
}

func (r regionResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) {
func (r *regionResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) {
if req.ProviderData == nil {
return
}

r.client = req.ProviderData.(*api.API)
}

func (r regionResource) retryFunc(ctx context.Context, region Region) retry.RetryFunc {
func (r *regionResource) retryFunc(ctx context.Context, region Region) retry.RetryFunc {
return func() *retry.RetryError {
curr, err := r.client.RegionClient().Read(ctx, region.ProjectID, region.CloudProvider, region.RegionID)
if err != nil {
Expand Down

0 comments on commit 4072841

Please sign in to comment.