{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://vmware.com/schemas/vsphere/virtual-machine.json",
  "title": "VMware vSphere Virtual Machine",
  "description": "Schema for a virtual machine managed by VMware vCenter Server via the vSphere Automation REST API. Represents the full configuration and runtime state of a VM including hardware, guest OS, power state, and placement within the vSphere inventory hierarchy.",
  "type": "object",
  "required": [
    "name",
    "guest_OS"
  ],
  "properties": {
    "vm": {
      "type": "string",
      "description": "Unique identifier of the virtual machine assigned by vCenter Server (e.g., vm-123)",
      "pattern": "^vm-[0-9]+$",
      "examples": ["vm-123", "vm-456"]
    },
    "name": {
      "type": "string",
      "description": "Display name of the virtual machine as shown in the vSphere inventory",
      "maxLength": 80,
      "examples": ["web-server-01", "database-prod-02"]
    },
    "power_state": {
      "type": "string",
      "description": "Current power state of the virtual machine",
      "enum": ["POWERED_ON", "POWERED_OFF", "SUSPENDED"]
    },
    "guest_OS": {
      "type": "string",
      "description": "Configured guest operating system identifier that determines default hardware settings and VMware Tools compatibility",
      "enum": [
        "RHEL_9_64",
        "RHEL_8_64",
        "CENTOS_9_64",
        "CENTOS_8_64",
        "UBUNTU_64",
        "DEBIAN_11_64",
        "DEBIAN_12_64",
        "SLES_15_64",
        "ORACLE_LINUX_9_64",
        "ORACLE_LINUX_8_64",
        "AMAZON_LINUX_3_64",
        "PHOTON_64",
        "ROCKY_LINUX_64",
        "ALMA_LINUX_64",
        "WINDOWS_SERVER_2022",
        "WINDOWS_SERVER_2019",
        "WINDOWS_SERVER_2016",
        "WINDOWS_11_64",
        "WINDOWS_10_64",
        "FREEBSD_14_64",
        "OTHER_LINUX_64",
        "OTHER_64"
      ]
    },
    "identity": {
      "type": "object",
      "description": "Unique identity attributes for the virtual machine",
      "properties": {
        "name": {
          "type": "string",
          "description": "Name of the virtual machine"
        },
        "instance_uuid": {
          "type": "string",
          "format": "uuid",
          "description": "vCenter-unique instance UUID for the virtual machine"
        },
        "bios_uuid": {
          "type": "string",
          "format": "uuid",
          "description": "BIOS UUID of the virtual machine (SMBIOS UUID)"
        }
      }
    },
    "hardware": {
      "type": "object",
      "description": "Virtual hardware configuration",
      "properties": {
        "version": {
          "type": "string",
          "description": "Virtual hardware compatibility version",
          "enum": [
            "VMX_21",
            "VMX_20",
            "VMX_19",
            "VMX_18",
            "VMX_17",
            "VMX_16",
            "VMX_15",
            "VMX_14",
            "VMX_13"
          ]
        },
        "upgrade_policy": {
          "type": "string",
          "description": "Policy for automatic hardware version upgrades",
          "enum": ["NEVER", "AFTER_CLEAN_SHUTDOWN", "ALWAYS"]
        },
        "upgrade_version": {
          "type": "string",
          "description": "Target hardware version for scheduled upgrade"
        }
      }
    },
    "cpu": {
      "type": "object",
      "description": "Virtual CPU configuration",
      "properties": {
        "count": {
          "type": "integer",
          "description": "Number of virtual CPU cores allocated to the VM",
          "minimum": 1,
          "maximum": 768,
          "examples": [2, 4, 8]
        },
        "cores_per_socket": {
          "type": "integer",
          "description": "Number of CPU cores per virtual socket, determining the number of visible sockets in the guest OS",
          "minimum": 1,
          "examples": [1, 2, 4]
        },
        "hot_add_enabled": {
          "type": "boolean",
          "description": "Whether CPU hot-add is enabled, allowing CPUs to be added while the VM is powered on"
        },
        "hot_remove_enabled": {
          "type": "boolean",
          "description": "Whether CPU hot-remove is enabled, allowing CPUs to be removed while the VM is powered on"
        }
      }
    },
    "memory": {
      "type": "object",
      "description": "Virtual memory configuration",
      "properties": {
        "size_MiB": {
          "type": "integer",
          "description": "Memory allocation in mebibytes (MiB)",
          "minimum": 4,
          "examples": [4096, 8192, 16384, 32768]
        },
        "hot_add_enabled": {
          "type": "boolean",
          "description": "Whether memory hot-add is enabled, allowing memory to be added while the VM is powered on"
        },
        "hot_add_increment_size_MiB": {
          "type": "integer",
          "description": "Memory hot-add increment granularity in mebibytes"
        },
        "hot_add_limit_MiB": {
          "type": "integer",
          "description": "Maximum memory size for hot-add operations in mebibytes"
        }
      }
    },
    "boot": {
      "type": "object",
      "description": "Boot configuration for the virtual machine",
      "properties": {
        "type": {
          "type": "string",
          "description": "Boot firmware type",
          "enum": ["BIOS", "EFI"]
        },
        "efi_legacy_boot": {
          "type": "boolean",
          "description": "Whether EFI legacy boot mode (CSM) is enabled"
        },
        "delay": {
          "type": "integer",
          "description": "Delay in milliseconds before boot begins",
          "minimum": 0
        },
        "enter_setup_mode": {
          "type": "boolean",
          "description": "Whether to enter BIOS/EFI setup screen on next boot"
        },
        "network_protocol": {
          "type": "string",
          "description": "Network boot protocol",
          "enum": ["IPV4", "IPV6"]
        },
        "retry_enabled": {
          "type": "boolean",
          "description": "Whether boot retry is enabled after failure"
        },
        "retry_delay": {
          "type": "integer",
          "description": "Delay in milliseconds between boot retries",
          "minimum": 0
        }
      }
    },
    "disks": {
      "type": "object",
      "description": "Map of virtual disk identifiers to disk configurations",
      "additionalProperties": {
        "type": "object",
        "description": "Virtual disk configuration",
        "properties": {
          "label": {
            "type": "string",
            "description": "Display label of the virtual disk (e.g., Hard disk 1)",
            "examples": ["Hard disk 1", "Hard disk 2"]
          },
          "type": {
            "type": "string",
            "description": "Type of host bus adapter controller",
            "enum": ["IDE", "SCSI", "SATA", "NVME"]
          },
          "capacity": {
            "type": "integer",
            "description": "Capacity of the virtual disk in bytes",
            "format": "int64",
            "minimum": 0
          },
          "backing": {
            "type": "object",
            "description": "Disk backing information",
            "properties": {
              "type": {
                "type": "string",
                "description": "Type of disk backing",
                "enum": ["VMDK_FILE"]
              },
              "vmdk_file": {
                "type": "string",
                "description": "Datastore path to the VMDK file (e.g., [datastore1] vm/vm.vmdk)",
                "examples": ["[datastore1] web-server-01/web-server-01.vmdk"]
              }
            }
          }
        }
      }
    },
    "nics": {
      "type": "object",
      "description": "Map of virtual network adapter identifiers to NIC configurations",
      "additionalProperties": {
        "type": "object",
        "description": "Virtual Ethernet adapter configuration",
        "properties": {
          "label": {
            "type": "string",
            "description": "Display label of the adapter",
            "examples": ["Network adapter 1"]
          },
          "type": {
            "type": "string",
            "description": "Virtual network adapter emulation type",
            "enum": ["E1000", "E1000E", "PCNET32", "VMXNET", "VMXNET2", "VMXNET3"]
          },
          "mac_type": {
            "type": "string",
            "description": "MAC address assignment type",
            "enum": ["MANUAL", "GENERATED", "ASSIGNED"]
          },
          "mac_address": {
            "type": "string",
            "description": "MAC address in colon-delimited format",
            "pattern": "^([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}$",
            "examples": ["00:50:56:ab:cd:ef"]
          },
          "state": {
            "type": "string",
            "description": "Runtime connection state",
            "enum": ["CONNECTED", "NOT_CONNECTED"]
          },
          "start_connected": {
            "type": "boolean",
            "description": "Whether the adapter connects at VM power on"
          },
          "backing": {
            "type": "object",
            "description": "Network backing for the adapter",
            "properties": {
              "type": {
                "type": "string",
                "enum": ["STANDARD_PORTGROUP", "DISTRIBUTED_PORTGROUP", "OPAQUE_NETWORK", "HOST_DEVICE"]
              },
              "network": {
                "type": "string",
                "description": "Identifier of the backing network"
              }
            }
          },
          "allow_guest_control": {
            "type": "boolean",
            "description": "Whether the guest OS can modify adapter settings"
          },
          "wake_on_lan_enabled": {
            "type": "boolean",
            "description": "Whether Wake-on-LAN is enabled"
          }
        }
      }
    },
    "cdroms": {
      "type": "object",
      "description": "Map of CD-ROM identifiers to CD-ROM configurations",
      "additionalProperties": {
        "type": "object",
        "properties": {
          "label": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": ["IDE", "SATA"]
          },
          "state": {
            "type": "string",
            "enum": ["CONNECTED", "NOT_CONNECTED"]
          },
          "start_connected": {
            "type": "boolean"
          },
          "backing": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": ["ISO_FILE", "HOST_DEVICE", "CLIENT_DEVICE"]
              },
              "iso_file": {
                "type": "string",
                "description": "Datastore path to the ISO file"
              }
            }
          },
          "allow_guest_control": {
            "type": "boolean"
          }
        }
      }
    },
    "placement": {
      "type": "object",
      "description": "Current placement of the virtual machine within the vSphere inventory",
      "properties": {
        "folder": {
          "type": "string",
          "description": "Identifier of the VM folder containing this VM"
        },
        "host": {
          "type": "string",
          "description": "Identifier of the ESXi host running this VM"
        },
        "cluster": {
          "type": "string",
          "description": "Identifier of the cluster containing this VM"
        },
        "resource_pool": {
          "type": "string",
          "description": "Identifier of the resource pool for this VM"
        },
        "datastore": {
          "type": "string",
          "description": "Identifier of the primary datastore for VM files"
        },
        "datacenter": {
          "type": "string",
          "description": "Identifier of the datacenter containing this VM"
        }
      }
    },
    "guest": {
      "type": "object",
      "description": "Guest operating system information reported by VMware Tools",
      "properties": {
        "name": {
          "type": "string",
          "description": "Full name of the guest operating system",
          "examples": ["Red Hat Enterprise Linux 9 (64-bit)", "Microsoft Windows Server 2022 (64-bit)"]
        },
        "family": {
          "type": "string",
          "description": "Guest OS family classification",
          "enum": ["LINUX", "WINDOWS", "OTHER"]
        },
        "host_name": {
          "type": "string",
          "description": "Hostname of the guest operating system"
        },
        "ip_address": {
          "type": "string",
          "description": "Primary IP address of the guest",
          "format": "ipv4"
        },
        "tools_status": {
          "type": "string",
          "description": "Status of VMware Tools in the guest",
          "enum": [
            "NOT_INSTALLED",
            "NOT_RUNNING",
            "OUT_OF_DATE",
            "CURRENT"
          ]
        },
        "tools_version": {
          "type": "string",
          "description": "Version of VMware Tools installed",
          "examples": ["12.3.5"]
        }
      }
    },
    "tags": {
      "type": "array",
      "description": "Tags attached to this virtual machine for classification and organization",
      "items": {
        "type": "object",
        "properties": {
          "tag_id": {
            "type": "string",
            "description": "Identifier of the attached tag"
          },
          "category_id": {
            "type": "string",
            "description": "Identifier of the tag category"
          },
          "name": {
            "type": "string",
            "description": "Display name of the tag"
          }
        }
      }
    },
    "storage": {
      "type": "object",
      "description": "Storage consumption information",
      "properties": {
        "committed": {
          "type": "integer",
          "description": "Total storage space committed to this VM in bytes",
          "format": "int64"
        },
        "uncommitted": {
          "type": "integer",
          "description": "Total storage space potentially used by this VM in bytes",
          "format": "int64"
        },
        "unshared": {
          "type": "integer",
          "description": "Total storage space occupied by this VM that is not shared with any other VM in bytes",
          "format": "int64"
        }
      }
    }
  }
}
