diff --git a/create_vm.yml b/create_vm.yml deleted file mode 100644 index 4b0d8f0df..000000000 --- a/create_vm.yml +++ /dev/null @@ -1,31 +0,0 @@ ---- -- name: Auto Generated Playbook - hosts: localhost - vars_files: credentials.yml - gather_facts: false - tasks: - - name: create Vm - nutanix_vms: - action: create - auth: - credentials: '{{credentials}}' - url: '{{config.ip_address}}:{{config.port}}' - name: "test1234" - cluster: - cluster_uuid: "0005d433-f986-ca07-7cba-ac1f6b6f97d8" - networks: - - subnet_reference: - uuid: "337261ed-5007-4e5a-b11e-8d2444e62824" - kind: "subnet" - is_connected: True -# - subnet_reference: -# uuid: "337261ed-5007-4e5a-b11e-8d2444e62824" -# kind: "subnet" -# is_connected: True - - - register: output - - - name: output of list Subnets - debug: - msg: '{{ output }}' diff --git a/create_vm_uc1.yml b/create_vm_uc1.yml deleted file mode 100644 index 954fe0dcf..000000000 --- a/create_vm_uc1.yml +++ /dev/null @@ -1,38 +0,0 @@ ---- -- name: Auto Generated Playbook - hosts: localhost - vars_files: credentials.yml - gather_facts: false - collections: - - nutanix.ncp - tasks: - - name: create Vm - nutanix_vms: - state: present - auth: - credentials: '{{credentials}}' - url: '{{config.ip_address}}:{{config.port}}' - name: "test_2" - cluster: - cluster_uuid: "0005d54c-b572-b290-0000-000000029016" - networks: - - connected: True - subnet_uuid: "55d9fbba-71ea-4ef4-b776-1c8f3513b733" - - connected: True - subnet_uuid: "548d29f3-d98d-44cf-893b-4e17e0066161" - private_ip: "10.30.30.15" - disks: - - type: "DISK" - size_gb: 2 - bus: "SCSI" - - type: "DISK" - size_gb: 3 - bus: "SCSI" - cpu_properties: - core_count: 1 - threads_per_core: 2 - register: output - - - name: output of list Subnets - debug: - msg: '{{ output }}' diff --git a/delete_vm.yml b/delete_vm.yml deleted file mode 100644 index 8eca4ead4..000000000 --- a/delete_vm.yml +++ /dev/null @@ -1,20 +0,0 @@ ---- -- name: Auto Generated Playbook - hosts: localhost - vars_files: credentials.yml - gather_facts: false - collections: - - nutanix.ncp - tasks: - - name: delete Vm - nutanix_vms: - state: absent - auth: - credentials: '{{credentials}}' - url: '{{config.ip_address}}:{{config.port}}' - uuid: "734539b8-ff4e-47bd-9a57-1f9c661ccda4" - register: output - - - name: output of delete vm - debug: - msg: '{{ output }}' diff --git a/example.json b/example.json deleted file mode 100644 index bed6c1dd4..000000000 --- a/example.json +++ /dev/null @@ -1,1108 +0,0 @@ -{ - "type": "object", - "title": "vm Intent Entity", - "description": "An intentful representation of a vm", - "required": [ - "metadata", - "spec" - ], - "properties": { - "api_version": { - "title": "API Version", - "description": "API Version of the Nutanix v3 API framework.", - "type": "string", - "readOnly": true, - "default": "3.1.0" - }, - "metadata": { - "title": "vm metadata", - "type": "object", - "description": "The vm kind metadata", - "required": [ - "kind" - ], - "properties": { - "kind": { - "type": "string", - "readOnly": true, - "description": "The kind name", - "default": "vm", - "x-ntnx-enum": [ - "vm" - ] - }, - "uuid": { - "description": "vm uuid", - "type": "string", - "format": "UUID", - "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" - }, - "name": { - "description": "vm name", - "type": "string", - "readOnly": true, - "maxLength": 80 - }, - "spec_version": { - "type": "integer", - "description": "Version number of the latest spec." - }, - "spec_hash": { - "type": "string", - "description": "Hash of the spec. This will be returned from server.\n" - }, - "categories": { - "type": "object", - "description": "Categories for the vm. This allows assigning one value\nof a key to any entity. Changes done in this will be reflected in\nthe categories_mapping field.\n", - "additionalProperties": { - "type": "string" - } - }, - "categories_mapping": { - "type": "object", - "description": "Categories for the vm. This allows setting up multiple\nvalues from a single key. Categories assigned using the older view will be\npresent here. This is the new way of assigning categories.\n", - "additionalProperties": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "use_categories_mapping": { - "type": "boolean", - "default": false, - "description": "Client need to specify this field as true if user want to use the\nnewer way of assigning the categories. Without this things should work\nas it was earlier.\n" - }, - "creation_time": { - "type": "string", - "format": "date-time", - "readOnly": true, - "description": "UTC date and time in RFC-3339 format when vm was created\n" - }, - "last_update_time": { - "type": "string", - "readOnly": true, - "format": "date-time", - "description": "UTC date and time in RFC-3339 format when vm was last updated\n" - }, - "owner_reference": { - "title": "Reference to a user", - "type": "object", - "description": "The reference to a user", - "required": [ - "kind", - "uuid" - ], - "properties": { - "kind": { - "type": "string", - "readOnly": true, - "description": "The kind name", - "default": "user", - "x-ntnx-enum": [ - "user" - ] - }, - "name": { - "readOnly": true, - "type": "string", - "maxLength": 1024 - }, - "uuid": { - "type": "string", - "format": "UUID", - "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" - } - } - }, - "should_force_translate": { - "description": "Applied on Prism Central only. Indicate whether force to translate the spec of the fanout request to fit the target cluster API schema.\n", - "type": "boolean" - }, - "entity_version": { - "type": "string", - "readOnly": true, - "description": "Logical entity version that allows serializing updates to the entity\nacross multiple API namespaces. For kinds that support\nentity_version, it overrides spec_version described above.\n" - } - } - }, - "spec": { - "type": "object", - "title": "vm Intent Spec with placement specified", - "description": "An intentful representation of a vm spec", - "required": [ - "name", - "resources" - ], - "properties": { - "name": { - "description": "vm Name.", - "type": "string", - "maxLength": 256 - }, - "description": { - "description": "A description for vm.", - "type": "string", - "maxLength": 1000 - }, - "resources": { - "type": "object", - "title": "VM Resources", - "description": "VM Resources Definition.", - "properties": { - "num_sockets": { - "description": "Number of vCPU sockets.", - "type": "integer", - "format": "int32", - "format": "int32", - "minimum": 1 - }, - "num_vcpus_per_socket": { - "description": "Number of vCPUs per socket.", - "type": "integer", - "format": "int32", - "minimum": 1 - }, - "num_threads_per_core": { - "description": "Number of logical threads per core.", - "type": "integer", - "format": "int32", - "minimum": 1 - }, - "memory_size_mib": { - "description": "Memory size in MiB.", - "type": "integer", - "format": "int32", - "minimum": 1 - }, - "memory_overcommit_enabled": { - "description": "Indicates whether memory overcommit feature should be enabled for the VM. If enabled, parts of the VM's memory may reside outside of the hypervisor physical memory. When enabled, it should be expected that the VM may suffer performance degradation.\n", - "type": "boolean" - }, - "gpu_console_enabled": { - "description": "Indicates whether vGPU console is enabled or not.", - "type": "boolean" - }, - "guest_os_id": { - "description": "String that identifies the OS running inside of the guest. Reserved for use by the system. Do not set or modify.", - "type": "string", - "maxLength": 64 - }, - "is_vcpu_hard_pinned": { - "description": "Indicates whether the vCPUs should be hard pinned to specific pCPUs.", - "type": "boolean" - }, - "power_state": { - "description": "The current or desired power state of the VM.", - "type": "string", - "x-ntnx-enum": [ - "ON", - "OFF" - ] - }, - "power_state_mechanism": { - "type": "object", - "title": "VM Power State Mechanism", - "description": "Indicates the mechanism guiding the VM power state transition. Currently used for the transition to \"OFF\" state.\n", - "properties": { - "mechanism": { - "description": "Power state mechanism (ACPI/GUEST/HARD).", - "type": "string", - "x-ntnx-enum": [ - "ACPI", - "GUEST", - "HARD" - ] - }, - "guest_transition_config": { - "type": "object", - "title": "Power State Transition Config", - "description": "Extra configs related to power state transition.", - "properties": { - "enable_script_exec": { - "description": "Indicates whether to execute set script before ngt shutdown/reboot.", - "type": "boolean" - }, - "should_fail_on_script_failure": { - "description": "Indicates whether to abort ngt shutdown/reboot if script fails.", - "type": "boolean" - } - } - } - } - }, - "hardware_clock_timezone": { - "description": "VM's hardware clock timezone in IANA TZDB format (America/Los_Angeles).\n", - "type": "string", - "maxLength": 64 - }, - "is_agent_vm": { - "description": "Indicates whether the VM is an agent VM. When their host enters maintenance mode, after normal VMs are evacuated, agent VMs are powered off. When the host is restored, agent VMs are powered on before normal VMs are restored. In other words, agent VMs cannot be HA-protected or live migrated.\n", - "type": "boolean" - }, - "disable_branding": { - "description": "Indicates whether to remove AHV branding from VM firmware tables.\n", - "type": "boolean" - }, - "enable_cpu_passthrough": { - "description": "Indicates whether to passthrough the host's CPU features to the guest. Enabling this will disable live migration of the VM.\n", - "type": "boolean" - }, - "machine_type": { - "description": "Machine type for the VM. Machine type Q35 is required for secure boot and does not support IDE disks.\n", - "type": "string", - "x-ntnx-enum": [ - "PC", - "PSERIES", - "Q35" - ] - }, - "hardware_virtualization_enabled": { - "description": "Indicates whether hardware assisted virtualization should be enabled for the Guest OS. Once enabled, the Guest OS has the ability to deploy a nested hypervisor.\n", - "type": "boolean" - }, - "vtpm_config": { - "type": "object", - "title": "VM vTPM configuration.", - "description": "Indicates how VM vTPM should be configured.\n", - "properties": { - "vtpm_enabled": { - "description": "Indicates whether virtual trusted platform module should be enabled for the Guest OS.\n", - "type": "boolean" - }, - "data_source_reference": { - "title": "Reference", - "description": "Reference to a kind. Either one of (kind, uuid) or url needs to be specified.\n", - "type": "object", - "properties": { - "kind": { - "type": "string" - }, - "uuid": { - "type": "string", - "format": "UUID", - "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" - }, - "name": { - "readOnly": true, - "type": "string" - }, - "url": { - "type": "string", - "pattern": "^((((http[s]?):\\/)?\\/?([^:\\/\\s]+)((\\/\\w+)*(:[0-9]+)*?\\/)([\\w\\-\\.]+[^#?\\s]+)(.*)?)(#[\\w\\-]+)?$|(http[s]?:\\/\\/([\\w\\d\\-_\\.])((\\/?\\w+\\.*)*(:[0-9]+)*\\/?)))", - "description": "GET query on the URL will provide information on the source.\n" - } - } - } - } - }, - "disk_list": { - "description": "Disks attached to the VM.", - "type": "array", - "items": { - "title": "VirtualMachine Disk (VM Disk)", - "description": "VirtualMachine Disk (VM Disk).", - "type": "object", - "properties": { - "uuid": { - "description": "The device ID which is used to uniquely identify this particular disk.\n", - "type": "string", - "format": "UUID", - "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" - }, - "device_properties": { - "type": "object", - "properties": { - "disk_address": { - "title": "Disk Address", - "description": "Disk Address.", - "type": "object", - "required": [ - "adapter_type", - "device_index" - ], - "properties": { - "adapter_type": { - "type": "string", - "x-ntnx-enum": [ - "SCSI", - "IDE", - "PCI", - "SATA", - "SPAPR" - ] - }, - "device_index": { - "type": "integer" - } - } - }, - "device_type": { - "type": "string", - "default": "DISK", - "x-ntnx-enum": [ - "DISK", - "CDROM", - "VOLUME_GROUP" - ] - } - } - }, - "disk_size_mib": { - "description": "Size of the disk in MiB. Must match the size specified in 'disk_size_bytes' - rounded up to the nearest MiB - when that field is present.\n", - "type": "integer", - "format": "int32", - "minimum": 1 - }, - "disk_size_bytes": { - "description": "Size of the disk in Bytes.", - "type": "integer", - "format": "int64", - "minimum": 1 - }, - "data_source_reference": { - "type": "object", - "properties": { - "kind": { - "type": "string" - }, - "uuid": { - "type": "string", - "format": "UUID", - "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" - }, - "name": { - "readOnly": true, - "type": "string" - }, - "is_direct_attach": { - "description": "This is to indicate if attaching the referenced disk directly. Important: this should only be used by internal services. Direct attaching a disk that is used by another VM will result in data loss.\n", - "type": "boolean" - }, - "url": { - "type": "string", - "pattern": "^((((http[s]?):\\/)?\\/?([^:\\/\\s]+)((\\/\\w+)*(:[0-9]+)*?\\/)([\\w\\-\\.]+[^#?\\s]+)(.*)?)(#[\\w\\-]+)?$|(http[s]?:\\/\\/([\\w\\d\\-_\\.])((\\/?\\w+\\.*)*(:[0-9]+)*\\/?)))", - "description": "AHV sync rep uses this field to identify a dormant VM disk.\n" - } - } - }, - "volume_group_reference": { - "title": "Reference", - "description": "Reference to a kind. Either one of (kind, uuid) or url needs to be specified.\n", - "type": "object", - "properties": { - "kind": { - "type": "string" - }, - "uuid": { - "type": "string", - "format": "UUID", - "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" - }, - "name": { - "readOnly": true, - "type": "string" - }, - "url": { - "type": "string", - "pattern": "^((((http[s]?):\\/)?\\/?([^:\\/\\s]+)((\\/\\w+)*(:[0-9]+)*?\\/)([\\w\\-\\.]+[^#?\\s]+)(.*)?)(#[\\w\\-]+)?$|(http[s]?:\\/\\/([\\w\\d\\-_\\.])((\\/?\\w+\\.*)*(:[0-9]+)*\\/?)))", - "description": "GET query on the URL will provide information on the source.\n" - } - } - }, - "storage_config": { - "type": "object", - "title": "Disk Storage Configuration", - "description": "This preference specifies the storage configuration parameters for VM disks.\n", - "properties": { - "storage_container_reference": { - "title": "Reference", - "description": "Reference to a kind. Either one of (kind, uuid) or url needs to be specified.\n", - "type": "object", - "properties": { - "kind": { - "type": "string" - }, - "uuid": { - "type": "string", - "format": "UUID", - "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" - }, - "name": { - "readOnly": true, - "type": "string" - }, - "url": { - "type": "string", - "pattern": "^((((http[s]?):\\/)?\\/?([^:\\/\\s]+)((\\/\\w+)*(:[0-9]+)*?\\/)([\\w\\-\\.]+[^#?\\s]+)(.*)?)(#[\\w\\-]+)?$|(http[s]?:\\/\\/([\\w\\d\\-_\\.])((\\/?\\w+\\.*)*(:[0-9]+)*\\/?)))", - "description": "GET query on the URL will provide information on the source.\n" - } - } - }, - "flash_mode": { - "title": "Flash Mode", - "description": "State of the storage policy to pin virtual disks to the hot tier.\nWhen specified as a VM attribute, the storage policy applies to all\nvirtual disks of the VM unless overridden by the same attribute\nspecified for a virtual disk.\n", - "type": "string", - "x-ntnx-enum": [ - "ENABLED", - "DISABLED" - ] - } - } - } - } - } - }, - "nic_list": { - "description": "NICs attached to the VM.", - "type": "array", - "items": { - "title": "Virtual Machine NIC", - "description": "Virtual Machine NIC.", - "type": "object", - "properties": { - "uuid": { - "description": "The NIC's UUID, which is used to uniquely identify this particular NIC. This UUID may be used to refer to the NIC outside the context of the particular VM it is attached to.\n", - "type": "string", - "format": "UUID", - "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" - }, - "nic_type": { - "description": "The type of this NIC. Defaults to NORMAL_NIC.", - "type": "string", - "x-ntnx-enum": [ - "NORMAL_NIC", - "DIRECT_NIC", - "NETWORK_FUNCTION_NIC", - "SPAN_DESTINATION_NIC" - ] - }, - "vlan_mode": { - "description": "By default, all virtual NICs are created in ACCESS mode, which permits only one VLAN per virtual network. TRUNKED mode allows multiple VLANs on a single VM NIC for network-aware user VMs.\n", - "type": "string", - "x-ntnx-enum": [ - "ACCESS", - "TRUNKED" - ] - }, - "trunked_vlan_list": { - "description": "List of networks to trunk if vlan_mode is TRUNKED. If empty and VLAN mode is TRUNKED, all VLANs are trunked.\n", - "type": "array", - "items": { - "type": "integer" - } - }, - "num_queues": { - "description": "The number of tx/rx queue pairs for this NIC.\n", - "type": "integer" - }, - "mac_address": { - "description": "The MAC address for the adapter.", - "type": "string", - "pattern": "^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$", - "x-example": "50:6b:8d:ee:de:2b" - }, - "ip_endpoint_list": { - "description": "IP endpoints for the adapter. Currently, IPv4 addresses are\nsupported.\n", - "type": "array", - "items": { - "title": "IP Address", - "description": "An IP address.", - "type": "object", - "properties": { - "type": { - "description": "Address type. It can only be \"ASSIGNED\" in the spec. If no type is\nspecified in the spec, the default type is set to \"ASSIGNED\".\n", - "type": "string", - "x-ntnx-enum": [ - "ASSIGNED", - "LEARNED" - ] - }, - "ip": { - "description": "Address string.", - "type": "string", - "pattern": "^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$" - }, - "ip_type": { - "description": "Indicates whether IP address is DHCP or Static.", - "type": "string", - "x-ntnx-enum": [ - "DHCP", - "STATIC" - ] - }, - "prefix_length": { - "description": "Prefix length for the IP address.", - "type": "integer", - "format": "int32", - "minimum": 0, - "maximum": 32 - }, - "gateway_address_list": { - "description": "Gateway IP addresses matching the subnet.", - "type": "array", - "items": { - "type": "string", - "pattern": "^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$" - } - } - } - } - }, - "subnet_reference": { - "title": "Reference to a subnet", - "type": "object", - "description": "The reference to a subnet", - "required": [ - "kind", - "uuid" - ], - "properties": { - "kind": { - "type": "string", - "readOnly": true, - "description": "The kind name", - "default": "subnet", - "x-ntnx-enum": [ - "subnet" - ] - }, - "name": { - "readOnly": true, - "type": "string", - "maxLength": 1024 - }, - "uuid": { - "type": "string", - "format": "UUID", - "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" - } - } - }, - "network_function_chain_reference": { - "title": "Reference to a network_function_chain", - "type": "object", - "description": "The reference to a network_function_chain", - "required": [ - "kind", - "uuid" - ], - "properties": { - "kind": { - "type": "string", - "readOnly": true, - "description": "The kind name", - "default": "network_function_chain", - "x-ntnx-enum": [ - "network_function_chain" - ] - }, - "name": { - "readOnly": true, - "type": "string", - "maxLength": 1024 - }, - "uuid": { - "type": "string", - "format": "UUID", - "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" - } - } - }, - "network_function_nic_type": { - "description": "The type of this Network function NIC. Defaults to INGRESS.\n", - "type": "string", - "x-ntnx-enum": [ - "INGRESS", - "EGRESS", - "TAP" - ] - }, - "model": { - "description": "The model of this NIC.", - "type": "string", - "x-ntnx-enum": [ - "VIRTIO", - "E1000" - ] - }, - "is_connected": { - "description": "Whether or not the NIC is connected. True by default.", - "type": "boolean" - }, - "secondary_ip_address_list": { - "description": "Secondary IPv4 Addresses for this NIC.", - "type": "array", - "items": { - "type": "string", - "pattern": "^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$" - }, - "maxItems": 100 - } - } - } - }, - "gpu_list": { - "description": "GPUs attached to the VM.", - "type": "array", - "items": { - "title": "VirtualMachine GPU", - "description": "Graphics resource information for the Virtual Machine.", - "type": "object", - "properties": { - "mode": { - "description": "The mode of this GPU.", - "type": "string", - "x-ntnx-enum": [ - "PASSTHROUGH_GRAPHICS", - "PASSTHROUGH_COMPUTE", - "VIRTUAL" - ] - }, - "device_id": { - "description": "The device ID of the GPU.", - "type": "integer", - "format": "int32" - }, - "vendor": { - "description": "The vendor of the GPU.", - "type": "string", - "x-ntnx-enum": [ - "NVIDIA", - "INTEL", - "AMD" - ] - } - } - } - }, - "parent_reference": { - "title": "Reference", - "description": "Reference to a kind. Either one of (kind, uuid) or url needs to be specified.\n", - "type": "object", - "properties": { - "kind": { - "type": "string" - }, - "uuid": { - "type": "string", - "format": "UUID", - "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" - }, - "name": { - "readOnly": true, - "type": "string" - }, - "url": { - "type": "string", - "pattern": "^((((http[s]?):\\/)?\\/?([^:\\/\\s]+)((\\/\\w+)*(:[0-9]+)*?\\/)([\\w\\-\\.]+[^#?\\s]+)(.*)?)(#[\\w\\-]+)?$|(http[s]?:\\/\\/([\\w\\d\\-_\\.])((\\/?\\w+\\.*)*(:[0-9]+)*\\/?)))", - "description": "GET query on the URL will provide information on the source.\n" - } - } - }, - "boot_config": { - "type": "object", - "title": "VM Boot configuration", - "description": "Indicates which device a VM should boot from.\n", - "properties": { - "boot_device": { - "type": "object", - "title": "VM Boot device", - "description": "Indicates which device a VM should boot from. One of disk_address or mac_address should be provided.\n", - "x-ntnx-one-of": [ - { - "required": [ - "disk_address" - ] - }, - { - "required": [ - "mac_address" - ] - } - ], - "properties": { - "disk_address": { - "title": "Disk Address", - "description": "Disk Address.", - "type": "object", - "required": [ - "adapter_type", - "device_index" - ], - "properties": { - "adapter_type": { - "type": "string", - "x-ntnx-enum": [ - "SCSI", - "IDE", - "PCI", - "SATA", - "SPAPR" - ] - }, - "device_index": { - "type": "integer" - } - } - }, - "mac_address": { - "description": "MAC address of nic to boot from.", - "type": "string", - "pattern": "^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$", - "x-example": "50:6b:8d:ee:de:2b" - } - } - }, - "boot_device_order_list": { - "description": "Indicates the order of device types in which VM should try to boot from. If boot device order is not provided the system will decide appropriate boot device order.\n", - "type": "array", - "items": { - "type": "string", - "x-ntnx-enum": [ - "CDROM", - "DISK", - "NETWORK" - ] - } - }, - "boot_type": { - "description": "Indicates whether the VM should use Secure boot, UEFI boot or Legacy boot.If UEFI or Secure boot is enabled then other legacy boot options (like boot_device and boot_device_order_list) are ignored. Secure boot depends on UEFI boot, i.e. enabling Secure boot means that UEFI boot is also enabled.\n", - "type": "string", - "x-ntnx-enum": [ - "UEFI", - "LEGACY", - "SECURE_BOOT" - ] - }, - "data_source_reference": { - "title": "Reference", - "description": "Reference to a kind. Either one of (kind, uuid) or url needs to be specified.\n", - "type": "object", - "properties": { - "kind": { - "type": "string" - }, - "uuid": { - "type": "string", - "format": "UUID", - "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" - }, - "name": { - "readOnly": true, - "type": "string" - }, - "url": { - "type": "string", - "pattern": "^((((http[s]?):\\/)?\\/?([^:\\/\\s]+)((\\/\\w+)*(:[0-9]+)*?\\/)([\\w\\-\\.]+[^#?\\s]+)(.*)?)(#[\\w\\-]+)?$|(http[s]?:\\/\\/([\\w\\d\\-_\\.])((\\/?\\w+\\.*)*(:[0-9]+)*\\/?)))", - "description": "GET query on the URL will provide information on the source.\n" - } - } - } - } - }, - "guest_customization": { - "type": "object", - "title": "Guest Customization Configuration for creation/modification request", - "description": "VM guests may be customized at boot time using one of several different methods. Currently, cloud-init w/ ConfigDriveV2 (for Linux VMs) and Sysprep (for Windows VMs) are supported. Only ONE OF sysprep or cloud_init should be provided. Note that guest customization can currently only be set during VM creation. Attempting to change it after creation will result in an error. Additional properties can be specified. For example - in the context of VM template creation if \"override_script\" is set to \"True\" then the deployer can upload their own custom script.\n", - "additionalProperties": { - "type": "string" - }, - "x-ntnx-one-of": [ - { - "required": [ - "sysprep" - ] - }, - { - "required": [ - "cloud_init" - ] - } - ], - "properties": { - "is_overridable": { - "type": "boolean", - "description": "Flag to allow override of customization by deployer.", - "default": false - }, - "sysprep": { - "type": "object", - "description": "If this field is set, the guest will be customized using Sysprep. Either unattend_xml or custom_key_values should be provided. If custom_key_values are provided then the unattended answer file will be generated using these key-value pairs.\n", - "x-ntnx-one-of": [ - { - "required": [ - "unattend_xml" - ] - }, - { - "required": [ - "custom_key_values" - ] - } - ], - "properties": { - "install_type": { - "description": "Whether the guest will be freshly installed using this unattend configuration, or whether this unattend configuration will be applied to a pre-prepared image. Default is \"PREPARED\".\n", - "type": "string", - "default": "PREPARED", - "x-ntnx-enum": [ - "FRESH", - "PREPARED" - ] - }, - "unattend_xml": { - "description": "This field contains a Sysprep unattend xml definition, as a string. The value must be base64 encoded.\n", - "type": "string", - "maxLength": 32000 - }, - "custom_key_values": { - "title": "Generic key value pair", - "description": "Generic key value pair used for custom attributes", - "type": "object", - "additionalProperties": { - "type": "string" - } - } - } - }, - "cloud_init": { - "type": "object", - "description": "If this field is set, the guest will be customized using cloud-init. Either user_data or custom_key_values should be provided. If custom_key_ves are provided then the user data will be generated using these key-value pairs.\n", - "x-ntnx-one-of": [ - { - "required": [ - "user_data" - ] - }, - { - "required": [ - "custom_key_values" - ] - } - ], - "properties": { - "meta_data": { - "description": "The contents of the meta_data configuration for cloud-init. This can be formatted as YAML or JSON. The value must be base64 encoded.\n", - "type": "string", - "maxLength": 32000 - }, - "user_data": { - "description": "The contents of the user_data configuration for cloud-init. This can be formatted as YAML, JSON, or could be a shell script. The value must be base64 encoded.\n", - "type": "string", - "maxLength": 128000 - }, - "custom_key_values": { - "title": "Generic key value pair", - "description": "Generic key value pair used for custom attributes", - "type": "object", - "additionalProperties": { - "type": "string" - } - } - } - } - } - }, - "guest_tools": { - "type": "object", - "title": "Guest Tools information", - "description": "Information regarding guest tools.", - "properties": { - "nutanix_guest_tools": { - "type": "object", - "title": "Nutanix Guest Tools information", - "description": "Information regarding Nutanix Guest Tools.", - "properties": { - "ngt_state": { - "description": "Nutanix guest tools is installed or not.", - "type": "string", - "x-ntnx-enum": [ - "INSTALLED", - "UNINSTALLED" - ] - }, - "credentials": { - "title": "Credentials to login server", - "description": "Credentials to login server", - "type": "object", - "required": [ - "username" - ], - "properties": { - "username": { - "type": "string" - }, - "password": { - "type": "string" - } - } - }, - "state": { - "description": "Nutanix Guest Tools is enabled or not.", - "type": "string", - "x-ntnx-enum": [ - "ENABLED", - "DISABLED" - ] - }, - "iso_mount_state": { - "description": "Desired mount state of Nutanix Guest Tools ISO.\n", - "type": "string", - "x-ntnx-enum": [ - "MOUNTED", - "UNMOUNTED" - ] - }, - "enabled_capability_list": { - "description": "Application names that are enabled.", - "type": "array", - "items": { - "type": "string", - "x-ntnx-enum": [ - "SELF_SERVICE_RESTORE", - "VSS_SNAPSHOT" - ] - } - }, - "version": { - "description": "Desired Version of Nutanix Guest Tools installed on the VM.", - "type": "string" - } - } - } - } - }, - "vga_console_enabled": { - "description": "Indicates whether VGA console should be enabled or not.", - "type": "boolean" - }, - "vnuma_config": { - "type": "object", - "title": "VM vNUMA configuration", - "description": "Indicates how VM vNUMA should be configured\n", - "properties": { - "num_vnuma_nodes": { - "description": "Number of vNUMA nodes. 0 means vNUMA is disabled.", - "type": "integer", - "format": "int64" - } - } - }, - "serial_port_list": { - "description": "Serial ports configured on the VM.", - "type": "array", - "items": { - "type": "object", - "title": "VM serial port connection.", - "description": "Indicates the configuration of serial ports of the VM.\n", - "properties": { - "is_connected": { - "description": "Indicates whether the serial port connection is connected or not.\n", - "type": "boolean" - }, - "index": { - "description": "Index of the serial port.", - "type": "integer" - } - } - } - }, - "storage_config": { - "type": "object", - "title": "VM Storage Config input", - "description": "User inputs of storage configuration parameters for VMs.", - "properties": { - "qos_policy": { - "type": "object", - "title": "Storage Qos Configuration Input", - "description": "QoS parameters to be enforced", - "required": [ - "throttled_iops" - ], - "properties": { - "throttled_iops": { - "description": "Throttled iops for the entities being governed.\nThe block size for the IO is 32kB.\n", - "type": "integer", - "format": "int64", - "default": -1 - } - } - }, - "flash_mode": { - "title": "Flash Mode", - "description": "State of the storage policy to pin virtual disks to the hot tier.\nWhen specified as a VM attribute, the storage policy applies to all\nvirtual disks of the VM unless overridden by the same attribute\nspecified for a virtual disk.\n", - "type": "string", - "x-ntnx-enum": [ - "ENABLED", - "DISABLED" - ] - } - } - } - } - }, - "availability_zone_reference": { - "title": "Reference to a availability_zone", - "type": "object", - "description": "The reference to a availability_zone", - "required": [ - "kind", - "uuid" - ], - "properties": { - "kind": { - "type": "string", - "readOnly": true, - "description": "The kind name", - "default": "availability_zone", - "x-ntnx-enum": [ - "availability_zone" - ] - }, - "name": { - "readOnly": true, - "type": "string", - "maxLength": 1024 - }, - "uuid": { - "type": "string", - "format": "UUID", - "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" - } - } - }, - "cluster_reference": { - "title": "Reference to a cluster", - "type": "object", - "description": "The reference to a cluster", - "required": [ - "kind", - "uuid" - ], - "properties": { - "kind": { - "type": "string", - "readOnly": true, - "description": "The kind name", - "default": "cluster", - "x-ntnx-enum": [ - "cluster" - ] - }, - "name": { - "readOnly": true, - "type": "string", - "maxLength": 1024 - }, - "uuid": { - "type": "string", - "format": "UUID", - "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" - } - } - } - } - } - } -} diff --git a/generate_spec.py b/generate_spec.py index 61dbb20bb..3e70722b3 100644 --- a/generate_spec.py +++ b/generate_spec.py @@ -4,8 +4,8 @@ def generate_spec(data, variable_name='', default={}): is_list = False required = [] - if data.get('required'): - required = data['required'] + # if data.get('required'): + # required = data['required'] if 'additionalProperties' in data.keys(): data = data['additionalProperties'] if 'items' in data.keys(): @@ -20,7 +20,7 @@ def generate_spec(data, variable_name='', default={}): return '{{' + variable_name + '}}' for k, v in data.items(): data[k] = generate_spec(v, variable_name + '__' + str(k) if variable_name else str(k)) - data['required'] = required + # data['required'] = required if is_list: data.update({'list_key': variable_name}) return [data] @@ -43,64 +43,3 @@ def parse_json_to_spec(json_files_dir='', spec_files_dir=''): spec_file.write(json.dumps(spec)) print(json.dumps(spec, indent=4)) return spec - - -spec = parse_json_to_spec() -print(spec) - -def clean_spec(self, spec): - if not isinstance(spec, dict): - raise ValueError(spec) - for k, v in spec.copy().items(): - if isinstance(v, str): - if v.startswith('{{') and v.endswith('}}'): - if self.get(v[2:-2]): - spec[k] = self.get(v[2:-2]) - else: - spec.pop(k) - elif isinstance(v, dict): - v = clean_spec(self,v) - if v: - spec[k] = v - else: - spec.pop(k) - elif isinstance(v,list) and k != 'required': - v = [clean_spec(self,i) for i in v] - if tuple(i for i in v if i): - spec[k] = v - else: - spec.pop(k) - print('-----------------------------------') - - requirements = spec.get('required',()) - # print(requirements) - # if not requirements: - # for k, v in spec.items(): - # print(k,v,'////////////') - # if isinstance(v, dict) and v.get('required'): - # requirements.append(k) - # print(requirements) - # print(spec) - # print('++++++++++++++++++++++++++++++') - # print() - # print() - if not set(requirements) <= spec.keys() or not spec: - return {'required': requirements} - return spec - - -self = {'action': 'create', 'credentials': {'username': 'admin', 'password': 'Nutanix.123'}, - 'ip_address': '10.44.77.6', 'port': '9440', 'cluster_uuid': '0005d2b3-16d0-829d-4591-ac1f6b6f97e7', - 'name': 'test', 'spec__name': 'test', - # 'spec__cluster_reference__uuid': '0005d2b3-16d0-829d-4591-ac1f6b6f97e7', - 'wait': True, 'wait_timeout': 300, 'validate_certs': False, - 'spec__resources__nic_list__is_connected': False, - 'spec__cluster_reference__kind': 'cluster', - 'spec__resources__nic_list__subnet_reference__kind': 'subnet', - 'data': None, 'operations': None, 'uuid': None, - 'cpu_properties': None, - 'spec__cluster_reference__name': None, - 'spec__resources__nic_list__subnet_reference__uuid': None, - 'spec__resources__nic_list__subnet_reference__name': None, 'nic_list': None} - -print(json.dumps(clean_spec(self,spec), indent=4)) \ No newline at end of file diff --git a/testjson.json b/testjson.json deleted file mode 100644 index bed6c1dd4..000000000 --- a/testjson.json +++ /dev/null @@ -1,1108 +0,0 @@ -{ - "type": "object", - "title": "vm Intent Entity", - "description": "An intentful representation of a vm", - "required": [ - "metadata", - "spec" - ], - "properties": { - "api_version": { - "title": "API Version", - "description": "API Version of the Nutanix v3 API framework.", - "type": "string", - "readOnly": true, - "default": "3.1.0" - }, - "metadata": { - "title": "vm metadata", - "type": "object", - "description": "The vm kind metadata", - "required": [ - "kind" - ], - "properties": { - "kind": { - "type": "string", - "readOnly": true, - "description": "The kind name", - "default": "vm", - "x-ntnx-enum": [ - "vm" - ] - }, - "uuid": { - "description": "vm uuid", - "type": "string", - "format": "UUID", - "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" - }, - "name": { - "description": "vm name", - "type": "string", - "readOnly": true, - "maxLength": 80 - }, - "spec_version": { - "type": "integer", - "description": "Version number of the latest spec." - }, - "spec_hash": { - "type": "string", - "description": "Hash of the spec. This will be returned from server.\n" - }, - "categories": { - "type": "object", - "description": "Categories for the vm. This allows assigning one value\nof a key to any entity. Changes done in this will be reflected in\nthe categories_mapping field.\n", - "additionalProperties": { - "type": "string" - } - }, - "categories_mapping": { - "type": "object", - "description": "Categories for the vm. This allows setting up multiple\nvalues from a single key. Categories assigned using the older view will be\npresent here. This is the new way of assigning categories.\n", - "additionalProperties": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "use_categories_mapping": { - "type": "boolean", - "default": false, - "description": "Client need to specify this field as true if user want to use the\nnewer way of assigning the categories. Without this things should work\nas it was earlier.\n" - }, - "creation_time": { - "type": "string", - "format": "date-time", - "readOnly": true, - "description": "UTC date and time in RFC-3339 format when vm was created\n" - }, - "last_update_time": { - "type": "string", - "readOnly": true, - "format": "date-time", - "description": "UTC date and time in RFC-3339 format when vm was last updated\n" - }, - "owner_reference": { - "title": "Reference to a user", - "type": "object", - "description": "The reference to a user", - "required": [ - "kind", - "uuid" - ], - "properties": { - "kind": { - "type": "string", - "readOnly": true, - "description": "The kind name", - "default": "user", - "x-ntnx-enum": [ - "user" - ] - }, - "name": { - "readOnly": true, - "type": "string", - "maxLength": 1024 - }, - "uuid": { - "type": "string", - "format": "UUID", - "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" - } - } - }, - "should_force_translate": { - "description": "Applied on Prism Central only. Indicate whether force to translate the spec of the fanout request to fit the target cluster API schema.\n", - "type": "boolean" - }, - "entity_version": { - "type": "string", - "readOnly": true, - "description": "Logical entity version that allows serializing updates to the entity\nacross multiple API namespaces. For kinds that support\nentity_version, it overrides spec_version described above.\n" - } - } - }, - "spec": { - "type": "object", - "title": "vm Intent Spec with placement specified", - "description": "An intentful representation of a vm spec", - "required": [ - "name", - "resources" - ], - "properties": { - "name": { - "description": "vm Name.", - "type": "string", - "maxLength": 256 - }, - "description": { - "description": "A description for vm.", - "type": "string", - "maxLength": 1000 - }, - "resources": { - "type": "object", - "title": "VM Resources", - "description": "VM Resources Definition.", - "properties": { - "num_sockets": { - "description": "Number of vCPU sockets.", - "type": "integer", - "format": "int32", - "format": "int32", - "minimum": 1 - }, - "num_vcpus_per_socket": { - "description": "Number of vCPUs per socket.", - "type": "integer", - "format": "int32", - "minimum": 1 - }, - "num_threads_per_core": { - "description": "Number of logical threads per core.", - "type": "integer", - "format": "int32", - "minimum": 1 - }, - "memory_size_mib": { - "description": "Memory size in MiB.", - "type": "integer", - "format": "int32", - "minimum": 1 - }, - "memory_overcommit_enabled": { - "description": "Indicates whether memory overcommit feature should be enabled for the VM. If enabled, parts of the VM's memory may reside outside of the hypervisor physical memory. When enabled, it should be expected that the VM may suffer performance degradation.\n", - "type": "boolean" - }, - "gpu_console_enabled": { - "description": "Indicates whether vGPU console is enabled or not.", - "type": "boolean" - }, - "guest_os_id": { - "description": "String that identifies the OS running inside of the guest. Reserved for use by the system. Do not set or modify.", - "type": "string", - "maxLength": 64 - }, - "is_vcpu_hard_pinned": { - "description": "Indicates whether the vCPUs should be hard pinned to specific pCPUs.", - "type": "boolean" - }, - "power_state": { - "description": "The current or desired power state of the VM.", - "type": "string", - "x-ntnx-enum": [ - "ON", - "OFF" - ] - }, - "power_state_mechanism": { - "type": "object", - "title": "VM Power State Mechanism", - "description": "Indicates the mechanism guiding the VM power state transition. Currently used for the transition to \"OFF\" state.\n", - "properties": { - "mechanism": { - "description": "Power state mechanism (ACPI/GUEST/HARD).", - "type": "string", - "x-ntnx-enum": [ - "ACPI", - "GUEST", - "HARD" - ] - }, - "guest_transition_config": { - "type": "object", - "title": "Power State Transition Config", - "description": "Extra configs related to power state transition.", - "properties": { - "enable_script_exec": { - "description": "Indicates whether to execute set script before ngt shutdown/reboot.", - "type": "boolean" - }, - "should_fail_on_script_failure": { - "description": "Indicates whether to abort ngt shutdown/reboot if script fails.", - "type": "boolean" - } - } - } - } - }, - "hardware_clock_timezone": { - "description": "VM's hardware clock timezone in IANA TZDB format (America/Los_Angeles).\n", - "type": "string", - "maxLength": 64 - }, - "is_agent_vm": { - "description": "Indicates whether the VM is an agent VM. When their host enters maintenance mode, after normal VMs are evacuated, agent VMs are powered off. When the host is restored, agent VMs are powered on before normal VMs are restored. In other words, agent VMs cannot be HA-protected or live migrated.\n", - "type": "boolean" - }, - "disable_branding": { - "description": "Indicates whether to remove AHV branding from VM firmware tables.\n", - "type": "boolean" - }, - "enable_cpu_passthrough": { - "description": "Indicates whether to passthrough the host's CPU features to the guest. Enabling this will disable live migration of the VM.\n", - "type": "boolean" - }, - "machine_type": { - "description": "Machine type for the VM. Machine type Q35 is required for secure boot and does not support IDE disks.\n", - "type": "string", - "x-ntnx-enum": [ - "PC", - "PSERIES", - "Q35" - ] - }, - "hardware_virtualization_enabled": { - "description": "Indicates whether hardware assisted virtualization should be enabled for the Guest OS. Once enabled, the Guest OS has the ability to deploy a nested hypervisor.\n", - "type": "boolean" - }, - "vtpm_config": { - "type": "object", - "title": "VM vTPM configuration.", - "description": "Indicates how VM vTPM should be configured.\n", - "properties": { - "vtpm_enabled": { - "description": "Indicates whether virtual trusted platform module should be enabled for the Guest OS.\n", - "type": "boolean" - }, - "data_source_reference": { - "title": "Reference", - "description": "Reference to a kind. Either one of (kind, uuid) or url needs to be specified.\n", - "type": "object", - "properties": { - "kind": { - "type": "string" - }, - "uuid": { - "type": "string", - "format": "UUID", - "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" - }, - "name": { - "readOnly": true, - "type": "string" - }, - "url": { - "type": "string", - "pattern": "^((((http[s]?):\\/)?\\/?([^:\\/\\s]+)((\\/\\w+)*(:[0-9]+)*?\\/)([\\w\\-\\.]+[^#?\\s]+)(.*)?)(#[\\w\\-]+)?$|(http[s]?:\\/\\/([\\w\\d\\-_\\.])((\\/?\\w+\\.*)*(:[0-9]+)*\\/?)))", - "description": "GET query on the URL will provide information on the source.\n" - } - } - } - } - }, - "disk_list": { - "description": "Disks attached to the VM.", - "type": "array", - "items": { - "title": "VirtualMachine Disk (VM Disk)", - "description": "VirtualMachine Disk (VM Disk).", - "type": "object", - "properties": { - "uuid": { - "description": "The device ID which is used to uniquely identify this particular disk.\n", - "type": "string", - "format": "UUID", - "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" - }, - "device_properties": { - "type": "object", - "properties": { - "disk_address": { - "title": "Disk Address", - "description": "Disk Address.", - "type": "object", - "required": [ - "adapter_type", - "device_index" - ], - "properties": { - "adapter_type": { - "type": "string", - "x-ntnx-enum": [ - "SCSI", - "IDE", - "PCI", - "SATA", - "SPAPR" - ] - }, - "device_index": { - "type": "integer" - } - } - }, - "device_type": { - "type": "string", - "default": "DISK", - "x-ntnx-enum": [ - "DISK", - "CDROM", - "VOLUME_GROUP" - ] - } - } - }, - "disk_size_mib": { - "description": "Size of the disk in MiB. Must match the size specified in 'disk_size_bytes' - rounded up to the nearest MiB - when that field is present.\n", - "type": "integer", - "format": "int32", - "minimum": 1 - }, - "disk_size_bytes": { - "description": "Size of the disk in Bytes.", - "type": "integer", - "format": "int64", - "minimum": 1 - }, - "data_source_reference": { - "type": "object", - "properties": { - "kind": { - "type": "string" - }, - "uuid": { - "type": "string", - "format": "UUID", - "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" - }, - "name": { - "readOnly": true, - "type": "string" - }, - "is_direct_attach": { - "description": "This is to indicate if attaching the referenced disk directly. Important: this should only be used by internal services. Direct attaching a disk that is used by another VM will result in data loss.\n", - "type": "boolean" - }, - "url": { - "type": "string", - "pattern": "^((((http[s]?):\\/)?\\/?([^:\\/\\s]+)((\\/\\w+)*(:[0-9]+)*?\\/)([\\w\\-\\.]+[^#?\\s]+)(.*)?)(#[\\w\\-]+)?$|(http[s]?:\\/\\/([\\w\\d\\-_\\.])((\\/?\\w+\\.*)*(:[0-9]+)*\\/?)))", - "description": "AHV sync rep uses this field to identify a dormant VM disk.\n" - } - } - }, - "volume_group_reference": { - "title": "Reference", - "description": "Reference to a kind. Either one of (kind, uuid) or url needs to be specified.\n", - "type": "object", - "properties": { - "kind": { - "type": "string" - }, - "uuid": { - "type": "string", - "format": "UUID", - "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" - }, - "name": { - "readOnly": true, - "type": "string" - }, - "url": { - "type": "string", - "pattern": "^((((http[s]?):\\/)?\\/?([^:\\/\\s]+)((\\/\\w+)*(:[0-9]+)*?\\/)([\\w\\-\\.]+[^#?\\s]+)(.*)?)(#[\\w\\-]+)?$|(http[s]?:\\/\\/([\\w\\d\\-_\\.])((\\/?\\w+\\.*)*(:[0-9]+)*\\/?)))", - "description": "GET query on the URL will provide information on the source.\n" - } - } - }, - "storage_config": { - "type": "object", - "title": "Disk Storage Configuration", - "description": "This preference specifies the storage configuration parameters for VM disks.\n", - "properties": { - "storage_container_reference": { - "title": "Reference", - "description": "Reference to a kind. Either one of (kind, uuid) or url needs to be specified.\n", - "type": "object", - "properties": { - "kind": { - "type": "string" - }, - "uuid": { - "type": "string", - "format": "UUID", - "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" - }, - "name": { - "readOnly": true, - "type": "string" - }, - "url": { - "type": "string", - "pattern": "^((((http[s]?):\\/)?\\/?([^:\\/\\s]+)((\\/\\w+)*(:[0-9]+)*?\\/)([\\w\\-\\.]+[^#?\\s]+)(.*)?)(#[\\w\\-]+)?$|(http[s]?:\\/\\/([\\w\\d\\-_\\.])((\\/?\\w+\\.*)*(:[0-9]+)*\\/?)))", - "description": "GET query on the URL will provide information on the source.\n" - } - } - }, - "flash_mode": { - "title": "Flash Mode", - "description": "State of the storage policy to pin virtual disks to the hot tier.\nWhen specified as a VM attribute, the storage policy applies to all\nvirtual disks of the VM unless overridden by the same attribute\nspecified for a virtual disk.\n", - "type": "string", - "x-ntnx-enum": [ - "ENABLED", - "DISABLED" - ] - } - } - } - } - } - }, - "nic_list": { - "description": "NICs attached to the VM.", - "type": "array", - "items": { - "title": "Virtual Machine NIC", - "description": "Virtual Machine NIC.", - "type": "object", - "properties": { - "uuid": { - "description": "The NIC's UUID, which is used to uniquely identify this particular NIC. This UUID may be used to refer to the NIC outside the context of the particular VM it is attached to.\n", - "type": "string", - "format": "UUID", - "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" - }, - "nic_type": { - "description": "The type of this NIC. Defaults to NORMAL_NIC.", - "type": "string", - "x-ntnx-enum": [ - "NORMAL_NIC", - "DIRECT_NIC", - "NETWORK_FUNCTION_NIC", - "SPAN_DESTINATION_NIC" - ] - }, - "vlan_mode": { - "description": "By default, all virtual NICs are created in ACCESS mode, which permits only one VLAN per virtual network. TRUNKED mode allows multiple VLANs on a single VM NIC for network-aware user VMs.\n", - "type": "string", - "x-ntnx-enum": [ - "ACCESS", - "TRUNKED" - ] - }, - "trunked_vlan_list": { - "description": "List of networks to trunk if vlan_mode is TRUNKED. If empty and VLAN mode is TRUNKED, all VLANs are trunked.\n", - "type": "array", - "items": { - "type": "integer" - } - }, - "num_queues": { - "description": "The number of tx/rx queue pairs for this NIC.\n", - "type": "integer" - }, - "mac_address": { - "description": "The MAC address for the adapter.", - "type": "string", - "pattern": "^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$", - "x-example": "50:6b:8d:ee:de:2b" - }, - "ip_endpoint_list": { - "description": "IP endpoints for the adapter. Currently, IPv4 addresses are\nsupported.\n", - "type": "array", - "items": { - "title": "IP Address", - "description": "An IP address.", - "type": "object", - "properties": { - "type": { - "description": "Address type. It can only be \"ASSIGNED\" in the spec. If no type is\nspecified in the spec, the default type is set to \"ASSIGNED\".\n", - "type": "string", - "x-ntnx-enum": [ - "ASSIGNED", - "LEARNED" - ] - }, - "ip": { - "description": "Address string.", - "type": "string", - "pattern": "^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$" - }, - "ip_type": { - "description": "Indicates whether IP address is DHCP or Static.", - "type": "string", - "x-ntnx-enum": [ - "DHCP", - "STATIC" - ] - }, - "prefix_length": { - "description": "Prefix length for the IP address.", - "type": "integer", - "format": "int32", - "minimum": 0, - "maximum": 32 - }, - "gateway_address_list": { - "description": "Gateway IP addresses matching the subnet.", - "type": "array", - "items": { - "type": "string", - "pattern": "^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$" - } - } - } - } - }, - "subnet_reference": { - "title": "Reference to a subnet", - "type": "object", - "description": "The reference to a subnet", - "required": [ - "kind", - "uuid" - ], - "properties": { - "kind": { - "type": "string", - "readOnly": true, - "description": "The kind name", - "default": "subnet", - "x-ntnx-enum": [ - "subnet" - ] - }, - "name": { - "readOnly": true, - "type": "string", - "maxLength": 1024 - }, - "uuid": { - "type": "string", - "format": "UUID", - "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" - } - } - }, - "network_function_chain_reference": { - "title": "Reference to a network_function_chain", - "type": "object", - "description": "The reference to a network_function_chain", - "required": [ - "kind", - "uuid" - ], - "properties": { - "kind": { - "type": "string", - "readOnly": true, - "description": "The kind name", - "default": "network_function_chain", - "x-ntnx-enum": [ - "network_function_chain" - ] - }, - "name": { - "readOnly": true, - "type": "string", - "maxLength": 1024 - }, - "uuid": { - "type": "string", - "format": "UUID", - "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" - } - } - }, - "network_function_nic_type": { - "description": "The type of this Network function NIC. Defaults to INGRESS.\n", - "type": "string", - "x-ntnx-enum": [ - "INGRESS", - "EGRESS", - "TAP" - ] - }, - "model": { - "description": "The model of this NIC.", - "type": "string", - "x-ntnx-enum": [ - "VIRTIO", - "E1000" - ] - }, - "is_connected": { - "description": "Whether or not the NIC is connected. True by default.", - "type": "boolean" - }, - "secondary_ip_address_list": { - "description": "Secondary IPv4 Addresses for this NIC.", - "type": "array", - "items": { - "type": "string", - "pattern": "^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$" - }, - "maxItems": 100 - } - } - } - }, - "gpu_list": { - "description": "GPUs attached to the VM.", - "type": "array", - "items": { - "title": "VirtualMachine GPU", - "description": "Graphics resource information for the Virtual Machine.", - "type": "object", - "properties": { - "mode": { - "description": "The mode of this GPU.", - "type": "string", - "x-ntnx-enum": [ - "PASSTHROUGH_GRAPHICS", - "PASSTHROUGH_COMPUTE", - "VIRTUAL" - ] - }, - "device_id": { - "description": "The device ID of the GPU.", - "type": "integer", - "format": "int32" - }, - "vendor": { - "description": "The vendor of the GPU.", - "type": "string", - "x-ntnx-enum": [ - "NVIDIA", - "INTEL", - "AMD" - ] - } - } - } - }, - "parent_reference": { - "title": "Reference", - "description": "Reference to a kind. Either one of (kind, uuid) or url needs to be specified.\n", - "type": "object", - "properties": { - "kind": { - "type": "string" - }, - "uuid": { - "type": "string", - "format": "UUID", - "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" - }, - "name": { - "readOnly": true, - "type": "string" - }, - "url": { - "type": "string", - "pattern": "^((((http[s]?):\\/)?\\/?([^:\\/\\s]+)((\\/\\w+)*(:[0-9]+)*?\\/)([\\w\\-\\.]+[^#?\\s]+)(.*)?)(#[\\w\\-]+)?$|(http[s]?:\\/\\/([\\w\\d\\-_\\.])((\\/?\\w+\\.*)*(:[0-9]+)*\\/?)))", - "description": "GET query on the URL will provide information on the source.\n" - } - } - }, - "boot_config": { - "type": "object", - "title": "VM Boot configuration", - "description": "Indicates which device a VM should boot from.\n", - "properties": { - "boot_device": { - "type": "object", - "title": "VM Boot device", - "description": "Indicates which device a VM should boot from. One of disk_address or mac_address should be provided.\n", - "x-ntnx-one-of": [ - { - "required": [ - "disk_address" - ] - }, - { - "required": [ - "mac_address" - ] - } - ], - "properties": { - "disk_address": { - "title": "Disk Address", - "description": "Disk Address.", - "type": "object", - "required": [ - "adapter_type", - "device_index" - ], - "properties": { - "adapter_type": { - "type": "string", - "x-ntnx-enum": [ - "SCSI", - "IDE", - "PCI", - "SATA", - "SPAPR" - ] - }, - "device_index": { - "type": "integer" - } - } - }, - "mac_address": { - "description": "MAC address of nic to boot from.", - "type": "string", - "pattern": "^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$", - "x-example": "50:6b:8d:ee:de:2b" - } - } - }, - "boot_device_order_list": { - "description": "Indicates the order of device types in which VM should try to boot from. If boot device order is not provided the system will decide appropriate boot device order.\n", - "type": "array", - "items": { - "type": "string", - "x-ntnx-enum": [ - "CDROM", - "DISK", - "NETWORK" - ] - } - }, - "boot_type": { - "description": "Indicates whether the VM should use Secure boot, UEFI boot or Legacy boot.If UEFI or Secure boot is enabled then other legacy boot options (like boot_device and boot_device_order_list) are ignored. Secure boot depends on UEFI boot, i.e. enabling Secure boot means that UEFI boot is also enabled.\n", - "type": "string", - "x-ntnx-enum": [ - "UEFI", - "LEGACY", - "SECURE_BOOT" - ] - }, - "data_source_reference": { - "title": "Reference", - "description": "Reference to a kind. Either one of (kind, uuid) or url needs to be specified.\n", - "type": "object", - "properties": { - "kind": { - "type": "string" - }, - "uuid": { - "type": "string", - "format": "UUID", - "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" - }, - "name": { - "readOnly": true, - "type": "string" - }, - "url": { - "type": "string", - "pattern": "^((((http[s]?):\\/)?\\/?([^:\\/\\s]+)((\\/\\w+)*(:[0-9]+)*?\\/)([\\w\\-\\.]+[^#?\\s]+)(.*)?)(#[\\w\\-]+)?$|(http[s]?:\\/\\/([\\w\\d\\-_\\.])((\\/?\\w+\\.*)*(:[0-9]+)*\\/?)))", - "description": "GET query on the URL will provide information on the source.\n" - } - } - } - } - }, - "guest_customization": { - "type": "object", - "title": "Guest Customization Configuration for creation/modification request", - "description": "VM guests may be customized at boot time using one of several different methods. Currently, cloud-init w/ ConfigDriveV2 (for Linux VMs) and Sysprep (for Windows VMs) are supported. Only ONE OF sysprep or cloud_init should be provided. Note that guest customization can currently only be set during VM creation. Attempting to change it after creation will result in an error. Additional properties can be specified. For example - in the context of VM template creation if \"override_script\" is set to \"True\" then the deployer can upload their own custom script.\n", - "additionalProperties": { - "type": "string" - }, - "x-ntnx-one-of": [ - { - "required": [ - "sysprep" - ] - }, - { - "required": [ - "cloud_init" - ] - } - ], - "properties": { - "is_overridable": { - "type": "boolean", - "description": "Flag to allow override of customization by deployer.", - "default": false - }, - "sysprep": { - "type": "object", - "description": "If this field is set, the guest will be customized using Sysprep. Either unattend_xml or custom_key_values should be provided. If custom_key_values are provided then the unattended answer file will be generated using these key-value pairs.\n", - "x-ntnx-one-of": [ - { - "required": [ - "unattend_xml" - ] - }, - { - "required": [ - "custom_key_values" - ] - } - ], - "properties": { - "install_type": { - "description": "Whether the guest will be freshly installed using this unattend configuration, or whether this unattend configuration will be applied to a pre-prepared image. Default is \"PREPARED\".\n", - "type": "string", - "default": "PREPARED", - "x-ntnx-enum": [ - "FRESH", - "PREPARED" - ] - }, - "unattend_xml": { - "description": "This field contains a Sysprep unattend xml definition, as a string. The value must be base64 encoded.\n", - "type": "string", - "maxLength": 32000 - }, - "custom_key_values": { - "title": "Generic key value pair", - "description": "Generic key value pair used for custom attributes", - "type": "object", - "additionalProperties": { - "type": "string" - } - } - } - }, - "cloud_init": { - "type": "object", - "description": "If this field is set, the guest will be customized using cloud-init. Either user_data or custom_key_values should be provided. If custom_key_ves are provided then the user data will be generated using these key-value pairs.\n", - "x-ntnx-one-of": [ - { - "required": [ - "user_data" - ] - }, - { - "required": [ - "custom_key_values" - ] - } - ], - "properties": { - "meta_data": { - "description": "The contents of the meta_data configuration for cloud-init. This can be formatted as YAML or JSON. The value must be base64 encoded.\n", - "type": "string", - "maxLength": 32000 - }, - "user_data": { - "description": "The contents of the user_data configuration for cloud-init. This can be formatted as YAML, JSON, or could be a shell script. The value must be base64 encoded.\n", - "type": "string", - "maxLength": 128000 - }, - "custom_key_values": { - "title": "Generic key value pair", - "description": "Generic key value pair used for custom attributes", - "type": "object", - "additionalProperties": { - "type": "string" - } - } - } - } - } - }, - "guest_tools": { - "type": "object", - "title": "Guest Tools information", - "description": "Information regarding guest tools.", - "properties": { - "nutanix_guest_tools": { - "type": "object", - "title": "Nutanix Guest Tools information", - "description": "Information regarding Nutanix Guest Tools.", - "properties": { - "ngt_state": { - "description": "Nutanix guest tools is installed or not.", - "type": "string", - "x-ntnx-enum": [ - "INSTALLED", - "UNINSTALLED" - ] - }, - "credentials": { - "title": "Credentials to login server", - "description": "Credentials to login server", - "type": "object", - "required": [ - "username" - ], - "properties": { - "username": { - "type": "string" - }, - "password": { - "type": "string" - } - } - }, - "state": { - "description": "Nutanix Guest Tools is enabled or not.", - "type": "string", - "x-ntnx-enum": [ - "ENABLED", - "DISABLED" - ] - }, - "iso_mount_state": { - "description": "Desired mount state of Nutanix Guest Tools ISO.\n", - "type": "string", - "x-ntnx-enum": [ - "MOUNTED", - "UNMOUNTED" - ] - }, - "enabled_capability_list": { - "description": "Application names that are enabled.", - "type": "array", - "items": { - "type": "string", - "x-ntnx-enum": [ - "SELF_SERVICE_RESTORE", - "VSS_SNAPSHOT" - ] - } - }, - "version": { - "description": "Desired Version of Nutanix Guest Tools installed on the VM.", - "type": "string" - } - } - } - } - }, - "vga_console_enabled": { - "description": "Indicates whether VGA console should be enabled or not.", - "type": "boolean" - }, - "vnuma_config": { - "type": "object", - "title": "VM vNUMA configuration", - "description": "Indicates how VM vNUMA should be configured\n", - "properties": { - "num_vnuma_nodes": { - "description": "Number of vNUMA nodes. 0 means vNUMA is disabled.", - "type": "integer", - "format": "int64" - } - } - }, - "serial_port_list": { - "description": "Serial ports configured on the VM.", - "type": "array", - "items": { - "type": "object", - "title": "VM serial port connection.", - "description": "Indicates the configuration of serial ports of the VM.\n", - "properties": { - "is_connected": { - "description": "Indicates whether the serial port connection is connected or not.\n", - "type": "boolean" - }, - "index": { - "description": "Index of the serial port.", - "type": "integer" - } - } - } - }, - "storage_config": { - "type": "object", - "title": "VM Storage Config input", - "description": "User inputs of storage configuration parameters for VMs.", - "properties": { - "qos_policy": { - "type": "object", - "title": "Storage Qos Configuration Input", - "description": "QoS parameters to be enforced", - "required": [ - "throttled_iops" - ], - "properties": { - "throttled_iops": { - "description": "Throttled iops for the entities being governed.\nThe block size for the IO is 32kB.\n", - "type": "integer", - "format": "int64", - "default": -1 - } - } - }, - "flash_mode": { - "title": "Flash Mode", - "description": "State of the storage policy to pin virtual disks to the hot tier.\nWhen specified as a VM attribute, the storage policy applies to all\nvirtual disks of the VM unless overridden by the same attribute\nspecified for a virtual disk.\n", - "type": "string", - "x-ntnx-enum": [ - "ENABLED", - "DISABLED" - ] - } - } - } - } - }, - "availability_zone_reference": { - "title": "Reference to a availability_zone", - "type": "object", - "description": "The reference to a availability_zone", - "required": [ - "kind", - "uuid" - ], - "properties": { - "kind": { - "type": "string", - "readOnly": true, - "description": "The kind name", - "default": "availability_zone", - "x-ntnx-enum": [ - "availability_zone" - ] - }, - "name": { - "readOnly": true, - "type": "string", - "maxLength": 1024 - }, - "uuid": { - "type": "string", - "format": "UUID", - "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" - } - } - }, - "cluster_reference": { - "title": "Reference to a cluster", - "type": "object", - "description": "The reference to a cluster", - "required": [ - "kind", - "uuid" - ], - "properties": { - "kind": { - "type": "string", - "readOnly": true, - "description": "The kind name", - "default": "cluster", - "x-ntnx-enum": [ - "cluster" - ] - }, - "name": { - "readOnly": true, - "type": "string", - "maxLength": 1024 - }, - "uuid": { - "type": "string", - "format": "UUID", - "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" - } - } - } - } - } - } -}