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.
terraform-provider-dynamix/internal/service/cloudapi/image/schemas/schema_resource_image.go

198 lines
5.0 KiB

package schemas
import (
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
"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/schema/validator"
"github.com/hashicorp/terraform-plugin-framework/types"
)
func MakeSchemaResourceImage() map[string]schema.Attribute {
return map[string]schema.Attribute{
// required attributes
"image_name": schema.StringAttribute{
Required: true,
Description: "Name of the rescue disk",
},
"url": schema.StringAttribute{
Required: true,
Description: "URL where to download media from",
},
"boot_type": schema.StringAttribute{
Required: true,
Validators: []validator.String{
stringvalidator.OneOf("bios", "uefi"),
},
Description: "Boot type of image bios or uefi",
},
"image_type": schema.StringAttribute{
Required: true,
Validators: []validator.String{
stringvalidator.OneOf("linux", "windows", "other"),
},
Description: "Image type linux, windows or other",
},
"drivers": schema.ListAttribute{
Required: true,
ElementType: types.StringType,
Description: "List of types of compute suitable for image. Example: [ \"KVM_X86\" ]",
},
"account_id": schema.Int64Attribute{
Required: true,
Description: "AccountId to make the image exclusive",
},
// optional attributes
"hot_resize": schema.BoolAttribute{
Computed: true,
Optional: true,
Description: "Does this machine supports hot resize",
},
"network_interface_naming": schema.StringAttribute{
Computed: true,
},
"username": schema.StringAttribute{
Computed: true,
Optional: true,
Description: "Optional username for the image",
},
"password": schema.StringAttribute{
Computed: true,
Optional: true,
Description: "Optional password for the image",
},
"username_dl": schema.StringAttribute{
Optional: true,
Description: "Username for upload binary media",
},
"password_dl": schema.StringAttribute{
Optional: true,
Description: "Password for upload binary media",
},
"sep_id": schema.Int64Attribute{
Computed: true,
Optional: true,
Description: "Storage endpoint provider ID",
},
"pool_name": schema.StringAttribute{
Computed: true,
Optional: true,
Description: "Pool for image create",
},
"architecture": schema.StringAttribute{
Computed: true,
Optional: true,
Validators: []validator.String{
stringvalidator.OneOf("X86_64"),
},
Description: "Binary architecture of this image, one of X86_64",
},
// 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 order.",
},
"unc_path": schema.StringAttribute{
Computed: true,
},
"ckey": schema.StringAttribute{
Computed: true,
},
"acl": schema.ListAttribute{
Computed: true,
ElementType: types.StringType,
},
"bootable": schema.BoolAttribute{
Computed: true,
},
"compute_ci_id": schema.Int64Attribute{
Computed: true,
},
"cd_presented_to": schema.StringAttribute{
Computed: true,
},
"gid": schema.Int64Attribute{
Computed: true,
},
"deleted_time": schema.Int64Attribute{
Computed: true,
},
"desc": schema.StringAttribute{
Computed: true,
},
"enabled": schema.BoolAttribute{
Computed: true,
},
"guid": schema.Int64Attribute{
Computed: true,
},
"history": schema.ListNestedAttribute{
Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"guid": schema.StringAttribute{
Computed: true,
},
"id": schema.Int64Attribute{
Computed: true,
},
"timestamp": schema.Int64Attribute{
Computed: true,
},
},
},
},
"last_modified": schema.Int64Attribute{
Computed: true,
},
"link_to": schema.Int64Attribute{
Computed: true,
},
"milestones": schema.Int64Attribute{
Computed: true,
},
"image_id": schema.Int64Attribute{
Computed: true,
},
"provider_name": schema.StringAttribute{
Computed: true,
},
"purge_attempts": schema.Int64Attribute{
Computed: true,
},
"present_to": schema.ListAttribute{
Computed: true,
ElementType: types.Int64Type,
},
"res_id": schema.StringAttribute{
Computed: true,
},
"rescuecd": schema.BoolAttribute{
Computed: true,
},
"shared_with": schema.ListAttribute{
Computed: true,
ElementType: types.Int64Type,
},
"size": schema.Int64Attribute{
Computed: true,
},
"status": schema.StringAttribute{
Computed: true,
},
"tech_status": schema.StringAttribute{
Computed: true,
},
"version": schema.StringAttribute{
Computed: true,
},
}
}