Skip to content

Commit

Permalink
Rename symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
Henrique Santos committed Sep 21, 2023
1 parent 8ae740e commit 6fba9fb
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 65 deletions.
26 changes: 13 additions & 13 deletions stackit/services/logme/credentials/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ import (

// Ensure the implementation satisfies the expected interfaces.
var (
_ resource.Resource = &logMeCredentialsResource{}
_ resource.ResourceWithConfigure = &logMeCredentialsResource{}
_ resource.ResourceWithImportState = &logMeCredentialsResource{}
_ resource.Resource = &credentialsResource{}
_ resource.ResourceWithConfigure = &credentialsResource{}
_ resource.ResourceWithImportState = &credentialsResource{}
)

type Model struct {
Expand All @@ -47,21 +47,21 @@ type Model struct {

// NewCredentialsResource is a helper function to simplify the provider implementation.
func NewCredentialsResource() resource.Resource {
return &logMeCredentialsResource{}
return &credentialsResource{}
}

// credentialsResource is the resource implementation.
type logMeCredentialsResource struct {
type credentialsResource struct {
client *logme.APIClient
}

// Metadata returns the resource type name.
func (r *logMeCredentialsResource) Metadata(_ context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) {
func (r *credentialsResource) Metadata(_ context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) {
resp.TypeName = req.ProviderTypeName + "_logme_credentials"
}

// Configure adds the provider configured client to the resource.
func (r *logMeCredentialsResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) {
func (r *credentialsResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) {
// Prevent panic if the provider has not been configured.
if req.ProviderData == nil {
return
Expand Down Expand Up @@ -97,7 +97,7 @@ func (r *logMeCredentialsResource) Configure(ctx context.Context, req resource.C
}

// Schema defines the schema for the resource.
func (r *logMeCredentialsResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) {
func (r *credentialsResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) {
descriptions := map[string]string{
"main": "LogMe credentials resource schema.",
"id": "Terraform's internal resource identifier. It is structured as \"`project_id`,`instance_id`,`credentials_id`\".",
Expand Down Expand Up @@ -182,7 +182,7 @@ func (r *logMeCredentialsResource) Schema(_ context.Context, _ resource.SchemaRe
}

// Create creates the resource and sets the initial Terraform state.
func (r *logMeCredentialsResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { // nolint:gocritic // function signature required by Terraform
func (r *credentialsResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { // nolint:gocritic // function signature required by Terraform
var model Model
diags := req.Plan.Get(ctx, &model)
resp.Diagnostics.Append(diags...)
Expand Down Expand Up @@ -233,7 +233,7 @@ func (r *logMeCredentialsResource) Create(ctx context.Context, req resource.Crea
}

// Read refreshes the Terraform state with the latest data.
func (r *logMeCredentialsResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { // nolint:gocritic // function signature required by Terraform
func (r *credentialsResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { // nolint:gocritic // function signature required by Terraform
var model Model
diags := req.State.Get(ctx, &model)
resp.Diagnostics.Append(diags...)
Expand Down Expand Up @@ -270,13 +270,13 @@ func (r *logMeCredentialsResource) Read(ctx context.Context, req resource.ReadRe
}

// Update updates the resource and sets the updated Terraform state on success.
func (r *logMeCredentialsResource) Update(ctx context.Context, _ resource.UpdateRequest, resp *resource.UpdateResponse) { // nolint:gocritic // function signature required by Terraform
func (r *credentialsResource) Update(ctx context.Context, _ resource.UpdateRequest, resp *resource.UpdateResponse) { // nolint:gocritic // function signature required by Terraform
// Update shouldn't be called
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating credentials", "Credentials can't be updated")
}

// Delete deletes the resource and removes the Terraform state on success.
func (r *logMeCredentialsResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { // nolint:gocritic // function signature required by Terraform
func (r *credentialsResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { // nolint:gocritic // function signature required by Terraform
var model Model
diags := req.State.Get(ctx, &model)
resp.Diagnostics.Append(diags...)
Expand Down Expand Up @@ -306,7 +306,7 @@ func (r *logMeCredentialsResource) Delete(ctx context.Context, req resource.Dele

// ImportState imports a resource into the Terraform state on success.
// The expected format of the resource import identifier is: project_id,instance_id,credentials_id
func (r *logMeCredentialsResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) {
func (r *credentialsResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) {
idParts := strings.Split(req.ID, core.Separator)
if len(idParts) != 3 || idParts[0] == "" || idParts[1] == "" || idParts[2] == "" {
core.LogAndAddError(ctx, &resp.Diagnostics,
Expand Down
26 changes: 13 additions & 13 deletions stackit/services/mariadb/credentials/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ import (

// Ensure the implementation satisfies the expected interfaces.
var (
_ resource.Resource = &mariaDBCredentialsResource{}
_ resource.ResourceWithConfigure = &mariaDBCredentialsResource{}
_ resource.ResourceWithImportState = &mariaDBCredentialsResource{}
_ resource.Resource = &credentialsResource{}
_ resource.ResourceWithConfigure = &credentialsResource{}
_ resource.ResourceWithImportState = &credentialsResource{}
)

type Model struct {
Expand All @@ -47,21 +47,21 @@ type Model struct {

// NewCredentialsResource is a helper function to simplify the provider implementation.
func NewCredentialsResource() resource.Resource {
return &mariaDBCredentialsResource{}
return &credentialsResource{}
}

// credentialsResource is the resource implementation.
type mariaDBCredentialsResource struct {
type credentialsResource struct {
client *mariadb.APIClient
}

// Metadata returns the resource type name.
func (r *mariaDBCredentialsResource) Metadata(_ context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) {
func (r *credentialsResource) Metadata(_ context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) {
resp.TypeName = req.ProviderTypeName + "_mariadb_credentials"
}

// Configure adds the provider configured client to the resource.
func (r *mariaDBCredentialsResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) {
func (r *credentialsResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) {
// Prevent panic if the provider has not been configured.
if req.ProviderData == nil {
return
Expand Down Expand Up @@ -97,7 +97,7 @@ func (r *mariaDBCredentialsResource) Configure(ctx context.Context, req resource
}

// Schema defines the schema for the resource.
func (r *mariaDBCredentialsResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) {
func (r *credentialsResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) {
descriptions := map[string]string{
"main": "MariaDB credentials resource schema.",
"id": "Terraform's internal resource identifier. It is structured as \"`project_id`,`instance_id`,`credentials_id`\".",
Expand Down Expand Up @@ -182,7 +182,7 @@ func (r *mariaDBCredentialsResource) Schema(_ context.Context, _ resource.Schema
}

// Create creates the resource and sets the initial Terraform state.
func (r *mariaDBCredentialsResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { // nolint:gocritic // function signature required by Terraform
func (r *credentialsResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { // nolint:gocritic // function signature required by Terraform
var model Model
diags := req.Plan.Get(ctx, &model)
resp.Diagnostics.Append(diags...)
Expand Down Expand Up @@ -233,7 +233,7 @@ func (r *mariaDBCredentialsResource) Create(ctx context.Context, req resource.Cr
}

// Read refreshes the Terraform state with the latest data.
func (r *mariaDBCredentialsResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { // nolint:gocritic // function signature required by Terraform
func (r *credentialsResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { // nolint:gocritic // function signature required by Terraform
var model Model
diags := req.State.Get(ctx, &model)
resp.Diagnostics.Append(diags...)
Expand Down Expand Up @@ -270,13 +270,13 @@ func (r *mariaDBCredentialsResource) Read(ctx context.Context, req resource.Read
}

// Update updates the resource and sets the updated Terraform state on success.
func (r *mariaDBCredentialsResource) Update(ctx context.Context, _ resource.UpdateRequest, resp *resource.UpdateResponse) { // nolint:gocritic // function signature required by Terraform
func (r *credentialsResource) Update(ctx context.Context, _ resource.UpdateRequest, resp *resource.UpdateResponse) { // nolint:gocritic // function signature required by Terraform
// Update shouldn't be called
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating credentials", "Credentials can't be updated")
}

// Delete deletes the resource and removes the Terraform state on success.
func (r *mariaDBCredentialsResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { // nolint:gocritic // function signature required by Terraform
func (r *credentialsResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { // nolint:gocritic // function signature required by Terraform
var model Model
diags := req.State.Get(ctx, &model)
resp.Diagnostics.Append(diags...)
Expand Down Expand Up @@ -306,7 +306,7 @@ func (r *mariaDBCredentialsResource) Delete(ctx context.Context, req resource.De

// ImportState imports a resource into the Terraform state on success.
// The expected format of the resource import identifier is: project_id,instance_id,credentials_id
func (r *mariaDBCredentialsResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) {
func (r *credentialsResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) {
idParts := strings.Split(req.ID, core.Separator)
if len(idParts) != 3 || idParts[0] == "" || idParts[1] == "" || idParts[2] == "" {
core.LogAndAddError(ctx, &resp.Diagnostics,
Expand Down
26 changes: 13 additions & 13 deletions stackit/services/opensearch/credentials/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ import (

// Ensure the implementation satisfies the expected interfaces.
var (
_ resource.Resource = &openSearchCredentialsResource{}
_ resource.ResourceWithConfigure = &openSearchCredentialsResource{}
_ resource.ResourceWithImportState = &openSearchCredentialsResource{}
_ resource.Resource = &credentialsResource{}
_ resource.ResourceWithConfigure = &credentialsResource{}
_ resource.ResourceWithImportState = &credentialsResource{}
)

type Model struct {
Expand All @@ -47,21 +47,21 @@ type Model struct {

// NewCredentialsResource is a helper function to simplify the provider implementation.
func NewCredentialsResource() resource.Resource {
return &openSearchCredentialsResource{}
return &credentialsResource{}
}

// credentialsResource is the resource implementation.
type openSearchCredentialsResource struct {
type credentialsResource struct {
client *opensearch.APIClient
}

// Metadata returns the resource type name.
func (r *openSearchCredentialsResource) Metadata(_ context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) {
func (r *credentialsResource) Metadata(_ context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) {
resp.TypeName = req.ProviderTypeName + "_opensearch_credentials"
}

// Configure adds the provider configured client to the resource.
func (r *openSearchCredentialsResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) {
func (r *credentialsResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) {
// Prevent panic if the provider has not been configured.
if req.ProviderData == nil {
return
Expand Down Expand Up @@ -97,7 +97,7 @@ func (r *openSearchCredentialsResource) Configure(ctx context.Context, req resou
}

// Schema defines the schema for the resource.
func (r *openSearchCredentialsResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) {
func (r *credentialsResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) {
descriptions := map[string]string{
"main": "OpenSearch credentials resource schema.",
"id": "Terraform's internal resource identifier. It is structured as \"`project_id`,`instance_id`,`credentials_id`\".",
Expand Down Expand Up @@ -182,7 +182,7 @@ func (r *openSearchCredentialsResource) Schema(_ context.Context, _ resource.Sch
}

// Create creates the resource and sets the initial Terraform state.
func (r *openSearchCredentialsResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { // nolint:gocritic // function signature required by Terraform
func (r *credentialsResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { // nolint:gocritic // function signature required by Terraform
var model Model
diags := req.Plan.Get(ctx, &model)
resp.Diagnostics.Append(diags...)
Expand Down Expand Up @@ -233,7 +233,7 @@ func (r *openSearchCredentialsResource) Create(ctx context.Context, req resource
}

// Read refreshes the Terraform state with the latest data.
func (r *openSearchCredentialsResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { // nolint:gocritic // function signature required by Terraform
func (r *credentialsResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { // nolint:gocritic // function signature required by Terraform
var model Model
diags := req.State.Get(ctx, &model)
resp.Diagnostics.Append(diags...)
Expand Down Expand Up @@ -270,13 +270,13 @@ func (r *openSearchCredentialsResource) Read(ctx context.Context, req resource.R
}

// Update updates the resource and sets the updated Terraform state on success.
func (r *openSearchCredentialsResource) Update(ctx context.Context, _ resource.UpdateRequest, resp *resource.UpdateResponse) { // nolint:gocritic // function signature required by Terraform
func (r *credentialsResource) Update(ctx context.Context, _ resource.UpdateRequest, resp *resource.UpdateResponse) { // nolint:gocritic // function signature required by Terraform
// Update shouldn't be called
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating credentials", "Credentials can't be updated")
}

// Delete deletes the resource and removes the Terraform state on success.
func (r *openSearchCredentialsResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { // nolint:gocritic // function signature required by Terraform
func (r *credentialsResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { // nolint:gocritic // function signature required by Terraform
var model Model
diags := req.State.Get(ctx, &model)
resp.Diagnostics.Append(diags...)
Expand Down Expand Up @@ -306,7 +306,7 @@ func (r *openSearchCredentialsResource) Delete(ctx context.Context, req resource

// ImportState imports a resource into the Terraform state on success.
// The expected format of the resource import identifier is: project_id,instance_id,credentials_id
func (r *openSearchCredentialsResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) {
func (r *credentialsResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) {
idParts := strings.Split(req.ID, core.Separator)
if len(idParts) != 3 || idParts[0] == "" || idParts[1] == "" || idParts[2] == "" {
core.LogAndAddError(ctx, &resp.Diagnostics,
Expand Down
Loading

0 comments on commit 6fba9fb

Please sign in to comment.