{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/microsoft-azure-virtual-machines/json-schema/microsoft-azure-virtual-machines-capacity-reservation-schema.json",
  "title": "CapacityReservation",
  "description": "Specifies information about the capacity reservation.",
  "x-generated": "2026-11-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/microsoft-azure-virtual-machines-capacityreservations-api-openapi.yml#/components/schemas/CapacityReservation",
  "type": "object",
  "properties": {
    "properties": {
      "$ref": "#/$defs/CapacityReservationProperties",
      "description": "Properties of the Capacity reservation.",
      "x-ms-client-flatten": true
    },
    "sku": {
      "$ref": "#/$defs/Sku",
      "description": "SKU of the resource for which capacity needs be reserved. The SKU name and capacity is required to be set.  For Block capacity reservations, sku.capacity can only accept values 1, 2, 4, 8, 16, 32, 64. Currently VM Skus with the capability called 'CapacityReservationSupported' set to true are supported. When 'CapacityReservationSupported' is true, the SKU capability also specifies the 'SupportedCapacityReservationTypes', which lists the types of capacity reservations (such as Targeted or Block) that the SKU supports. Refer to List Microsoft.Compute SKUs in a region (https://docs.microsoft.com/rest/api/compute/resourceskus/list) for supported values."
    },
    "zones": {
      "type": "array",
      "description": "The availability zones.",
      "items": {
        "type": "string"
      }
    }
  },
  "required": [
    "sku"
  ],
  "allOf": [
    {
      "$ref": "#/$defs/TrackedResource"
    }
  ],
  "$defs": {
    "CapacityReservationInstanceView": {
      "type": "object",
      "description": "The instance view of a capacity reservation that provides as snapshot of the runtime properties of the capacity reservation that is managed by the platform and can change outside of control plane operations.",
      "properties": {
        "utilizationInfo": {
          "$ref": "#/$defs/CapacityReservationUtilization",
          "description": "Unutilized capacity of the capacity reservation."
        },
        "statuses": {
          "type": "array",
          "description": "The resource status information.",
          "items": {
            "$ref": "#/$defs/InstanceViewStatus"
          },
          "x-ms-identifiers": []
        },
        "reservationStateInfo": {
          "$ref": "#/$defs/CapacityReservationStateInfo",
          "description": "The reservation state information for a capacity reservation, this detail is primarily provided for Future capacity reservations. Minimum API version: 2026-04-01."
        }
      }
    },
    "CapacityReservationProperties": {
      "type": "object",
      "description": "Properties of the Capacity reservation.",
      "properties": {
        "reservationId": {
          "type": "string",
          "description": "A unique id generated and assigned to the capacity reservation by the platform which does not change throughout the lifetime of the resource.",
          "readOnly": true
        },
        "platformFaultDomainCount": {
          "type": "integer",
          "format": "int32",
          "description": "Specifies the value of fault domain count that Capacity Reservation supports for requested VM size. **Note:** The fault domain count specified for a resource (like virtual machines scale set) must be less than or equal to this value if it deploys using capacity reservation. Minimum api-version: 2022-08-01.",
          "readOnly": true
        },
        "virtualMachinesAssociated": {
          "type": "array",
          "description": "A list of all virtual machine resource ids that are associated with the capacity reservation.",
          "items": {
            "$ref": "#/$defs/SubResourceReadOnly"
          },
          "readOnly": true
        },
        "provisioningTime": {
          "type": "string",
          "format": "date-time",
          "description": "The date time when the capacity reservation was last updated.",
          "readOnly": true
        },
        "provisioningState": {
          "type": "string",
          "description": "The provisioning state, which only appears in the response.",
          "readOnly": true
        },
        "instanceView": {
          "$ref": "#/$defs/CapacityReservationInstanceView",
          "description": "The Capacity reservation instance view.",
          "readOnly": true
        },
        "timeCreated": {
          "type": "string",
          "format": "date-time",
          "description": "Specifies the time at which the Capacity Reservation resource was created. Minimum api-version: 2021-11-01.",
          "readOnly": true
        },
        "scheduleProfile": {
          "$ref": "#/$defs/ScheduleProfile",
          "description": "Defines the schedule for Block and Future capacity reservations. Specifies the schedule during which capacity reservation is active and VM or VMSS resource can be allocated using reservation. For Block capacity reservations, the scheduleProfile, start, and end fields are immutable after creation. Please refer to https://aka.ms/blockcapacityreservation for more details. Minimum API version for Block capacity reservations: 2025-04-01. Future capacity reservations must use this property with only a start time, which can be changed until the ‘modifiableUntil’ time. Please refer to https://aka.ms/futurecapacityreservation for more details. Minimum API version for Future capacity reservations: 2026-04-01."
        }
      }
    },
    "CapacityReservationStateInfo": {
      "type": "object",
      "description": "Details related to the current state for a Future capacity reservation.",
      "properties": {
        "reservationState": {
          "$ref": "#/$defs/ReservationState",
          "description": "The current state of the capacity reservation."
        }
      }
    },
    "CapacityReservationUtilization": {
      "type": "object",
      "description": "Represents the capacity reservation utilization in terms of resources allocated.",
      "properties": {
        "currentCapacity": {
          "type": "integer",
          "format": "int32",
          "description": "The value provides the current capacity of the VM size which was reserved successfully and for which the customer is getting billed. Minimum api-version: 2022-08-01.",
          "readOnly": true
        },
        "virtualMachinesAllocated": {
          "type": "array",
          "description": "A list of all virtual machines resource ids allocated against the capacity reservation.",
          "items": {
            "$ref": "#/$defs/SubResourceReadOnly"
          },
          "readOnly": true
        },
        "usedReservedCountBySubscription": {
          "type": "object",
          "description": "For open capacity reservations, this provides a map of the used reserved capacity count keyed by the subscription id (a GUID) that is consuming the capacity, i.e. each entry maps a consuming subscription id to the count of reserved capacity it is currently using. This is populated only for open capacity reservations and is not reported for targeted and block capacity reservations, which instead report allocation through virtualMachinesAllocated. Minimum api-version: 2026-04-01.",
          "additionalProperties": {
            "format": "int32",
            "type": "integer"
          },
          "readOnly": true
        }
      }
    },
    "InstanceViewStatus": {
      "type": "object",
      "description": "Instance view status.",
      "properties": {
        "code": {
          "type": "string",
          "description": "The status code."
        },
        "level": {
          "$ref": "#/$defs/StatusLevelTypes",
          "description": "The level code."
        },
        "displayStatus": {
          "type": "string",
          "description": "The short localizable label for the status."
        },
        "message": {
          "type": "string",
          "description": "The detailed status message, including for alerts and error messages."
        },
        "time": {
          "type": "string",
          "format": "date-time",
          "description": "The time of the status."
        }
      }
    },
    "ReservationState": {
      "type": "string",
      "description": "The current state of a Future capacity reservation.",
      "enum": [
        "Pending",
        "Declined",
        "Approved",
        "FulfillmentFailed",
        "Committed",
        "Live",
        "PartiallyFulfilled"
      ],
      "x-ms-enum": {
        "name": "ReservationState",
        "modelAsString": true,
        "values": [
          {
            "name": "Pending",
            "value": "Pending",
            "description": "The capacity reservation request has been submitted and is awaiting evaluation."
          },
          {
            "name": "Declined",
            "value": "Declined",
            "description": "The capacity reservation request was rejected, and will not change again without user action."
          },
          {
            "name": "Approved",
            "value": "Approved",
            "description": "The capacity reservation request has been approved by Azure and is awaiting fulfillment."
          },
          {
            "name": "FulfillmentFailed",
            "value": "FulfillmentFailed",
            "description": "A failure occurred while attempting to fulfill the capacity reservation request."
          },
          {
            "name": "Committed",
            "value": "Committed",
            "description": "The capacity reservation is locked and cannot be updated or deleted prior to going live."
          },
          {
            "name": "Live",
            "value": "Live",
            "description": "The capacity reservation is active and available for use, and cannot be modified or deleted until the minimum commitment period has elapsed."
          },
          {
            "name": "PartiallyFulfilled",
            "value": "PartiallyFulfilled",
            "description": "Azure was only able to deliver a portion of the requested capacity. The capacity reservation cannot be modified or deleted until the minimum commitment period has elapsed. The portion of fulfilled capacity can be viewed by inspecting the capacity reservation's instance view, displayed as currentCapacity within the utilizationInfo."
          }
        ]
      }
    },
    "ScheduleProfile": {
      "type": "object",
      "description": "Defines the schedule for Block and Future capacity reservations. Specifies the schedule during which capacity reservation is active and VM or VMSS resource can be allocated using reservation. For Block capacity reservations, the scheduleProfile, start, and end fields are immutable after creation. Please refer to https://aka.ms/blockcapacityreservation for more details. Minimum API version for Block capacity reservations: 2025-04-01. Future capacity reservations must use this property with only a start time, which can be changed until the ‘modifiableUntil’ time. Please refer to https://aka.ms/futurecapacityreservation for more details. Minimum API version for Future capacity reservations: 2026-04-01.",
      "properties": {
        "start": {
          "type": "string",
          "description": "The required start date for Block or Future capacity reservations. Block capacity reservations: Must be today or within 56 days in the future. For same-day scheduling, requests must be submitted before 11:30 AM UTC. Future capacity reservations: Must be at least 7 days in the future, and maximum 6 months in the future. Minimum API version for Future capacity reservations: 2026-04-01. Example: 2025-06-27, applicable for both Block and Future capacity reservations."
        },
        "end": {
          "type": "string",
          "description": "The required end date for Block capacity reservations. Must be after the start date, with a duration of either 1–14 whole days or 3–26 whole weeks. Example: 2025-06-28."
        },
        "minimumCommitmentDays": {
          "type": "integer",
          "format": "int32",
          "description": "The minimum number of days that must pass after the start date before a Future capacity reservation can be updated or deleted once it has been committed. Will be populated with a default value if not provided."
        },
        "modifiableUntil": {
          "type": "string",
          "format": "date-time",
          "description": "The date/time until which a Future capacity reservation can be updated or deleted. Read-only.",
          "readOnly": true
        }
      }
    },
    "Sku": {
      "type": "object",
      "description": "Describes a virtual machine scale set sku. NOTE: If the new VM SKU is not supported on the hardware the scale set is currently on, you need to deallocate the VMs in the scale set before you modify the SKU name.",
      "properties": {
        "name": {
          "type": "string",
          "description": "The sku name."
        },
        "tier": {
          "type": "string",
          "description": "Specifies the tier of virtual machines in a scale set.<br /><br /> Possible Values:<br /><br /> **Standard**<br /><br /> **Basic**"
        },
        "capacity": {
          "type": "integer",
          "format": "int64",
          "description": "Specifies the number of virtual machines in the scale set."
        }
      }
    },
    "StatusLevelTypes": {
      "type": "string",
      "description": "The level code.",
      "enum": [
        "Info",
        "Warning",
        "Error"
      ],
      "x-ms-enum": {
        "name": "StatusLevelTypes",
        "modelAsString": false
      }
    },
    "SubResourceReadOnly": {
      "type": "object",
      "properties": {
        "id": {
          "readOnly": true,
          "type": "string",
          "description": "Resource Id"
        }
      }
    },
    "TrackedResource": {
      "type": "object",
      "title": "Tracked Resource",
      "description": "The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'",
      "properties": {
        "tags": {
          "type": "object",
          "description": "Resource tags.",
          "additionalProperties": {
            "type": "string"
          },
          "x-ms-mutability": [
            "read",
            "create",
            "update"
          ]
        },
        "location": {
          "type": "string",
          "description": "The geo-location where the resource lives",
          "x-ms-mutability": [
            "read",
            "create"
          ]
        }
      },
      "required": [
        "location"
      ],
      "allOf": [
        {
          "$ref": "#/$defs/Resource"
        }
      ]
    }
  }
}