diff --git a/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2017-04-18/cognitiveservices.json b/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2017-04-18/cognitiveservices.json index a8d606b3606a..f5030a1a4ec1 100644 --- a/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2017-04-18/cognitiveservices.json +++ b/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2017-04-18/cognitiveservices.json @@ -512,9 +512,67 @@ } } }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/usages": { + "get": { + "tags": [ + "CognitiveServicesAccounts" + ], + "description": "Get usages for the requested Cognitive Services account", + "x-ms-examples": { + "Get Usages": { + "$ref": "./examples/GetUsages.json" + } + }, + "operationId": "Accounts_GetUsages", + "parameters": [ + { + "name": "resourceGroupName", + "in": "path", + "required": true, + "type": "string", + "description": "The name of the resource group within the user's subscription." + }, + { + "name": "accountName", + "in": "path", + "required": true, + "type": "string", + "maxLength": 64, + "minLength": 2, + "pattern": "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$", + "description": "The name of Cognitive Services account." + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/usageFilterParameter" + } + ], + "responses": { + "200": { + "description": "The usages for Cognitive Services account were retrieved successfully.", + "schema": { + "$ref": "#/definitions/UsagesResult" + } + }, + "default": { + "description": "Error response describing why the operation failed. If the resource does not exist, 404 (NotFound) will be returned.", + "schema": { + "$ref": "#/definitions/Error" + } + } + } + } + }, "/providers/Microsoft.CognitiveServices/operations": { "get": { - "tags": [ "Operations" ], + "tags": [ + "Operations" + ], "description": "Lists all the available Cognitive Services account operations.", "operationId": "Operations_List", "x-ms-examples": { @@ -543,7 +601,9 @@ }, "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/checkSkuAvailability": { "post": { - "tags": [ "CognitiveServicesAccounts" ], + "tags": [ + "CognitiveServicesAccounts" + ], "operationId": "CheckSkuAvailability_List", "description": "Check available SKUs.", "x-ms-examples": { @@ -622,24 +682,21 @@ "type": "string", "description": "Required. Indicates the type of cognitive service account.", "enum": [ - "Academic", - "Bing.Autosuggest", "Bing.Autosuggest.v7", "Bing.CustomSearch", - "Bing.Search", "Bing.Search.v7", "Bing.Speech", - "Bing.SpellCheck", "Bing.SpellCheck.v7", "ComputerVision", "ContentModerator", "CustomSpeech", + "CustomVision.Prediction", + "CustomVision.Training", "Emotion", "Face", "LUIS", - "Recommendations", + "QnAMaker", "SpeakerRecognition", - "Speech", "SpeechTranslation", "TextAnalytics", "TextTranslation", @@ -869,6 +926,100 @@ }, "description": "Cognitive Services resource type and SKU." }, + "UsagesResult": { + "properties": { + "value": { + "type": "array", + "readOnly": true, + "items": { + "$ref": "#/definitions/Usage" + }, + "description": "The list of usages for Cognitive Service account." + } + }, + "description": "The response to a list usage request." + }, + "Usage": { + "properties": { + "unit": { + "description": "The unit of the metric.", + "$ref": "#/definitions/UnitType" + }, + "name": { + "$ref": "#/definitions/MetricName", + "readOnly": true, + "description": "The name information for the metric." + }, + "quotaPeriod": { + "type": "string", + "readOnly": true, + "description": "The quota period used to summarize the usage values." + }, + "limit": { + "type": "integer", + "readOnly": true, + "description": "Maximum value for this metric." + }, + "currentValue": { + "type": "integer", + "readOnly": true, + "description": "Current value for this metric." + }, + "nextResetTime": { + "type": "string", + "readOnly": true, + "description": "Next reset time for current quota." + }, + "status": { + "type": "string", + "description": "Cognitive Services account quota usage status.", + "enum": [ + "Included", + "Blocked", + "InOverage", + "Unknown" + ], + "x-ms-enum": { + "name": "QuotaUsageStatus", + "modelAsString": true + } + } + }, + "description": "The usage data for a usage request." + }, + "MetricName": { + "properties": { + "value": { + "readOnly": true, + "type": "string", + "description": "The name of the metric." + }, + "localizedValue": { + "readOnly": true, + "type": "string", + "description": "The friendly name of the metric." + } + }, + "description": "A metric name." + }, + "UnitType": { + "type": "string", + "readOnly": true, + "description": "The unit of the metric.", + "enum": [ + "Count", + "Bytes", + "Seconds", + "Percent", + "CountPerSecond", + "BytesPerSecond", + "Milliseconds" + ], + "x-ms-enum": { + "modelAsString": true, + "name": "UnitType" + } + }, "Error": { "properties": { "error": { @@ -1045,6 +1196,13 @@ "required": true, "type": "string", "x-ms-parameter-location": "method" + }, + "usageFilterParameter": { + "name": "$filter", + "in": "query", + "required": false, + "type": "string", + "description": "An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names)." } } } \ No newline at end of file diff --git a/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2017-04-18/examples/GetUsages.json b/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2017-04-18/examples/GetUsages.json new file mode 100644 index 000000000000..bcfbe8300d37 --- /dev/null +++ b/specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2017-04-18/examples/GetUsages.json @@ -0,0 +1,28 @@ +{ + "parameters": { + "api-version": "2017-04-18", + "subscriptionId": "5a4f5c2e-6983-4ccb-bd34-2196d5b5bbd3", + "resourceGroupName": "felixwa-01", + "accountName": "TestUsage02" + }, + "responses": { + "200": { + "body": { + "value": [ + { + "name": { + "value": "Face.Transactions", + "localizedValue": "Face.Transactions" + }, + "status": "Included", + "currentValue": 3, + "limit": 30000, + "nextResetTime": "2018-03-28T09:33:51Z", + "quotaPeriod": "30.00:00:00", + "unit": "Count" + } + ] + } + } + } +} \ No newline at end of file