You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
213 lines
5.0 KiB
213 lines
5.0 KiB
7 months ago
|
package schemas
|
||
|
|
||
|
import (
|
||
|
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
|
||
|
"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"
|
||
|
)
|
||
|
|
||
|
func MakeSchemaResourceAccount() map[string]schema.Attribute {
|
||
|
return map[string]schema.Attribute{
|
||
|
// required attributes
|
||
|
"account_name": schema.StringAttribute{
|
||
|
Required: true,
|
||
|
Description: "name of the account",
|
||
|
},
|
||
|
"username": schema.StringAttribute{
|
||
|
Required: true,
|
||
|
Description: "username of owner the account",
|
||
|
},
|
||
|
|
||
|
// optional attributes
|
||
|
"emailaddress": schema.StringAttribute{
|
||
|
Optional: true,
|
||
|
Description: "email",
|
||
|
},
|
||
|
"send_access_emails": schema.BoolAttribute{
|
||
|
Optional: true,
|
||
|
Description: "if true send emails when a user is granted access to resources",
|
||
|
},
|
||
|
"users": schema.ListNestedAttribute{
|
||
|
Optional: true,
|
||
|
NestedObject: schema.NestedAttributeObject{
|
||
|
Attributes: map[string]schema.Attribute{
|
||
|
"user_id": schema.StringAttribute{
|
||
|
Required: true,
|
||
|
},
|
||
|
"access_type": schema.StringAttribute{
|
||
|
Required: true,
|
||
|
},
|
||
|
},
|
||
|
},
|
||
|
},
|
||
|
"restore": schema.BoolAttribute{
|
||
|
Optional: true,
|
||
|
Description: "restore a deleted account",
|
||
|
},
|
||
|
"permanently": schema.BoolAttribute{
|
||
|
Optional: true,
|
||
|
Description: "whether to completely delete the account",
|
||
|
// default is false
|
||
|
},
|
||
|
"enable": schema.BoolAttribute{
|
||
|
Optional: true,
|
||
|
Description: "enable/disable account",
|
||
|
},
|
||
|
"resource_limits": schema.SingleNestedAttribute{
|
||
|
Optional: true,
|
||
|
Computed: true,
|
||
|
Attributes: map[string]schema.Attribute{
|
||
|
"cu_c": schema.Float64Attribute{
|
||
|
Optional: true,
|
||
|
Computed: true,
|
||
|
},
|
||
|
"cu_d": schema.Float64Attribute{
|
||
|
Optional: true,
|
||
|
Computed: true,
|
||
|
},
|
||
|
"cu_i": schema.Float64Attribute{
|
||
|
Optional: true,
|
||
|
Computed: true,
|
||
|
},
|
||
|
"cu_m": schema.Float64Attribute{
|
||
|
Optional: true,
|
||
|
Computed: true,
|
||
|
},
|
||
|
"cu_np": schema.Float64Attribute{
|
||
|
Optional: true,
|
||
|
Computed: true,
|
||
|
},
|
||
|
"gpu_units": schema.Float64Attribute{
|
||
|
Optional: true,
|
||
|
Computed: true,
|
||
|
},
|
||
|
},
|
||
|
},
|
||
|
|
||
|
// computed attributes
|
||
|
"id": schema.StringAttribute{
|
||
|
Computed: true,
|
||
|
PlanModifiers: []planmodifier.String{
|
||
|
stringplanmodifier.UseStateForUnknown(),
|
||
|
},
|
||
|
},
|
||
|
"last_updated": schema.StringAttribute{
|
||
|
Computed: true,
|
||
|
Description: "Timestamp of the last Terraform update of the disk resource.",
|
||
|
},
|
||
|
"account_id": schema.Int64Attribute{
|
||
|
Computed: true,
|
||
|
},
|
||
|
"dc_location": schema.StringAttribute{
|
||
|
Computed: true,
|
||
|
},
|
||
|
"ckey": schema.StringAttribute{
|
||
|
Computed: true,
|
||
|
},
|
||
|
"acl": schema.ListNestedAttribute{
|
||
|
Computed: true,
|
||
|
NestedObject: schema.NestedAttributeObject{
|
||
|
Attributes: map[string]schema.Attribute{
|
||
|
"can_be_deleted": schema.BoolAttribute{
|
||
|
Computed: true,
|
||
|
},
|
||
|
"explicit": schema.BoolAttribute{
|
||
|
Computed: true,
|
||
|
},
|
||
|
"guid": schema.StringAttribute{
|
||
|
Computed: true,
|
||
|
},
|
||
|
"right": schema.StringAttribute{
|
||
|
Computed: true,
|
||
|
},
|
||
|
"status": schema.StringAttribute{
|
||
|
Computed: true,
|
||
|
},
|
||
|
"type": schema.StringAttribute{
|
||
|
Computed: true,
|
||
|
},
|
||
|
"user_group_id": schema.StringAttribute{
|
||
|
Computed: true,
|
||
|
},
|
||
|
},
|
||
|
},
|
||
|
},
|
||
|
"company": schema.StringAttribute{
|
||
|
Computed: true,
|
||
|
},
|
||
|
"companyurl": schema.StringAttribute{
|
||
|
Computed: true,
|
||
|
},
|
||
|
"compute_features": schema.ListAttribute{
|
||
|
Computed: true,
|
||
|
ElementType: types.StringType,
|
||
|
},
|
||
|
"created_by": schema.StringAttribute{
|
||
|
Computed: true,
|
||
|
},
|
||
|
"created_time": schema.Int64Attribute{
|
||
|
Computed: true,
|
||
|
},
|
||
|
"deactivation_time": schema.Float64Attribute{
|
||
|
Computed: true,
|
||
|
},
|
||
|
"deleted_by": schema.StringAttribute{
|
||
|
Computed: true,
|
||
|
},
|
||
|
"deleted_time": schema.Int64Attribute{
|
||
|
Computed: true,
|
||
|
},
|
||
|
"displayname": schema.StringAttribute{
|
||
|
Computed: true,
|
||
|
},
|
||
|
"guid": schema.Int64Attribute{
|
||
|
Computed: true,
|
||
|
},
|
||
|
"status": schema.StringAttribute{
|
||
|
Computed: true,
|
||
|
},
|
||
|
"updated_time": schema.Int64Attribute{
|
||
|
Computed: true,
|
||
|
},
|
||
|
"version": schema.Int64Attribute{
|
||
|
Computed: true,
|
||
|
},
|
||
|
"vins": schema.ListAttribute{
|
||
|
Computed: true,
|
||
|
ElementType: types.Int64Type,
|
||
|
},
|
||
|
"computes": schema.SingleNestedAttribute{
|
||
|
Computed: true,
|
||
|
Attributes: map[string]schema.Attribute{
|
||
|
"started": schema.Int64Attribute{
|
||
|
Computed: true,
|
||
|
},
|
||
|
"stopped": schema.Int64Attribute{
|
||
|
Computed: true,
|
||
|
},
|
||
|
},
|
||
|
},
|
||
|
"machines": schema.SingleNestedAttribute{
|
||
|
Computed: true,
|
||
|
Attributes: map[string]schema.Attribute{
|
||
|
"halted": schema.Int64Attribute{
|
||
|
Computed: true,
|
||
|
},
|
||
|
"running": schema.Int64Attribute{
|
||
|
Computed: true,
|
||
|
},
|
||
|
},
|
||
|
},
|
||
|
"vinses": schema.Int64Attribute{
|
||
|
Computed: true,
|
||
|
},
|
||
|
"cpu_allocation_parameter": schema.StringAttribute{
|
||
|
Computed: true,
|
||
|
},
|
||
|
"cpu_allocation_ratio": schema.Float64Attribute{
|
||
|
Computed: true,
|
||
|
},
|
||
|
}
|
||
|
}
|