REST API - list

vcenter storage policies compliance VM: list

Returns compliance information about at most 1000 virtual machines matching the filter vcenter.storage.policies.compliance.VM.filter_spec. If there are no virtual machines matching the vcenter.storage.policies.compliance.VM.filter_spec an empty List is returned. Virtual machines without storage policy association are not returned. This operation was added in vSphere API 6.7.

Request:

HTTP request

GET https://{server}/rest/vcenter/storage/policies/compliance/vm

?filter.vms.1=obj-103
&filter.vms.2=obj-103
&filter.status.1=COMPLIANT
&filter.status.2=COMPLIANT

Request Query Parameters:

Name Type Description
bold = required
filter filter_spec compliance status of matching virtual machines for which information should be returned.
filter.status string[] Compliance Status that a virtual machine must have to match the filter. Atleast one status must be specified. This attribute was added in vSphere API 6.7.

filter.vms string[] Identifiers of virtual machines that can match the filter. This attribute was added in vSphere API 6.7.

Optional. If unset or empty, virtual machines with any identifier matches the filter. When clients pass a value of this structure as a parameter, the field must contain identifiers for the resource type: VirtualMachine. When operations return a value of this structure as a result, the field will contain identifiers for the resource type: VirtualMachine.

Response:

HTTP Status Code: 200

Representation:

{
    "value"[
        {
            "value"{
                "disks"[
                    {
                        "value""COMPLIANT",
                        "key""obj-103"
                    }
                ],
                "vm_home""COMPLIANT"
            },
            "key""obj-103"
        }
    ]
}

Response Type:

Name Type Description
bold = required
value list compliance information about virtual machines matching the filter vcenter.storage.policies.compliance.VM.filter_spec.List of {"key": string, "value": info}
value[].key string
value[].value info
value[].value.vm_home string Compliance status of the virtual machine home. This attribute was added in vSphere API 6.7.

Optional. If unset or empty, virtual machine home is not associated with a storage policy.

value[].value.disks list A Map of virtual disks and their compliance status If empty, the virtual machine does not have any disks or its disks are not associated with a storage policy. This attribute was added in vSphere API 6.7.

When clients pass a value of this structure as a parameter, the key in the field key/value pairs must be an identifier for the resource type: com.vmware.vcenter.vm.hardware.Disk. When operations return a value of this structure as a result, the key in the field key/value pairs will be an identifier for the resource type: com.vmware.vcenter.vm.hardware.Disk.List of {"key": string, "value": string}

value[].value.disks[].key string
value[].value.disks[].value string Defines he valid compliance status values for a virtual machine or virtual disk. This enumeration was added in vSphere API 6.7. Value is one of:
COMPLIANT: The virtual machine or virtual disk is in compliance. This constant was added in vSphere API 6.7.
NON_COMPLIANT: The virtual machine or virtual disk is in not in compliance. This constant was added in vSphere API 6.7.
UNKNOWN_COMPLIANCE: Compliance status of the virtual machine or virtual disk is not known. This constant was added in vSphere API 6.7.
NOT_APPLICABLE: Compliance computation is not applicable for this virtual machine or disk because it does not have any storage requirement that apply to the object-based datastore on which the entity is placed. This constant was added in vSphere API 6.7.
OUT_OF_DATE: Compliance status becomes out of date when the profile associated with the virtual machine or disk is edited and not applied. The compliance status will remain out of date until the latest policy is applied. This constant was added in vSphere API 6.7.

Errors:

HTTP Status Code Type Description
500 error if the system reports an error while responding to the request.
400 invalid_argument if the vcenter.storage.policies.compliance.VM.filter_spec.status field contains a value that is not supported by the server.
503 service_unavailable if the system is unable to communicate with a service to complete the request.
401 unauthenticated if the user can not be authenticated.
403 unauthorized if the user does not have the required privileges.
400 unsupported if the API is invoked against vCenter Server version is less than 6.5
500 unable_to_allocate_resource If more than 1000 results match the vcenter.storage.policies.compliance.VM.filter_spec