Skip to content

Add swagger for CapacityBlocks API #34478

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,93 @@
}
}
}
},
"/subscriptions/{subscriptionId}/providers/Microsoft.Compute/capacityblocks": {
"get": {
"tags": [
"capacityBlocks"
],
"operationId": "Capacity Blocks_Get",
"description": "Get available capacity blocks.",
"parameters": [
{
"$ref": "../../../../../../common-types/resource-management/v5/types.json#/parameters/SubscriptionIdParameter"
},
{
"$ref": "../../../../../../common-types/resource-management/v5/types.json#/parameters/ApiVersionParameter"
},
{
"name": "location",
"in": "query",
"required": false,
"type": "string",
"description": "Azure region for which the block is requested"
},
Copy link
Member

@rkmanda rkmanda May 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[ARMBlockingComment] use odata filters instead of individual query params

{
"name": "sku",
"in": "query",
"required": true,
"type": "string",
"description": "Sku for which block is requested"
},
{
"name": "capacity",
"in": "query",
"required": true,
"type": "integer",
"description": "Instance count for the specified sku"
},
{
"name": "durationhours",
"in": "query",
"required": true,
"type": "integer",
"description": "The duration in hours for which block is needed"
},
{
"name": "start-date-range",
"in": "query",
"required": true,
"type": "string",
"format": "date-time",
"description": "Start datetime range in UTC"
},
{
"name": "end-date-range",
"in": "query",
"required": true,
"type": "string",
"format": "date-time",
"description": "End datetime range in UTC"
},
{
"name": "zone",
"in": "query",
"required": false,
"type": "string",
"description": "Zone in which the block needs to be made available"
}
],
"responses": {
"200": {
"description": "Success",
"schema": {
"$ref": "#/definitions/CapacityBlocks"
}
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "../../../../../../common-types/resource-management/v5/types.json#/definitions/ErrorResponse"
}
}
},
"x-ms-examples": {
"Returns list of capacity block objects.": {
"$ref": "./examples/GetCapacityBlocks.json"
}
}
}
}
},
"definitions": {
Expand Down Expand Up @@ -1722,6 +1809,76 @@
}
},
"description": "The quota restrictions on recommended VMSize."
},
"CapacityBlocks": {
"type": "array",
"description": "Capacity blocks.",
"items": {
"$ref": "#/definitions/CapacityBlock"
},
"nextLink": {
"description": "The URI used to fetch the next page of capacity blocks. When there are no more pages, this is null.",
"type": "string"
}
},
"CapacityBlock": {
"type": "object",
"description": "Capacity block.",
"x-ms-azure-resource": true,
"properties": {
"zone": {
"description": "Logical Zone in which the block needs to be made available",
"type": "string",
"readOnly": true
},
"location": {
"description": "The location.",
"type": "string"
},
"sku": {
"description": "SKU for Capacity Block.",
"$ref": "#/definitions/Sku"
},
"schedule": {
"description": "Schedule of Capacity Block Reservation.",
"$ref": "#/definitions/Schedule"
}
}
},
"Sku": {
"type": "object",
"description": "SKU for Capacity Block.",
"properties": {
"name": {
"description": "Sku name.",
"type": "string",
"readOnly": true
},
"capacity": {
"description": "Requested Instance count.",
"type": "integer",
"format": "int32",
"readOnly": true
}
}
},
"Schedule": {
"type": "object",
"description": "Schedule of Capacity Block Reservation.",
"properties": {
"startTime": {
"description": "Start DateTime of Capacity Block reservation.",
"type": "string",
"format": "date-time",
"readOnly": true
},
"endTime": {
"description": "End DateTime of Capacity Block Reservation.",
"type": "string",
"format": "date-time",
"readOnly": true
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"parameters": {
"subscriptionId": "00000000-0000-0000-0000-000000000000",
"location": "eastus",
"api-version": "2025-02-01-preview",
"sku": "Standard_ND_A100_v4",
"capacity": 5,
"durationhours": 24,
"start-date-range": "2025-04-01 -T00:00:00Z",
"end-date-range": "2025-05-01 -T00:00:00Z",
"zone": "1"
},
"responses": {
"200": {
"body": {
"CapacityBlocks": [
{
"location": "eastus",
"zone": 1,
"sku": {
"name": "Standard_ND_A100_v4",
"capacity": 5
},
"schedule": {
"startTime": "2025-04-01-T00:00:00Z",
"endTime": "2025-04-02-T00:00:00Z"
}
},
{
"location": "eastus",
"zone": 1,
"sku": {
"name": "Standard_ND_A100_v4",
"capacity": 5
},
"schedule": {
"startTime": "2025-04-03-T00:00:00Z",
"endTime": "2025-04-04-T00:00:00Z"
}
}
]
}
}
}
}