/* Copyright (c) 2019-2023 Digital Energy Cloud Solutions LLC. All Rights Reserved. Authors: Petr Krutov, Stanislav Solovev, Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /* Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud Orchestration Technology) with Terraform by Hashicorp. Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort Please see README.md to learn where to place source code so that it builds seamlessly. Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki */ package image import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "repository.basistech.ru/BASIS/terraform-provider-decort/internal/statefuncs" ) func dataSourceImageListStacksSchemaMake() map[string]*schema.Schema { return map[string]*schema.Schema{ "image_id": { Type: schema.TypeInt, Required: true, Description: "image id", }, "sort_by": { Type: schema.TypeString, Optional: true, Description: "sort by one of supported fields, format +|-(field)", }, "page": { Type: schema.TypeInt, Optional: true, Description: "page number", }, "size": { Type: schema.TypeInt, Optional: true, Description: "page size", }, "name": { Type: schema.TypeString, Optional: true, Description: "find by name", }, "status": { Type: schema.TypeString, Optional: true, Description: "find by status", }, "type_image": { Type: schema.TypeString, Optional: true, Description: "find by type", }, "items": { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "ckey": { Type: schema.TypeString, Computed: true, }, "meta": { Type: schema.TypeList, Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, Description: "meta", }, "api_url": { Type: schema.TypeString, Computed: true, }, "api_key": { Type: schema.TypeString, Computed: true, }, "app_id": { Type: schema.TypeString, Computed: true, }, "cpu_allocation_ratio": { Type: schema.TypeFloat, Computed: true, }, "desc": { Type: schema.TypeString, Computed: true, }, "descr": { Type: schema.TypeString, Computed: true, }, "drivers": { Type: schema.TypeList, Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "eco": { Type: schema.TypeString, Computed: true, }, "error": { Type: schema.TypeInt, Computed: true, }, "gid": { Type: schema.TypeInt, Computed: true, }, "guid": { Type: schema.TypeInt, Computed: true, }, "id": { Type: schema.TypeInt, Computed: true, }, "images": { Type: schema.TypeList, Computed: true, Elem: &schema.Schema{ Type: schema.TypeInt, }, }, "login": { Type: schema.TypeString, Computed: true, }, "mem_allocation_ratio": { Type: schema.TypeFloat, Computed: true, }, "name": { Type: schema.TypeString, Computed: true, }, "packages": { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "libvirt_bin": { Type: schema.TypeList, Computed: true, Description: "libvirt_bin", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "installed_size": { Type: schema.TypeString, Computed: true, Description: "installed_size", }, "ver": { Type: schema.TypeString, Computed: true, Description: "ver", }, }, }, }, "libvirt_daemon": { Type: schema.TypeList, Computed: true, Description: "libvirt_daemon", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "installed_size": { Type: schema.TypeString, Computed: true, Description: "installed_size", }, "ver": { Type: schema.TypeString, Computed: true, Description: "ver", }, }, }, }, "lvm2_lockd": { Type: schema.TypeList, Computed: true, Description: "lvm2_lockd", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "installed_size": { Type: schema.TypeString, Computed: true, Description: "installed_size", }, "ver": { Type: schema.TypeString, Computed: true, Description: "ver", }, }, }, }, "openvswitch_common": { Type: schema.TypeList, Computed: true, Description: "openvswitch_common", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "installed_size": { Type: schema.TypeString, Computed: true, Description: "installed_size", }, "ver": { Type: schema.TypeString, Computed: true, Description: "ver", }, }, }, }, "openvswitch_switch": { Type: schema.TypeList, Computed: true, Description: "openvswitch_switch", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "installed_size": { Type: schema.TypeString, Computed: true, Description: "installed_size", }, "ver": { Type: schema.TypeString, Computed: true, Description: "ver", }, }, }, }, "qemu_system_x86": { Type: schema.TypeList, Computed: true, Description: "qemu_system_x86", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "installed_size": { Type: schema.TypeString, Computed: true, Description: "installed_size", }, "ver": { Type: schema.TypeString, Computed: true, Description: "ver", }, }, }, }, "sanlock": { Type: schema.TypeList, Computed: true, Description: "sanlock", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "installed_size": { Type: schema.TypeString, Computed: true, Description: "installed_size", }, "ver": { Type: schema.TypeString, Computed: true, Description: "ver", }, }, }, }, }, }, }, "passwd": { Type: schema.TypeString, Computed: true, }, "reference_id": { Type: schema.TypeString, Computed: true, }, "status": { Type: schema.TypeString, Computed: true, }, "type": { Type: schema.TypeString, Computed: true, }, }, }, Description: "items of stacks list", }, "entry_count": { Type: schema.TypeInt, Computed: true, Description: "entry count", }, } } func dataSourceImageListSchemaMake() map[string]*schema.Schema { rets := map[string]*schema.Schema{ "sep_id": { Type: schema.TypeInt, Optional: true, Description: "find by storage endpoint provider ID", }, "by_id": { Type: schema.TypeInt, Optional: true, Description: "find by ID", }, "name": { Type: schema.TypeString, Optional: true, Description: "find by name", }, "status": { Type: schema.TypeString, Optional: true, Description: "find by status", }, "architecture": { Type: schema.TypeString, Optional: true, Description: "find by architecture", }, "type_image": { Type: schema.TypeString, Optional: true, Description: "find by type", }, "image_size": { Type: schema.TypeInt, Optional: true, Description: "find by image size", }, "sep_name": { Type: schema.TypeString, Optional: true, Description: "find by SEP name", }, "pool": { Type: schema.TypeString, Optional: true, Description: "find by pool", }, "public": { Type: schema.TypeBool, Optional: true, Description: "find by public True or False", }, "hot_resize": { Type: schema.TypeBool, Optional: true, Description: "find by hot resize True or False", }, "bootable": { Type: schema.TypeBool, Optional: true, Description: "find by bootable True or False", }, "sort_by": { Type: schema.TypeString, Optional: true, Description: "sort by one of supported fields, format +|-(field)", }, "page": { Type: schema.TypeInt, Optional: true, Description: "page number", }, "size": { Type: schema.TypeInt, Optional: true, Description: "page size", }, "items": { Type: schema.TypeList, Computed: true, Description: "image list", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "unc_path": { Type: schema.TypeString, Computed: true, Description: "unc path", }, "account_id": { Type: schema.TypeInt, Computed: true, Description: "AccountId to make the image exclusive", }, "acl": { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "explicit": { Type: schema.TypeBool, Computed: true, }, "guid": { Type: schema.TypeString, Computed: true, }, "right": { Type: schema.TypeString, Computed: true, }, "status": { Type: schema.TypeString, Computed: true, }, "type": { Type: schema.TypeString, Computed: true, }, "user_group_id": { Type: schema.TypeString, Computed: true, }, }, }, }, "architecture": { Type: schema.TypeString, Computed: true, Description: "binary architecture of this image, one of X86_64 of PPC64_LE", }, "boot_type": { Type: schema.TypeString, Computed: true, Description: "Boot type of image bios or uefi", }, "bootable": { Type: schema.TypeBool, Computed: true, Description: "Does this image boot OS", }, "computeci_id": { Type: schema.TypeInt, Computed: true, }, "cd_presented_to": { Type: schema.TypeString, Computed: true, }, "deleted_time": { Type: schema.TypeInt, Computed: true, }, "desc": { Type: schema.TypeString, Computed: true, }, "drivers": { Type: schema.TypeList, Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, Description: "List of types of compute suitable for image. Example: [ \"KVM_X86\" ]", }, "enabled": { Type: schema.TypeBool, Computed: true, }, "gid": { Type: schema.TypeInt, Computed: true, Description: "grid (platform) ID where this template should be create in", }, "guid": { Type: schema.TypeInt, Computed: true, }, "history": { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "guid": { Type: schema.TypeString, Computed: true, }, "id": { Type: schema.TypeInt, Computed: true, }, "timestamp": { Type: schema.TypeInt, Computed: true, }, }, }, }, "hot_resize": { Type: schema.TypeBool, Computed: true, Description: "Does this machine supports hot resize", }, "image_id": { Type: schema.TypeInt, Computed: true, Description: "image id", }, "last_modified": { Type: schema.TypeInt, Computed: true, }, "link_to": { Type: schema.TypeInt, Computed: true, }, "milestones": { Type: schema.TypeInt, Computed: true, }, "name": { Type: schema.TypeString, Computed: true, Description: "Name of the rescue disk", }, "network_interface_naming": { Type: schema.TypeString, Computed: true, }, "password": { Type: schema.TypeString, Computed: true, Description: "Optional password for the image", }, "pool_name": { Type: schema.TypeString, Computed: true, Description: "pool for image create", }, "present_to": { Type: schema.TypeList, Computed: true, Elem: &schema.Schema{ Type: schema.TypeInt, }, }, "provider_name": { Type: schema.TypeString, Computed: true, }, "purge_attempts": { Type: schema.TypeInt, Computed: true, }, "reference_id": { Type: schema.TypeString, Computed: true, }, "res_id": { Type: schema.TypeString, Computed: true, }, "res_name": { Type: schema.TypeString, Computed: true, }, "rescuecd": { Type: schema.TypeBool, Computed: true, }, "sep_id": { Type: schema.TypeInt, Computed: true, Description: "storage endpoint provider ID", }, "shared_with": { Type: schema.TypeList, Optional: true, Computed: true, Elem: &schema.Schema{ Type: schema.TypeInt, }, }, "size": { Type: schema.TypeInt, Computed: true, Description: "image size", }, "status": { Type: schema.TypeString, Computed: true, Description: "status", }, "tech_status": { Type: schema.TypeString, Computed: true, Description: "tech atatus", }, "image_type": { Type: schema.TypeString, Computed: true, Description: "Image type linux, windows or other", }, "url": { Type: schema.TypeString, Computed: true, Description: "URL where to download media from", }, "username": { Type: schema.TypeString, Computed: true, Description: "Optional username for the image", }, "version": { Type: schema.TypeString, Computed: true, Description: "version", }, "virtual": { Type: schema.TypeBool, Computed: true, }, }, }, }, "entry_count": { Type: schema.TypeInt, Computed: true, Description: "entry count", }, } return rets } func dataSourceImageSchemaMake() map[string]*schema.Schema { return map[string]*schema.Schema{ "image_id": { Type: schema.TypeInt, Required: true, Description: "image id", }, "unc_path": { Type: schema.TypeString, Computed: true, Description: "unc path", }, "account_id": { Type: schema.TypeInt, Computed: true, Description: "AccountId to make the image exclusive", }, "acl": { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "explicit": { Type: schema.TypeBool, Computed: true, }, "guid": { Type: schema.TypeString, Computed: true, }, "right": { Type: schema.TypeString, Computed: true, }, "status": { Type: schema.TypeString, Computed: true, }, "type": { Type: schema.TypeString, Computed: true, }, "user_group_id": { Type: schema.TypeString, Computed: true, }, }, }, }, "architecture": { Type: schema.TypeString, Computed: true, Description: "binary architecture of this image, one of X86_64 of PPC64_LE", }, "boot_type": { Type: schema.TypeString, Computed: true, Description: "Boot type of image bios or uefi", }, "bootable": { Type: schema.TypeBool, Computed: true, Description: "Does this image boot OS", }, "computeci_id": { Type: schema.TypeInt, Computed: true, }, "cd_presented_to": { Type: schema.TypeString, Computed: true, }, "deleted_time": { Type: schema.TypeInt, Computed: true, }, "desc": { Type: schema.TypeString, Computed: true, }, "drivers": { Type: schema.TypeList, Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, Description: "List of types of compute suitable for image. Example: [ \"KVM_X86\" ]", }, "enabled": { Type: schema.TypeBool, Computed: true, }, "gid": { Type: schema.TypeInt, Computed: true, Description: "grid (platform) ID where this template should be create in", }, "guid": { Type: schema.TypeInt, Computed: true, }, "history": { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "guid": { Type: schema.TypeString, Computed: true, }, "id": { Type: schema.TypeInt, Computed: true, }, "timestamp": { Type: schema.TypeInt, Computed: true, }, }, }, }, "hot_resize": { Type: schema.TypeBool, Computed: true, Description: "Does this machine supports hot resize", }, "last_modified": { Type: schema.TypeInt, Computed: true, }, "link_to": { Type: schema.TypeInt, Computed: true, }, "milestones": { Type: schema.TypeInt, Computed: true, }, "name": { Type: schema.TypeString, Computed: true, Description: "Name of the rescue disk", }, "network_interface_naming": { Type: schema.TypeString, Computed: true, }, "password": { Type: schema.TypeString, Computed: true, Description: "Optional password for the image", }, "pool_name": { Type: schema.TypeString, Computed: true, Description: "pool for image create", }, "present_to": { Type: schema.TypeList, Computed: true, Elem: &schema.Schema{ Type: schema.TypeInt, }, }, "provider_name": { Type: schema.TypeString, Computed: true, }, "purge_attempts": { Type: schema.TypeInt, Computed: true, }, "reference_id": { Type: schema.TypeString, Computed: true, }, "res_id": { Type: schema.TypeString, Computed: true, }, "res_name": { Type: schema.TypeString, Computed: true, }, "rescuecd": { Type: schema.TypeBool, Computed: true, }, "sep_id": { Type: schema.TypeInt, Computed: true, Description: "storage endpoint provider ID", }, "shared_with": { Type: schema.TypeList, Optional: true, Computed: true, Elem: &schema.Schema{ Type: schema.TypeInt, }, }, "size": { Type: schema.TypeInt, Computed: true, Description: "image size", }, "status": { Type: schema.TypeString, Computed: true, Description: "status", }, "tech_status": { Type: schema.TypeString, Computed: true, Description: "tech atatus", }, "image_type": { Type: schema.TypeString, Computed: true, Description: "Image type linux, windows or other", }, "url": { Type: schema.TypeString, Computed: true, Description: "URL where to download media from", }, "username": { Type: schema.TypeString, Computed: true, Description: "Optional username for the image", }, "version": { Type: schema.TypeString, Computed: true, Description: "version", }, } } func resourceCDROMImageSchemaMake() map[string]*schema.Schema { return map[string]*schema.Schema{ "name": { Type: schema.TypeString, Required: true, Description: "Name of the rescue disk", }, "url": { Type: schema.TypeString, Required: true, Description: "URL where to download ISO from", }, "gid": { Type: schema.TypeInt, Required: true, Description: "grid (platform) ID where this template should be create in", }, "drivers": { Type: schema.TypeList, Required: true, Elem: &schema.Schema{ Type: schema.TypeString, }, Description: "List of types of compute suitable for image. Example: [ \"KVM_X86\" ]", }, "hot_resize": { Type: schema.TypeBool, Optional: true, Computed: true, Description: "Does this machine supports hot resize", }, "account_id": { Type: schema.TypeInt, Optional: true, Computed: true, Description: "AccountId to make the image exclusive", }, "username_dl": { Type: schema.TypeString, Optional: true, Computed: true, Description: "username for upload binary media", }, "password_dl": { Type: schema.TypeString, Optional: true, Computed: true, Description: "password for upload binary media", }, "sep_id": { Type: schema.TypeInt, Optional: true, Computed: true, Description: "storage endpoint provider ID", }, "pool_name": { Type: schema.TypeString, Optional: true, Computed: true, Description: "pool for image create", }, "architecture": { Type: schema.TypeString, Optional: true, Computed: true, Description: "binary architecture of this image, one of X86_64 of PPC64_LE", }, "permanently": { Type: schema.TypeBool, Optional: true, Computed: true, Description: "Whether to completely delete the image", }, "bootable": { Type: schema.TypeBool, Optional: true, Computed: true, Description: "Does this image boot OS", }, "enabled": { Type: schema.TypeBool, Optional: true, Computed: true, }, "computeci_id": { Type: schema.TypeInt, Optional: true, Computed: true, }, "shared_with": { Type: schema.TypeList, Optional: true, Computed: true, Elem: &schema.Schema{ Type: schema.TypeInt, }, }, "enabled_stacks": { Type: schema.TypeList, Optional: true, Elem: &schema.Schema{ Type: schema.TypeInt, }, }, "unc_path": { Type: schema.TypeString, Computed: true, Description: "unc path", }, "ckey": { Type: schema.TypeString, Computed: true, }, "meta": { Type: schema.TypeList, Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, Description: "meta", }, "acl": { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "explicit": { Type: schema.TypeBool, Computed: true, }, "guid": { Type: schema.TypeString, Computed: true, }, "right": { Type: schema.TypeString, Computed: true, }, "status": { Type: schema.TypeString, Computed: true}, "type": { Type: schema.TypeString, Computed: true}, "user_group_id": { Type: schema.TypeString, Computed: true, }, }, }, }, "boot_type": { Type: schema.TypeString, Computed: true, Description: "Boot type of image bios or uefi", }, "guid": { Type: schema.TypeInt, Computed: true, }, "image_id": { Type: schema.TypeInt, Computed: true, Description: "image id", }, "image_type": { Type: schema.TypeString, Computed: true, Description: "Image type linux, windows or other", }, "link_to": { Type: schema.TypeInt, Computed: true, Description: "", }, "milestones": { Type: schema.TypeInt, Computed: true, }, "provider_name": { Type: schema.TypeString, Computed: true, }, "purge_attempts": { Type: schema.TypeInt, Computed: true, }, "reference_id": { Type: schema.TypeString, Computed: true, }, "res_id": { Type: schema.TypeString, Computed: true, }, "res_name": { Type: schema.TypeString, Computed: true, }, "rescuecd": { Type: schema.TypeBool, Computed: true, }, "last_modified": { Type: schema.TypeInt, Computed: true, }, "desc": { Type: schema.TypeString, Computed: true, }, "deleted_time": { Type: schema.TypeInt, Computed: true, }, "present_to": { Type: schema.TypeList, Computed: true, Elem: &schema.Schema{ Type: schema.TypeInt, }, }, "status": { Type: schema.TypeString, Computed: true, Description: "status", }, "tech_status": { Type: schema.TypeString, Computed: true, Description: "tech atatus", }, "version": { Type: schema.TypeString, Computed: true, Description: "version", }, "size": { Type: schema.TypeInt, Computed: true, Description: "image size", }, "history": { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "guid": { Type: schema.TypeString, Computed: true, }, "id": { Type: schema.TypeInt, Computed: true, }, "timestamp": { Type: schema.TypeInt, Computed: true, }, }, }, }, } } func resourceImageSchemaMake() map[string]*schema.Schema { return map[string]*schema.Schema{ "name": { Type: schema.TypeString, Required: true, Description: "Name of the rescue disk", }, "url": { Type: schema.TypeString, Optional: true, Computed: true, Description: "URL where to download media from", }, "file_path": { Type: schema.TypeString, Optional: true, Description: "path to image file", }, "gid": { Type: schema.TypeInt, Required: true, Description: "grid (platform) ID where this template should be create in", }, "boot_type": { Type: schema.TypeString, Required: true, Description: "Boot type of image bios or uefi", }, "image_type": { Type: schema.TypeString, Required: true, Description: "Image type linux, windows or other", }, "drivers": { Type: schema.TypeList, Optional: true, Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, Description: "List of types of compute suitable for image. Example: [ \"KVM_X86\" ]", }, "hot_resize": { Type: schema.TypeBool, Optional: true, Computed: true, Description: "Does this machine supports hot resize", }, "network_interface_naming": { Type: schema.TypeString, Optional: true, Computed: true, ValidateFunc: validation.StringInSlice([]string{"eth", "ens"}, true), Description: "select a network interface naming pattern for your Linux machine. eth - onboard, ens - pci slot naming", }, "username": { Type: schema.TypeString, Optional: true, Computed: true, Description: "Optional username for the image", }, "password": { Type: schema.TypeString, Optional: true, Computed: true, Description: "Optional password for the image", }, "account_id": { Type: schema.TypeInt, Optional: true, Computed: true, Description: "AccountId to make the image exclusive", }, "username_dl": { Type: schema.TypeString, Optional: true, Computed: true, Description: "username for upload binary media", }, "password_dl": { Type: schema.TypeString, Optional: true, Computed: true, Description: "password for upload binary media", }, "sep_id": { Type: schema.TypeInt, Optional: true, Computed: true, Description: "storage endpoint provider ID", }, "pool_name": { Type: schema.TypeString, Optional: true, Computed: true, Description: "pool for image create", }, "architecture": { Type: schema.TypeString, Optional: true, Computed: true, Description: "binary architecture of this image, one of X86_64 of PPC64_LE", }, "permanently": { Type: schema.TypeBool, Optional: true, Description: "Whether to completely delete the image", }, "bootable": { Type: schema.TypeBool, Optional: true, Computed: true, Description: "Does this image boot OS", }, "enabled": { Type: schema.TypeBool, Optional: true, Computed: true, }, "computeci_id": { Type: schema.TypeInt, Optional: true, Computed: true, }, "sync_mode": { Type: schema.TypeBool, Optional: true, Default: false, Description: "Create image from a media identified by URL (in synchronous mode)", }, "enabled_stacks": { Type: schema.TypeList, Optional: true, Elem: &schema.Schema{ Type: schema.TypeInt, }, }, "shared_with": { Type: schema.TypeList, Optional: true, Computed: true, Elem: &schema.Schema{ Type: schema.TypeInt, }, }, "reason": { Type: schema.TypeString, Optional: true, }, "accounts": { Type: schema.TypeList, Optional: true, Elem: &schema.Schema{ Type: schema.TypeInt, }, }, "unc_path": { Type: schema.TypeString, Computed: true, Description: "unc path", }, "acl": { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "explicit": { Type: schema.TypeBool, Computed: true, }, "guid": { Type: schema.TypeString, Computed: true, }, "right": { Type: schema.TypeString, Computed: true, }, "status": { Type: schema.TypeString, Computed: true}, "type": { Type: schema.TypeString, Computed: true}, "user_group_id": { Type: schema.TypeString, Computed: true, }, }, }, }, "guid": { Type: schema.TypeInt, Computed: true, }, "cd_presented_to": { Type: schema.TypeString, Computed: true, }, "image_id": { Type: schema.TypeInt, Computed: true, Description: "image id", }, "link_to": { Type: schema.TypeInt, Computed: true, Description: "", }, "milestones": { Type: schema.TypeInt, Computed: true, }, "provider_name": { Type: schema.TypeString, Computed: true, }, "purge_attempts": { Type: schema.TypeInt, Computed: true, }, "reference_id": { Type: schema.TypeString, Computed: true, }, "res_id": { Type: schema.TypeString, Computed: true, }, "res_name": { Type: schema.TypeString, Computed: true, }, "rescuecd": { Type: schema.TypeBool, Computed: true, }, "last_modified": { Type: schema.TypeInt, Computed: true, }, "deleted_time": { Type: schema.TypeInt, Computed: true, }, "desc": { Type: schema.TypeString, Computed: true, }, "present_to": { Type: schema.TypeList, Computed: true, Elem: &schema.Schema{ Type: schema.TypeInt, }, }, "status": { Type: schema.TypeString, Computed: true, Description: "status", }, "tech_status": { Type: schema.TypeString, Computed: true, Description: "tech atatus", }, "version": { Type: schema.TypeString, Computed: true, Description: "version", }, "size": { Type: schema.TypeInt, Computed: true, Description: "image size", }, "history": { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "guid": { Type: schema.TypeString, Computed: true, }, "id": { Type: schema.TypeInt, Computed: true, }, "timestamp": { Type: schema.TypeInt, Computed: true, }, }, }, }, } } func resourceVirtualImageSchemaMake() map[string]*schema.Schema { return map[string]*schema.Schema{ "link_to": { Type: schema.TypeInt, Required: true, Description: "ID of real image to link this virtual image to upon creation", }, "name": { Type: schema.TypeString, Required: true, Description: "Name of the rescue disk", }, "account_id": { Type: schema.TypeInt, Optional: true, Computed: true, Description: "AccountId to make the image exclusive", }, "bootable": { Type: schema.TypeBool, Optional: true, Computed: true, Description: "Does this image boot OS", }, "computeci_id": { Type: schema.TypeInt, Optional: true, Computed: true, }, "enabled": { Type: schema.TypeBool, Optional: true, Computed: true, }, "hot_resize": { Type: schema.TypeBool, Optional: true, Computed: true, Description: "Does this machine supports hot resize", }, "password": { Type: schema.TypeString, Optional: true, Computed: true, Description: "Optional password for the image", }, "username": { Type: schema.TypeString, Computed: true, Optional: true, Description: "Optional username for the image", }, "shared_with": { Type: schema.TypeList, Optional: true, Computed: true, Elem: &schema.Schema{ Type: schema.TypeInt, }, }, "enabled_stacks": { Type: schema.TypeList, Optional: true, Elem: &schema.Schema{ Type: schema.TypeInt, }, }, "permanently": { Type: schema.TypeBool, Optional: true, Description: "Whether to completely delete the image", }, "reason": { Type: schema.TypeString, Optional: true, }, "unc_path": { Type: schema.TypeString, Computed: true, Description: "unc path", }, "ckey": { Type: schema.TypeString, Computed: true, }, "meta": { Type: schema.TypeList, Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, Description: "meta", }, "acl": { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "explicit": { Type: schema.TypeBool, Computed: true, }, "guid": { Type: schema.TypeString, Computed: true, }, "right": { Type: schema.TypeString, Computed: true, }, "status": { Type: schema.TypeString, Computed: true, }, "type": { Type: schema.TypeString, Computed: true, }, "user_group_id": { Type: schema.TypeString, Computed: true, }, }, }, }, "architecture": { Type: schema.TypeString, Computed: true, Description: "binary architecture of this image, one of X86_64 of PPC64_LE", }, "boot_type": { Type: schema.TypeString, Computed: true, Description: "Boot type of image bios or uefi", }, "deleted_time": { Type: schema.TypeInt, Computed: true, }, "desc": { Type: schema.TypeString, Computed: true, }, "drivers": { Type: schema.TypeList, Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, Description: "List of types of compute suitable for image. Example: [ \"KVM_X86\" ]", }, "gid": { Type: schema.TypeInt, Computed: true, Description: "grid (platform) ID where this template should be create in", }, "guid": { Type: schema.TypeInt, Computed: true, }, "history": { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "guid": { Type: schema.TypeString, Computed: true, }, "id": { Type: schema.TypeInt, Computed: true, }, "timestamp": { Type: schema.TypeInt, Computed: true, }, }, }, }, "image_id": { Type: schema.TypeInt, Computed: true, Description: "Image id", }, "last_modified": { Type: schema.TypeInt, Computed: true, }, "milestones": { Type: schema.TypeInt, Computed: true, }, "pool_name": { Type: schema.TypeString, Computed: true, Description: "pool for image create", }, "present_to": { Type: schema.TypeList, Computed: true, Elem: &schema.Schema{ Type: schema.TypeInt, }, }, "provider_name": { Type: schema.TypeString, Computed: true, }, "purge_attempts": { Type: schema.TypeInt, Computed: true, }, "reference_id": { Type: schema.TypeString, Computed: true, }, "res_id": { Type: schema.TypeString, Computed: true, }, "res_name": { Type: schema.TypeString, Computed: true, }, "rescuecd": { Type: schema.TypeBool, Computed: true, }, "sep_id": { Type: schema.TypeInt, Computed: true, Description: "storage endpoint provider ID", }, "size": { Type: schema.TypeInt, Computed: true, Description: "image size", }, "status": { Type: schema.TypeString, Computed: true, Description: "status", }, "tech_status": { Type: schema.TypeString, Computed: true, Description: "tech atatus", }, "image_type": { Type: schema.TypeString, Computed: true, Description: "Image type linux, windows or other", }, "url": { Type: schema.TypeString, Computed: true, Description: "URL where to download media from", }, "version": { Type: schema.TypeString, Computed: true, Description: "version", }, } } func resourceImageFromBlankComputeSchemaMake() map[string]*schema.Schema { return map[string]*schema.Schema{ "compute_id": { Type: schema.TypeInt, Required: true, Description: "Compute Id", }, "name": { Type: schema.TypeString, Required: true, Description: "Name of the rescue disk", }, "boot_type": { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{"bios", "uefi"}, true), Description: "Boot type of image BIOS or UEFI", }, "image_type": { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{"linux", "windows", "other"}, true), Description: "Image type linux, windows or other", }, "username": { Type: schema.TypeString, Optional: true, Computed: true, Description: "Optional username for the image", }, "password": { Type: schema.TypeString, Optional: true, Computed: true, Description: "Optional password for the image", }, "account_id": { Type: schema.TypeInt, Optional: true, Computed: true, Description: "AccountId to make the image exclusive", }, "sep_id": { Type: schema.TypeInt, Optional: true, Computed: true, Description: "storage endpoint provider ID", }, "pool_name": { Type: schema.TypeString, Optional: true, Computed: true, Description: "pool for image create", }, "hot_resize": { Type: schema.TypeBool, Optional: true, Computed: true, Description: "Does this machine supports hot resize", }, "async_mode": { Type: schema.TypeBool, Optional: true, Default: false, Description: "create an image in async/sync mode", }, "permanently": { Type: schema.TypeBool, Optional: true, Default: false, Description: "whether to completely delete the image", }, "bootable": { Type: schema.TypeBool, Optional: true, Computed: true, Description: "Does this image boot OS", }, "enabled": { Type: schema.TypeBool, Optional: true, Computed: true, }, "computeci_id": { Type: schema.TypeInt, Optional: true, Computed: true, }, "enabled_stacks": { Type: schema.TypeList, Optional: true, Elem: &schema.Schema{ Type: schema.TypeInt, }, }, "shared_with": { Type: schema.TypeList, Optional: true, Computed: true, Elem: &schema.Schema{ Type: schema.TypeInt, }, }, "reason": { Type: schema.TypeString, Optional: true, }, "accounts": { Type: schema.TypeList, Optional: true, Elem: &schema.Schema{ Type: schema.TypeInt, }, }, "network_interface_naming": { Type: schema.TypeString, Optional: true, Computed: true, ValidateFunc: validation.StringInSlice([]string{"eth", "ens"}, true), Description: "select a network interface naming pattern for your Linux machine. eth - onboard, ens - pci slot naming", }, "image_id": { Type: schema.TypeInt, Computed: true, }, "unc_path": { Type: schema.TypeString, Computed: true, }, "acl": { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "explicit": { Type: schema.TypeBool, Computed: true, }, "guid": { Type: schema.TypeString, Computed: true, }, "right": { Type: schema.TypeString, Computed: true, }, "status": { Type: schema.TypeString, Computed: true}, "type": { Type: schema.TypeString, Computed: true}, "user_group_id": { Type: schema.TypeString, Computed: true, }, }, }, }, "architecture": { Type: schema.TypeString, Computed: true, }, "cd_presented_to": { Type: schema.TypeString, Computed: true, }, "deleted_time": { Type: schema.TypeInt, Computed: true, }, "desc": { Type: schema.TypeString, Computed: true, }, "drivers": { Type: schema.TypeList, Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "gid": { Type: schema.TypeInt, Computed: true, }, "guid": { Type: schema.TypeInt, Computed: true, }, "history": { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "guid": { Type: schema.TypeString, Computed: true, }, "id": { Type: schema.TypeInt, Computed: true, }, "timestamp": { Type: schema.TypeInt, Computed: true, }, }, }, }, "last_modified": { Type: schema.TypeInt, Computed: true, }, "link_to": { Type: schema.TypeInt, Computed: true, }, "milestones": { Type: schema.TypeInt, Computed: true, }, "provider_name": { Type: schema.TypeString, Computed: true, }, "purge_attempts": { Type: schema.TypeInt, Computed: true, }, "present_to": { Type: schema.TypeList, Computed: true, Elem: &schema.Schema{ Type: schema.TypeInt, }, }, "reference_id": { Type: schema.TypeString, Computed: true, }, "res_id": { Type: schema.TypeString, Computed: true, }, "res_name": { Type: schema.TypeString, Computed: true, }, "rescuecd": { Type: schema.TypeBool, Computed: true, }, "size": { Type: schema.TypeInt, Computed: true, }, "status": { Type: schema.TypeString, Computed: true, }, "tech_status": { Type: schema.TypeString, Computed: true, }, "url": { Type: schema.TypeString, Computed: true, }, "version": { Type: schema.TypeString, Computed: true, }, } } func resourceImageFromPlatformDiskSchemaMake() map[string]*schema.Schema { return map[string]*schema.Schema{ "disk_id": { Type: schema.TypeInt, Required: true, Description: "Disk Id", }, "name": { Type: schema.TypeString, Required: true, Description: "Name of the rescue disk", }, "boot_type": { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{"bios", "uefi"}, true), Description: "Boot type of image BIOS or UEFI", }, "image_type": { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{"linux", "windows", "other"}, true), Description: "Image type linux, windows or other", }, "architecture": { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{"X86_64", "PPC64_LE"}, true), Description: "Image type linux, windows or other", }, "username": { Type: schema.TypeString, Optional: true, Computed: true, Description: "Optional username for the image", }, "password": { Type: schema.TypeString, Optional: true, Computed: true, Description: "Optional password for the image", }, "account_id": { Type: schema.TypeInt, Optional: true, Computed: true, Description: "AccountId to make the image exclusive", }, "sep_id": { Type: schema.TypeInt, Optional: true, Computed: true, Description: "storage endpoint provider ID", }, "drivers": { Type: schema.TypeList, Optional: true, Computed: true, Elem: &schema.Schema{ StateFunc: statefuncs.StateFuncToUpper, ValidateFunc: validation.StringInSlice([]string{"SVA_KVM_X86", "KVM_X86", "KVM_PPC"}, false), // observe case while validating Type: schema.TypeString, }, Description: "List of types of compute suitable for image. Example: [ \"KVM_X86\" ]", }, "pool_name": { Type: schema.TypeString, Optional: true, Computed: true, Description: "pool for image create", }, "hot_resize": { Type: schema.TypeBool, Optional: true, Computed: true, Description: "Does this machine supports hot resize", }, "async_mode": { Type: schema.TypeBool, Optional: true, Default: false, Description: "create an image in async/sync mode", }, "permanently": { Type: schema.TypeBool, Optional: true, Default: false, Description: "whether to completely delete the image", }, "bootable": { Type: schema.TypeBool, Optional: true, Computed: true, Description: "Does this image boot OS", }, "enabled": { Type: schema.TypeBool, Optional: true, Computed: true, }, "computeci_id": { Type: schema.TypeInt, Optional: true, Computed: true, }, "enabled_stacks": { Type: schema.TypeList, Optional: true, Elem: &schema.Schema{ Type: schema.TypeInt, }, }, "shared_with": { Type: schema.TypeList, Optional: true, Computed: true, Elem: &schema.Schema{ Type: schema.TypeInt, }, }, "reason": { Type: schema.TypeString, Optional: true, }, "accounts": { Type: schema.TypeList, Optional: true, Elem: &schema.Schema{ Type: schema.TypeInt, }, }, "network_interface_naming": { Type: schema.TypeString, Optional: true, Computed: true, ValidateFunc: validation.StringInSlice([]string{"eth", "ens"}, true), Description: "select a network interface naming pattern for your Linux machine. eth - onboard, ens - pci slot naming", }, "image_id": { Type: schema.TypeInt, Computed: true, }, "unc_path": { Type: schema.TypeString, Computed: true, }, "acl": { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "explicit": { Type: schema.TypeBool, Computed: true, }, "guid": { Type: schema.TypeString, Computed: true, }, "right": { Type: schema.TypeString, Computed: true, }, "status": { Type: schema.TypeString, Computed: true}, "type": { Type: schema.TypeString, Computed: true}, "user_group_id": { Type: schema.TypeString, Computed: true, }, }, }, }, "cd_presented_to": { Type: schema.TypeString, Computed: true, }, "deleted_time": { Type: schema.TypeInt, Computed: true, }, "desc": { Type: schema.TypeString, Computed: true, }, "gid": { Type: schema.TypeInt, Computed: true, }, "guid": { Type: schema.TypeInt, Computed: true, }, "history": { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "guid": { Type: schema.TypeString, Computed: true, }, "id": { Type: schema.TypeInt, Computed: true, }, "timestamp": { Type: schema.TypeInt, Computed: true, }, }, }, }, "last_modified": { Type: schema.TypeInt, Computed: true, }, "link_to": { Type: schema.TypeInt, Computed: true, }, "milestones": { Type: schema.TypeInt, Computed: true, }, "provider_name": { Type: schema.TypeString, Computed: true, }, "purge_attempts": { Type: schema.TypeInt, Computed: true, }, "present_to": { Type: schema.TypeList, Computed: true, Elem: &schema.Schema{ Type: schema.TypeInt, }, }, "reference_id": { Type: schema.TypeString, Computed: true, }, "res_id": { Type: schema.TypeString, Computed: true, }, "res_name": { Type: schema.TypeString, Computed: true, }, "rescuecd": { Type: schema.TypeBool, Computed: true, }, "size": { Type: schema.TypeInt, Computed: true, }, "status": { Type: schema.TypeString, Computed: true, }, "tech_status": { Type: schema.TypeString, Computed: true, }, "url": { Type: schema.TypeString, Computed: true, }, "version": { Type: schema.TypeString, Computed: true, }, } }