Skip to content
This repository has been archived by the owner on Jan 29, 2025. It is now read-only.

Commit

Permalink
convert all int64 types in schemas to int32
Browse files Browse the repository at this point in the history
  • Loading branch information
Luiggi33 committed Jul 31, 2024
1 parent 39fdad5 commit 86cf5b5
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 52 deletions.
24 changes: 12 additions & 12 deletions internal/provider/node_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"time"

"github.com/Luiggi33/pterodactyl-client-go"
"github.com/hashicorp/terraform-plugin-framework-validators/int64validator"
"github.com/hashicorp/terraform-plugin-framework-validators/int32validator"
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
"github.com/hashicorp/terraform-plugin-framework/datasource"
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
Expand Down Expand Up @@ -65,12 +65,12 @@ func (d *nodeDataSource) Schema(ctx context.Context, req datasource.SchemaReques
resp.Schema = schema.Schema{
Description: "The Pterodactyl node data source allows Terraform to read a nodes data from the Pterodactyl Panel API.",
Attributes: map[string]schema.Attribute{
"id": schema.Int64Attribute{
"id": schema.Int32Attribute{
Description: "The ID of the node.",
Computed: true,
Optional: true,
Validators: []validator.Int64{
int64validator.ExactlyOneOf(
Validators: []validator.Int32{
int32validator.ExactlyOneOf(
path.MatchRoot("id"),
path.MatchRoot("uuid"),
path.MatchRoot("name"),
Expand Down Expand Up @@ -109,7 +109,7 @@ func (d *nodeDataSource) Schema(ctx context.Context, req datasource.SchemaReques
Description: "The description of the node.",
Computed: true,
},
"location_id": schema.Int64Attribute{
"location_id": schema.Int32Attribute{
Description: "The location ID of the node.",
Computed: true,
},
Expand All @@ -129,31 +129,31 @@ func (d *nodeDataSource) Schema(ctx context.Context, req datasource.SchemaReques
Description: "The maintenance mode status of the node.",
Computed: true,
},
"memory": schema.Int64Attribute{
"memory": schema.Int32Attribute{
Description: "The memory of the node.",
Computed: true,
},
"memory_overallocate": schema.Int64Attribute{
"memory_overallocate": schema.Int32Attribute{
Description: "The memory overallocate of the node.",
Computed: true,
},
"disk": schema.Int64Attribute{
"disk": schema.Int32Attribute{
Description: "The disk of the node.",
Computed: true,
},
"disk_overallocate": schema.Int64Attribute{
"disk_overallocate": schema.Int32Attribute{
Description: "The disk overallocate of the node.",
Computed: true,
},
"upload_size": schema.Int64Attribute{
"upload_size": schema.Int32Attribute{
Description: "The upload size of the node.",
Computed: true,
},
"daemon_listen": schema.Int64Attribute{
"daemon_listen": schema.Int32Attribute{
Description: "The daemon listen of the node.",
Computed: true,
},
"daemon_sftp": schema.Int64Attribute{
"daemon_sftp": schema.Int32Attribute{
Description: "The daemon SFTP of the node.",
Computed: true,
},
Expand Down
24 changes: 12 additions & 12 deletions internal/provider/node_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/Luiggi33/pterodactyl-client-go"
"github.com/hashicorp/terraform-plugin-framework/resource"
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/int64planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/int32planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/types"
Expand Down Expand Up @@ -64,11 +64,11 @@ func (r *nodeResource) Schema(_ context.Context, _ resource.SchemaRequest, resp
resp.Schema = schema.Schema{
Description: "The Pterodactyl node resource allows Terraform to manage nodes in the Pterodactyl Panel API.",
Attributes: map[string]schema.Attribute{
"id": schema.Int64Attribute{
"id": schema.Int32Attribute{
Description: "The ID of the node.",
Computed: true,
PlanModifiers: []planmodifier.Int64{
int64planmodifier.UseStateForUnknown(),
PlanModifiers: []planmodifier.Int32{
int32planmodifier.UseStateForUnknown(),
},
},
"name": schema.StringAttribute{
Expand All @@ -91,7 +91,7 @@ func (r *nodeResource) Schema(_ context.Context, _ resource.SchemaRequest, resp
Description: "The maintenance mode status of the node.",
Required: true,
},
"location_id": schema.Int64Attribute{
"location_id": schema.Int32Attribute{
Description: "The location ID of the node.",
Required: true,
},
Expand All @@ -103,31 +103,31 @@ func (r *nodeResource) Schema(_ context.Context, _ resource.SchemaRequest, resp
Description: "The scheme of the node.",
Required: true,
},
"memory": schema.Int64Attribute{
"memory": schema.Int32Attribute{
Description: "The memory of the node.",
Required: true,
},
"memory_overallocate": schema.Int64Attribute{
"memory_overallocate": schema.Int32Attribute{
Description: "The memory overallocate of the node.",
Required: true,
},
"disk": schema.Int64Attribute{
"disk": schema.Int32Attribute{
Description: "The disk of the node.",
Required: true,
},
"disk_overallocate": schema.Int64Attribute{
"disk_overallocate": schema.Int32Attribute{
Description: "The disk overallocate of the node.",
Required: true,
},
"upload_size": schema.Int64Attribute{
"upload_size": schema.Int32Attribute{
Description: "The upload size of the node.",
Required: true,
},
"daemon_sftp": schema.Int64Attribute{
"daemon_sftp": schema.Int32Attribute{
Description: "The daemon SFTP of the node.",
Required: true,
},
"daemon_listen": schema.Int64Attribute{
"daemon_listen": schema.Int32Attribute{
Description: "The daemon listen of the node.",
Required: true,
},
Expand Down
18 changes: 9 additions & 9 deletions internal/provider/nodes_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func (d *nodesDataSource) Schema(ctx context.Context, req datasource.SchemaReque
Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"id": schema.Int64Attribute{
"id": schema.Int32Attribute{
Description: "The ID of the node.",
Computed: true,
},
Expand All @@ -91,7 +91,7 @@ func (d *nodesDataSource) Schema(ctx context.Context, req datasource.SchemaReque
Description: "The description of the node.",
Computed: true,
},
"location_id": schema.Int64Attribute{
"location_id": schema.Int32Attribute{
Description: "The location ID of the node.",
Computed: true,
},
Expand All @@ -111,31 +111,31 @@ func (d *nodesDataSource) Schema(ctx context.Context, req datasource.SchemaReque
Description: "The maintenance mode status of the node.",
Computed: true,
},
"memory": schema.Int64Attribute{
"memory": schema.Int32Attribute{
Description: "The memory of the node.",
Computed: true,
},
"memory_overallocate": schema.Int64Attribute{
"memory_overallocate": schema.Int32Attribute{
Description: "The memory overallocate of the node.",
Computed: true,
},
"disk": schema.Int64Attribute{
"disk": schema.Int32Attribute{
Description: "The disk of the node.",
Computed: true,
},
"disk_overallocate": schema.Int64Attribute{
"disk_overallocate": schema.Int32Attribute{
Description: "The disk overallocate of the node.",
Computed: true,
},
"upload_size": schema.Int64Attribute{
"upload_size": schema.Int32Attribute{
Description: "The upload size of the node.",
Computed: true,
},
"daemon_listen": schema.Int64Attribute{
"daemon_listen": schema.Int32Attribute{
Description: "The daemon listen of the node.",
Computed: true,
},
"daemon_sftp": schema.Int64Attribute{
"daemon_sftp": schema.Int32Attribute{
Description: "The daemon SFTP of the node.",
Computed: true,
},
Expand Down
20 changes: 10 additions & 10 deletions internal/provider/nodes_location_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func (d *nodesLocationDataSource) Schema(ctx context.Context, req datasource.Sch
resp.Schema = schema.Schema{
Description: "The Pterodactyl nodes data source allows Terraform to read nodes from the Pterodactyl API.",
Attributes: map[string]schema.Attribute{
"location_id": schema.Int64Attribute{
"location_id": schema.Int32Attribute{
Description: "The ID of the location.",
Required: true,
},
Expand All @@ -52,7 +52,7 @@ func (d *nodesLocationDataSource) Schema(ctx context.Context, req datasource.Sch
Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"id": schema.Int64Attribute{
"id": schema.Int32Attribute{
Description: "The ID of the node.",
Computed: true,
},
Expand All @@ -72,7 +72,7 @@ func (d *nodesLocationDataSource) Schema(ctx context.Context, req datasource.Sch
Description: "The description of the node.",
Computed: true,
},
"location_id": schema.Int64Attribute{
"location_id": schema.Int32Attribute{
Description: "The location ID of the node.",
Computed: true,
},
Expand All @@ -92,31 +92,31 @@ func (d *nodesLocationDataSource) Schema(ctx context.Context, req datasource.Sch
Description: "The maintenance mode status of the node.",
Computed: true,
},
"memory": schema.Int64Attribute{
"memory": schema.Int32Attribute{
Description: "The memory of the node.",
Computed: true,
},
"memory_overallocate": schema.Int64Attribute{
"memory_overallocate": schema.Int32Attribute{
Description: "The memory overallocate of the node.",
Computed: true,
},
"disk": schema.Int64Attribute{
"disk": schema.Int32Attribute{
Description: "The disk of the node.",
Computed: true,
},
"disk_overallocate": schema.Int64Attribute{
"disk_overallocate": schema.Int32Attribute{
Description: "The disk overallocate of the node.",
Computed: true,
},
"upload_size": schema.Int64Attribute{
"upload_size": schema.Int32Attribute{
Description: "The upload size of the node.",
Computed: true,
},
"daemon_listen": schema.Int64Attribute{
"daemon_listen": schema.Int32Attribute{
Description: "The daemon listen of the node.",
Computed: true,
},
"daemon_sftp": schema.Int64Attribute{
"daemon_sftp": schema.Int32Attribute{
Description: "The daemon SFTP of the node.",
Computed: true,
},
Expand Down
8 changes: 4 additions & 4 deletions internal/provider/user_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"time"

"github.com/Luiggi33/pterodactyl-client-go"
"github.com/hashicorp/terraform-plugin-framework-validators/int64validator"
"github.com/hashicorp/terraform-plugin-framework-validators/int32validator"
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
"github.com/hashicorp/terraform-plugin-framework/datasource"
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
Expand Down Expand Up @@ -57,12 +57,12 @@ func (d *userDataSource) Schema(ctx context.Context, req datasource.SchemaReques
resp.Schema = schema.Schema{
Description: "The Pterodactyl user data source allows Terraform to read user data from the Pterodactyl Panel API.",
Attributes: map[string]schema.Attribute{
"id": schema.Int64Attribute{
"id": schema.Int32Attribute{
Description: "The ID of the user.",
Optional: true,
Computed: true,
Validators: []validator.Int64{
int64validator.ExactlyOneOf(
Validators: []validator.Int32{
int32validator.ExactlyOneOf(
path.MatchRoot("id"),
path.MatchRoot("external_id"),
path.MatchRoot("username"),
Expand Down
8 changes: 4 additions & 4 deletions internal/provider/user_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/Luiggi33/pterodactyl-client-go"
"github.com/hashicorp/terraform-plugin-framework/resource"
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/int64planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/int32planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/types"
Expand Down Expand Up @@ -53,11 +53,11 @@ func (r *userResource) Schema(_ context.Context, _ resource.SchemaRequest, resp
resp.Schema = schema.Schema{
Description: "The Pterodactyl user resource allows Terraform to manage users in the Pterodactyl Panel API.",
Attributes: map[string]schema.Attribute{
"id": schema.Int64Attribute{
"id": schema.Int32Attribute{
Description: "The ID of the user.",
Computed: true,
PlanModifiers: []planmodifier.Int64{
int64planmodifier.UseStateForUnknown(),
PlanModifiers: []planmodifier.Int32{
int32planmodifier.UseStateForUnknown(),
},
},
"username": schema.StringAttribute{
Expand Down
2 changes: 1 addition & 1 deletion internal/provider/users_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func (d *usersDataSource) Schema(ctx context.Context, req datasource.SchemaReque
Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"id": schema.Int64Attribute{
"id": schema.Int32Attribute{
Description: "The ID of the user.",
Computed: true,
},
Expand Down

0 comments on commit 86cf5b5

Please sign in to comment.