1.0.0
This commit is contained in:
@@ -0,0 +1,151 @@
|
||||
package schemas
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
|
||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||
)
|
||||
|
||||
func MakeSchemaDataSourceImage() map[string]schema.Attribute {
|
||||
return map[string]schema.Attribute{
|
||||
// required attributes
|
||||
"image_id": schema.Int64Attribute{
|
||||
Required: true,
|
||||
},
|
||||
// optional attributes
|
||||
"show_all": schema.BoolAttribute{
|
||||
Optional: true,
|
||||
},
|
||||
// computed attributes
|
||||
"id": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"unc_path": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"ckey": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"account_id": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"acl": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.StringType,
|
||||
},
|
||||
"architecture": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"boot_type": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"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,
|
||||
},
|
||||
"drivers": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.StringType,
|
||||
},
|
||||
"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,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"hot_resize": schema.BoolAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"last_modified": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"link_to": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"milestones": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"image_name": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"image_type": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"password": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"network_interface_naming": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"pool_name": schema.StringAttribute{
|
||||
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,
|
||||
},
|
||||
"sep_id": schema.Int64Attribute{
|
||||
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,
|
||||
},
|
||||
"username": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"version": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
package schemas
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
|
||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||
)
|
||||
|
||||
func MakeSchemaDataSourceImageList() map[string]schema.Attribute {
|
||||
return map[string]schema.Attribute{
|
||||
// optional attributes
|
||||
"sep_id": schema.Int64Attribute{
|
||||
Optional: true,
|
||||
},
|
||||
"by_id": schema.Int64Attribute{
|
||||
Optional: true,
|
||||
},
|
||||
"name": schema.StringAttribute{
|
||||
Optional: true,
|
||||
},
|
||||
"status": schema.StringAttribute{
|
||||
Optional: true,
|
||||
},
|
||||
"architecture": schema.StringAttribute{
|
||||
Optional: true,
|
||||
},
|
||||
"type_image": schema.StringAttribute{
|
||||
Optional: true,
|
||||
},
|
||||
"image_size": schema.Int64Attribute{
|
||||
Optional: true,
|
||||
},
|
||||
"sep_name": schema.StringAttribute{
|
||||
Optional: true,
|
||||
},
|
||||
"pool_name": schema.StringAttribute{
|
||||
Optional: true,
|
||||
},
|
||||
"public": schema.BoolAttribute{
|
||||
Optional: true,
|
||||
},
|
||||
"hot_resize": schema.BoolAttribute{
|
||||
Optional: true,
|
||||
},
|
||||
"bootable": schema.BoolAttribute{
|
||||
Optional: true,
|
||||
},
|
||||
"sort_by": schema.StringAttribute{
|
||||
Optional: true,
|
||||
Description: "sort by one of supported fields, format +|-(field)",
|
||||
},
|
||||
"page": schema.Int64Attribute{
|
||||
Optional: true,
|
||||
},
|
||||
"size": schema.Int64Attribute{
|
||||
Optional: true,
|
||||
},
|
||||
// computed attributes
|
||||
"id": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"items": schema.ListNestedAttribute{
|
||||
Computed: true,
|
||||
NestedObject: schema.NestedAttributeObject{
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"account_id": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"architecture": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"boot_type": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"bootable": schema.BoolAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"cdrom": schema.BoolAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"desc": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"drivers": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.StringType,
|
||||
},
|
||||
"hot_resize": schema.BoolAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"image_id": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"image_type": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"link_to": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"image_name": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"pool_name": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"sep_id": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"size": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"status": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"network_interface_naming": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"username": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"virtual": schema.BoolAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"entry_count": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
}
|
||||
}
|
||||
200
internal/service/cloudapi/image/schemas/schema_resource_image.go
Normal file
200
internal/service/cloudapi/image/schemas/schema_resource_image.go
Normal file
@@ -0,0 +1,200 @@
|
||||
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", "PPC64_LE"),
|
||||
},
|
||||
Description: "Binary architecture of this image, one of X86_64 of PPC64_LE",
|
||||
},
|
||||
"permanently": schema.BoolAttribute{
|
||||
Optional: 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 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,
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
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 MakeSchemaResourceImageVirtual() map[string]schema.Attribute {
|
||||
return map[string]schema.Attribute{
|
||||
// required attributes
|
||||
"image_name": schema.StringAttribute{
|
||||
Required: true,
|
||||
Description: "Name of the rescue disk",
|
||||
},
|
||||
"link_to": schema.Int64Attribute{
|
||||
Required: true,
|
||||
Description: "ID of real image to link this virtual image to upon creation",
|
||||
},
|
||||
// optional attributes
|
||||
"permanently": schema.BoolAttribute{
|
||||
Optional: 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 order.",
|
||||
},
|
||||
"unc_path": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"ckey": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"account_id": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"acl": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.StringType,
|
||||
},
|
||||
"architecture": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"boot_type": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"bootable": schema.BoolAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"compute_ci_id": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"deleted_time": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"desc": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"drivers": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.StringType,
|
||||
},
|
||||
"enabled": schema.BoolAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"gid": schema.Int64Attribute{
|
||||
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,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"hot_resize": schema.BoolAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"last_modified": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"milestones": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"image_id": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"image_type": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"password": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"pool_name": schema.StringAttribute{
|
||||
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,
|
||||
},
|
||||
"sep_id": schema.Int64Attribute{
|
||||
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,
|
||||
},
|
||||
"username": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"version": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user