From 89831e0a5d7501f8437ea00382bdf9d0aeecb140 Mon Sep 17 00:00:00 2001 From: Todd Moscinski Date: Mon, 14 Jun 2021 16:02:10 -0700 Subject: [PATCH 1/3] Adding reservations route to reservations resource manager --- .../2021-07-01/examples/reservations.json | 79 +++ .../stable/2021-07-01/reservations.json | 595 ++++++++++++++++++ 2 files changed, 674 insertions(+) create mode 100644 specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/reservations.json create mode 100644 specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/reservations.json diff --git a/specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/reservations.json b/specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/reservations.json new file mode 100644 index 000000000000..03fb79cb4060 --- /dev/null +++ b/specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/reservations.json @@ -0,0 +1,79 @@ +{ + "parameters": { + "api-version": "2021-07-01", + "$filter": "(properties%2farchived+eq+false)", + "$orderby": "properties/displayName asc", + "$skiptoken": "50", + "refreshsummary": "true", + "take": "1" + }, + "responses": { + "200": { + "body": { + "value": [ + { + "id": "/providers/microsoft.capacity/reservationOrders/00000000-0000-0000-0000-000000000001/reservations/00000000-0000-0000-0000-000000000000", + "name": "00000000-0000-0000-0000-000000000001/00000000-0000-0000-0000-000000000000", + "type": "Microsoft.Capacity/reservationOrders/reservations", + "location": "westus", + "sku": { + "name": "Standard_D1" + }, + "properties": { + "appliedScopes": null, + "appliedScopeType": "Shared", + "displayName": "VM_RI_07-21-2020_12-06", + "displayProvisioningState": "Succeeded", + "effectiveDateTime": "0001-01-01T00:00:00", + "expiryDate": "2023-07-21", + "provisioningState": "Succeeded", + "provisioningSubState": null, + "purchaseDate": "2021-04-22", + "quantity": 2, + "renew": false, + "renewSource": "/providers/Microsoft.Capacity/reservationorders/00000000-0000-0000-0000-000000000002/reservations/00000000-0000-0000-0000-000000000003", + "reservedResourceType": "VirtualMachines", + "skuDescription": null, + "term": "P3Y", + "userFriendlyAppliedScopeType": "Shared", + "userFriendlyRenewState": "Off", + "utilization": { + "trend": "UP", + "aggregates": [ + { + "grain": 1.0, + "grainUnit": "days", + "value": 0.05, + "valueUnit": "percentage" + }, + { + "grain": 7.0, + "grainUnit": "days", + "value": 0.05, + "valueUnit": "percentage" + }, + { + "grain": 30.0, + "grainUnit": "days", + "value": 0.05, + "valueUnit": "percentage" + } + ] + } + } + } + ], + "summary": { + "succeededCount": 1, + "failedCount": 0, + "expiringCount": 0, + "expiredCount": 0, + "pendingCount": 0, + "cancelledCount": 0 + }, + "nextLink": null + } + } + } + } + \ No newline at end of file diff --git a/specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/reservations.json b/specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/reservations.json new file mode 100644 index 000000000000..f758eaad1c67 --- /dev/null +++ b/specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/reservations.json @@ -0,0 +1,595 @@ +{ + "swagger": "2.0", + "info": { + "title": "Azure Reservation API", + "description": "This API describe Azure Reservation", + "version": "2017-11-01" + }, + "host": "management.azure.com", + "schemes": [ + "https" + ], + "produces": [ + "application/json" + ], + "consumes": [ + "application/json" + ], + "securityDefinitions": { + "azure_auth": { + "type": "oauth2", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", + "flow": "implicit", + "description": "Azure Active Directory OAuth2 Flow", + "scopes": { + "user_impersonation": "impersonate your user account" + } + } + }, + "paths": { + "/providers/Microsoft.Capacity/reservations": { + "get": { + "description": "List the reservations and the roll up counts of reservations group by provisioning states that the user has access to in the current tenant.", + "operationId": "Reservations_List", + "x-ms-examples": { + "Catalog": { + "$ref": "./examples/Reservations.json" + } + }, + "parameters": [ + { + "$ref": "#/parameters/ApiVersionParameter" + }, + { + "name": "$filter", + "description": "May be used to filter by reservation properties. The filter supports 'eq', 'or', and 'and'. It does not currently support 'ne', 'gt', 'le', 'ge', or 'not'. Reservation properties include sku/name, properties/{appliedScopeType, archived, displayName, displayProvisiningState, effectiveDateTime, expiryDate, provisioningState, quantity, renew, reservedResourceType, term, userFriendlyAppliedScopeType, userFriendlyRenewState}", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "$orderby", + "description": "May be used to sort order by reservation properties.", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "refreshSummary", + "description": "To indicate whether to refresh the roll up counts of the reservations group by provisioning states", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "$skiptoken", + "description": "The number of reservations to skip from the list before returning results", + "in": "query", + "required": false, + "type": "number" + }, + { + "name": "selectedState", + "description": "The selected provisioning state", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "take", + "description": "To number of reservations to return", + "in": "query", + "required": false, + "type": "number" + } + ], + "responses": { + "200": { + "description": "OK. The request has succeeded.", + "schema": { + "$ref": "#/definitions/ReservationsListResult" + } + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + } + }, + "definitions": { + "ErrorResponseCode": { + "type": "string", + "enum": [ + "NotSpecified", + "InternalServerError", + "ServerTimeout", + "AuthorizationFailed", + "BadRequest", + "ClientCertificateThumbprintNotSet", + "InvalidRequestContent", + "OperationFailed", + "HttpMethodNotSupported", + "InvalidRequestUri", + "MissingTenantId", + "InvalidTenantId", + "InvalidReservationOrderId", + "InvalidReservationId", + "ReservationIdNotInReservationOrder", + "ReservationOrderNotFound", + "InvalidSubscriptionId", + "InvalidAccessToken", + "InvalidLocationId", + "UnauthenticatedRequestsThrottled", + "InvalidHealthCheckType", + "Forbidden", + "BillingScopeIdCannotBeChanged", + "AppliedScopesNotAssociatedWithCommerceAccount", + "AppliedScopesSameAsExisting", + "RoleAssignmentCreationFailed", + "ReservationOrderCreationFailed", + "ReservationOrderNotEnabled", + "CapacityUpdateScopesFailed", + "UnsupportedReservationTerm", + "ReservationOrderIdAlreadyExists", + "RiskCheckFailed", + "CreateQuoteFailed", + "ActivateQuoteFailed", + "NonsupportedAccountId", + "PaymentInstrumentNotFound", + "MissingAppliedScopesForSingle", + "NoValidReservationsToReRate", + "ReRateOnlyAllowedForEA", + "OperationCannotBePerformedInCurrentState", + "InvalidSingleAppliedScopesCount", + "InvalidFulfillmentRequestParameters", + "NotSupportedCountry", + "InvalidRefundQuantity", + "PurchaseError", + "BillingCustomerInputError", + "BillingPaymentInstrumentSoftError", + "BillingPaymentInstrumentHardError", + "BillingTransientError", + "BillingError", + "FulfillmentConfigurationError", + "FulfillmentOutOfStockError", + "FulfillmentTransientError", + "FulfillmentError", + "CalculatePriceFailed" + ] + }, + "ProvisioningState": { + "type": "string", + "description": "Represent the current state of the Reservation.", + "enum": [ + "Creating", + "PendingResourceHold", + "ConfirmedResourceHold", + "PendingBilling", + "ConfirmedBilling", + "Created", + "Succeeded", + "Cancelled", + "Expired", + "BillingFailed", + "Failed", + "Split", + "Merged" + ] + }, + "ReservedResourceType": { + "type": "string", + "description": "The type of the resource that is being reserved.", + "enum": [ + "VirtualMachines", + "SqlDatabases", + "SuseLinux", + "CosmosDb", + "RedHat", + "SqlDataWarehouse", + "VMwareCloudSimple", + "RedHatOsa", + "Databricks", + "AppService", + "ManagedDisk", + "BlockBlob", + "RedisCache", + "AzureDataExplorer", + "MySql", + "MariaDb", + "PostgreSql", + "DedicatedHost", + "SapHana", + "SqlAzureHybridBenefit", + "AVS", + "DataFactory", + "NetAppStorage", + "AzureFiles", + "SqlEdge" + ] + }, + "Location": { + "type": "string", + "description": "Location in which the Resources needs to be reserved. It cannot be changed after the resource has been created.", + "enum": [ + "westus", + "eastus", + "eastus2", + "northcentralus", + "westus2", + "southcentralus", + "centralus", + "westeurope", + "northeurope", + "eastasia", + "southeastasia", + "japaneast", + "japanwest", + "brazilsouth", + "australiaeast", + "australiasoutheast", + "southindia", + "westindia", + "centralindia", + "canadacentral", + "canadaeast", + "uksouth", + "westcentralus", + "ukwest" + ] + }, + "DisplayProvisioningState": { + "type": "string", + "description": "Represent the current display state of the Reservation.", + "enum": [ + "Succeeded", + "Expiring", + "Expired", + "Pending", + "Cancelled", + "Failed" + ] + }, + "UserFriendlyAppliedScopeType": { + "type": "string", + "description": "", + "enum": [ + "None", + "Shared", + "Single", + "ResourceGroup", + "ManagementGroup" + ] + }, + "UserFriendlyRenewState": { + "type": "string", + "description": "", + "enum": [ + "On", + "Off", + "Renewed", + "NotRenewed", + "NotApplicable" + ] + }, + "ReservationTerm": { + "type": "string", + "description": "Represent the term of Reservation.", + "enum": [ + "P1Y", + "P3Y", + "P5Y" + ] + }, + "ReservationsListResult": { + "description": "The list of reservations and summary of roll out count of reservations in each state.", + "properties": { + "value": { + "description": "The list of reservations.", + "type": "array", + "readOnly": true, + "items": { + "$ref": "#/definitions/Reservation" + } + }, + "nextLink": { + "description": "The link (url) to the next page of results.", + "type": "string", + "readOnly": true + }, + "summary": { + "description": "The roll out count summary of the reservations", + "type": "object", + "$ref": "#/definitions/ReservationSummary" + } + } + }, + "Reservation": { + "description": "The definition of the reservation.", + "properties": { + "id": { + "description": "The id of the reservation.", + "type": "string", + "readOnly": true + }, + "name": { + "description": "The name of the reservation.", + "type": "string", + "readOnly": true + }, + "type": { + "description": "The type of the reservation.", + "type": "string", + "readOnly": true + }, + "location": { + "description": "The location of the reservation.", + "type": "string", + "readOnly": true + }, + "sku": { + "description": "The sku information associated to this reservation ", + "type": "object", + "$ref": "#/definitions/ReservationSkuProperty" + }, + "properties": { + "description": "The properties associated to this reservation ", + "type": "object", + "x-ms-client-flatten": true, + "$ref": "#/definitions/ReservationProperties" + } + } + }, + "ReservationSkuProperty": { + "description": "The property of reservation sku object.", + "properties": { + "name": { + "description": "The name of the reservation sku.", + "type": "string", + "readOnly": true + } + } + }, + "ReservationProperties": { + "type": "object", + "properties": { + "displayName": { + "type": "string", + "description": "Friendly name for user to easily identify the reservation" + }, + "appliedScopes": { + "$ref": "#/definitions/AppliedScopes" + }, + "appliedScopeType": { + "$ref": "#/definitions/AppliedScopeType" + }, + "archived": { + "description": "Specifies whether the reservation is archived.", + "type": "boolean", + "readOnly": true + }, + "displayProvisioningState": { + "$ref": "#definitions/DisplayProvisioningState" + }, + "effectiveDateTime": { + "type": "string", + "format": "date-time", + "description": "DateTime of the Reservation starting when this version is effective from." + }, + "expiryDate": { + "type": "string", + "format": "date", + "description": "This is the date when the Reservation will expire." + }, + "lastUpdatedDateTime": { + "type": "string", + "format": "date-time", + "description": "DateTime of the last time the Reservation was updated.", + "readOnly": true + }, + "managementGroupDisplayName": { + "type": "string", + "description": "The management group display name." + }, + "provisioningState": { + "$ref": "#/definitions/ProvisioningState" + }, + "provisioningSubState": { + "type": "string", + "description": "The sub state of the reservation." + }, + "purchaseDate": { + "type": "string", + "format": "date", + "description": "Date when the Reservation was purchased." + }, + "quantity": { + "type": "integer", + "format": "int32", + "description": "Quantity of the SKUs that are part of the Reservation." + }, + "renew": { + "description": "Specifies whether the reservation will auto-renew.", + "type": "boolean", + "readOnly": true + }, + "renewSource": { + "type": "string", + "description": "Reservation Id of the reservation from which this reservation is renewed." + }, + "reservedResourceType": { + "$ref": "#/definitions/ReservedResourceType" + }, + "reviewDate": { + "type": "string", + "format": "date", + "description": "Date when the reservation needs to be reviewed." + }, + "skuDescription": { + "type": "string", + "description": "Description of the SKU which is displayed in browse UX." + }, + "subscriptionName": { + "type": "string", + "description": "Subscription name, which is set when appliedScope is Single." + }, + "term": { + "$ref": "#/definitions/ReservationTerm" + }, + "userFriendlyAppliedScopeType": { + "$ref": "#/definitions/UserFriendlyAppliedScopeType" + }, + "userFriendlyRenewState": { + "$ref": "#/definitions/userFriendlyRenewState" + }, + "utilization": { + "readOnly": true, + "type": "object", + "description": "Reservation utilization", + "properties": { + "trend": { + "description": "The number of days trend for a reservation", + "readOnly": true, + "type": "string" + }, + "aggregates": { + "description": "The array of aggregates of a reservation's utilization", + "type": "array", + "items": { + "$ref": "#/definitions/ReservationUtilizationAggregates" + } + } + } + } + } + }, + "ReservationUtilizationAggregates": { + "description": "The aggregate values of reservation utilization", + "type": "object", + "properties": { + "grain": { + "description": "The grain of the aggregate", + "readOnly": true, + "type": "number" + }, + "grainUnit": { + "description": "The grain unit of the aggregate", + "readOnly": true, + "type": "string" + }, + "value": { + "description": "The aggregate value", + "readOnly": true, + "type": "number" + }, + "valueUnit": { + "description": "The aggregate value unit", + "readOnly": true, + "type": "string" + } + } + }, + "ReservationSummary": { + "description": "The roll up count summary of reservations in each state", + "type": "object", + "properties": { + "succeededCount": { + "description": "The number of reservation in Succeeded state", + "readOnly": true, + "type": "number" + }, + "failedCount": { + "description": "The number of reservation in Failed state", + "readOnly": true, + "type": "number" + }, + "expiringCount": { + "description": "The number of reservation in Expiring state", + "readOnly": true, + "type": "number" + }, + "expiredCount": { + "description": "The number of reservation in Expired state", + "readOnly": true, + "type": "number" + }, + "pendingCount": { + "description": "The number of reservation in Pending state", + "readOnly": true, + "type": "number" + }, + "cancelledCount": { + "description": "The number of reservation in Cancelled state", + "readOnly": true, + "type": "number" + } + } + }, + "Error": { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/ExtendedErrorInfo" + } + } + }, + "ExtendedErrorInfo": { + "type": "object", + "properties": { + "code": { + "$ref": "#/definitions/ErrorResponseCode" + }, + "message": { + "type": "string" + } + } + }, + "ReservationList": { + "type": "object", + "properties": { + "value": { + "type": "array", + "items": { + "$ref": "#/definitions/ReservationResponse" + } + }, + "nextLink": { + "type": "string", + "description": "Url to get the next page of reservations." + } + } + }, + "AppliedScopeType": { + "type": "string", + "description": "Type of the Applied Scope.", + "enum": [ + "Single", + "Shared" + ] + }, + "AppliedScopes": { + "type": "array", + "description": "List of the subscriptions that the benefit will be applied. Do not specify if AppliedScopeType is Shared.", + "items": { + "type": "string", + "minItems": 1, + "maxItems": 1 + } + } + }, + "parameters": { + "ApiVersionParameter": { + "name": "api-version", + "in": "query", + "description": "Supported version.", + "required": true, + "type": "string" + } + } +} From b7dde1c04a2b46f91614a2dbf4aafec34d0fa1d9 Mon Sep 17 00:00:00 2001 From: Todd Moscinski Date: Mon, 14 Jun 2021 16:23:53 -0700 Subject: [PATCH 2/3] Fixing issues --- .../stable/2021-07-01/reservations.json | 38 +++++++++++++++++-- .../reservations/resource-manager/readme.md | 14 +++++++ 2 files changed, 48 insertions(+), 4 deletions(-) diff --git a/specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/reservations.json b/specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/reservations.json index f758eaad1c67..90b644e4ddb2 100644 --- a/specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/reservations.json +++ b/specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/reservations.json @@ -295,7 +295,7 @@ "type": "array", "readOnly": true, "items": { - "$ref": "#/definitions/Reservation" + "$ref": "#/definitions/ReservationResponse" } }, "nextLink": { @@ -310,7 +310,7 @@ } } }, - "Reservation": { + "ReservationResponse": { "description": "The definition of the reservation.", "properties": { "id": { @@ -375,7 +375,7 @@ "readOnly": true }, "displayProvisioningState": { - "$ref": "#definitions/DisplayProvisioningState" + "$ref": "#/definitions/DisplayProvisioningState" }, "effectiveDateTime": { "type": "string", @@ -446,7 +446,7 @@ "$ref": "#/definitions/UserFriendlyAppliedScopeType" }, "userFriendlyRenewState": { - "$ref": "#/definitions/userFriendlyRenewState" + "$ref": "#/definitions/UserFriendlyRenewState" }, "utilization": { "readOnly": true, @@ -531,6 +531,16 @@ } } }, + "ErrorResponse": { + "description": "Error response indicates that the service is not able to process the incoming request. The reason is provided in the error message.", + "type": "object", + "properties": { + "error": { + "description": "The details of the error.", + "$ref": "#/definitions/ErrorDetails" + } + } + }, "Error": { "type": "object", "properties": { @@ -550,6 +560,26 @@ } } }, + "ErrorDetails": { + "description": "The details of the error.", + "properties": { + "code": { + "description": "Error code.", + "type": "string", + "readOnly": true + }, + "message": { + "description": "Error message indicating why the operation failed.", + "type": "string", + "readOnly": true + }, + "target": { + "description": "The target of the particular error.", + "type": "string", + "readOnly": true + } + } + }, "ReservationList": { "type": "object", "properties": { diff --git a/specification/reservations/resource-manager/readme.md b/specification/reservations/resource-manager/readme.md index d17ad6db7c1b..0d210f16a1c5 100644 --- a/specification/reservations/resource-manager/readme.md +++ b/specification/reservations/resource-manager/readme.md @@ -24,6 +24,20 @@ To see additional help and options, run: These are the global settings for the Reservations API. +``` yaml +openapi-type: arm +tag: package-2021-07-01 +``` + +### Tag: package-2021-07-01 + +These settings apply only when `--tag=package-2021-07-01` is specified on the command line. + +``` yaml $(tag) == 'package-2021-07-01' +input-file: + - Microsoft.Capacity/stable/2021-07-01/reservations.json +``` + ``` yaml openapi-type: arm tag: package-2020-10-25 From 01729c2c675c74ecee27f217d6559395a371eb9b Mon Sep 17 00:00:00 2001 From: Todd Moscinski Date: Tue, 15 Jun 2021 09:55:50 -0700 Subject: [PATCH 3/3] fix casing --- .../Microsoft.Capacity/stable/2021-07-01/reservations.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/reservations.json b/specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/reservations.json index 90b644e4ddb2..a926b6efc1d8 100644 --- a/specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/reservations.json +++ b/specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/reservations.json @@ -33,7 +33,7 @@ "operationId": "Reservations_List", "x-ms-examples": { "Catalog": { - "$ref": "./examples/Reservations.json" + "$ref": "./examples/reservations.json" } }, "parameters": [