diff --git a/specification/monitor/data-plane/preview/2018-09-01-preview/azureMonitorCustomMetricsIngestionApi.json b/specification/monitor/data-plane/preview/2018-09-01-preview/azureMonitorCustomMetricsIngestionApi.json new file mode 100644 index 000000000000..4b2078468da4 --- /dev/null +++ b/specification/monitor/data-plane/preview/2018-09-01-preview/azureMonitorCustomMetricsIngestionApi.json @@ -0,0 +1,234 @@ +{ + "swagger": "2.0", + "info": { + "title": "Azure Metrics", + "version": "2018-09-01-preview", + "description": "A client for issuing REST requests to the Azure metrics service.", + "x-ms-code-generation-settings": { + "name": "AzureMetricsClient" + } + }, + "host": "monitoring.azure.com", + "schemes": [ + "https" + ], + "consumes": [ + "application/json; odata=minimalmetadata" + ], + "produces": [ + "application/json" + ], + "paths": { + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProvider}/{resourceTypeName}/{resourceName}/metrics": { + "post": { + "summary": "Ingestion API used by Azure custom metrics\r\n Responsible of below operation\r\n 1. Authorize the request\r\n 2. Deserialize payload request body\r\n 3. Perform validation of the payload\r\n 4. Commits the payload for metrics ingestion", + "operationId": "azureMonitorCustomMetricsIngestionApi", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "in": "header", + "name": "Content-Type", + "description": "Supports application/json and application/x-ndjson", + "type": "string" + }, + { + "in": "header", + "name": "Content-Length", + "description": "Content length of the payload", + "type": "integer", + "format": "int32" + }, + { + "in": "header", + "name": "Authorization", + "description": "Authorization token issue for issued for audience https:\\\\monitoring.azure.com", + "type": "string" + }, + { + "in": "path", + "name": "subscriptionId", + "description": "The azure subscription id", + "required": true, + "type": "string" + }, + { + "in": "path", + "name": "resourceGroupName", + "description": "The ARM resource group name", + "required": true, + "type": "string" + }, + { + "in": "path", + "name": "resourceProvider", + "description": "The ARM resource provider name", + "required": true, + "type": "string" + }, + { + "in": "path", + "name": "resourceTypeName", + "description": "The ARM resource type name", + "required": true, + "type": "string" + }, + { + "in": "path", + "name": "resourceName", + "description": "The ARM resource name", + "required": true, + "type": "string" + }, + { + "in": "body", + "name": "body", + "description": "The Azure metrics document json payload", + "required": true, + "schema": { + "$ref": "#/definitions/AzureMetricsDocument" + } + } + ], + "responses": { + "200": { + "description": "The azure metrics publish succeeded", + "schema": { + "$ref": "#/definitions/AzureMetricsResult" + } + }, + "default": { + "description": "An unexpected error from the server. See response object for the reason", + "schema": { + "$ref": "#/definitions/AzureMetricsResult" + } + } + }, + "x-ms-examples": { + "Post azure metrics for cows sold with related metadata as dimensions": { + "$ref": "./examples/AzureMetrics_IngestMetrics.json" + } + } + } + } + }, + "definitions": { + "AzureMetricsDocument": { + "type": "object", + "properties": { + "time": { + "description": "Gets or sets Time property (in ISO 8601 format)", + "type": "string" + }, + "data": { + "$ref": "#/definitions/AzureMetricsData" + } + } + }, + "AzureMetricsData": { + "type": "object", + "properties": { + "baseData": { + "$ref": "#/definitions/AzureMetricsBaseData" + } + } + }, + "AzureMetricsBaseData": { + "type": "object", + "properties": { + "metric": { + "description": "Gets or sets the Metric name", + "type": "string" + }, + "namespace": { + "description": "Gets or sets the Metric namespace", + "type": "string" + }, + "dimNames": { + "description": "Gets or sets the list of dimension names (optional)", + "type": "array", + "items": { + "type": "string" + } + }, + "series": { + "description": "Gets or sets the list of time series data for the metric (one per unique dimension combination)", + "type": "array", + "items": { + "$ref": "#/definitions/AzureTimeSeriesData" + } + } + } + }, + "AzureTimeSeriesData": { + "type": "object", + "properties": { + "dimValues": { + "description": "Gets or sets dimension values", + "type": "array", + "items": { + "type": "string" + } + }, + "min": { + "format": "double", + "description": "Gets or sets Min value", + "type": "number" + }, + "max": { + "format": "double", + "description": "Gets or sets Max value", + "type": "number" + }, + "sum": { + "format": "double", + "description": "Gets or sets Sum value", + "type": "number" + }, + "count": { + "format": "int32", + "description": "Gets or sets Count value", + "type": "integer" + } + } + }, + "AzureMetricsResult": { + "type": "object", + "properties": { + "statusCode": { + "format": "int32", + "description": "Http status code response ", + "type": "integer" + }, + "apiFailureResponse": { + "$ref": "#/definitions/ApiFailureResponse" + } + } + }, + "ApiFailureResponse": { + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/ApiError" + } + } + }, + "ApiError": { + "type": "object", + "properties": { + "code": { + "description": "Gets or sets the azure metrics error code", + "type": "string" + }, + "message": { + "description": "Gets or sets the azure metrics error message", + "type": "string" + } + } + } + } +} \ No newline at end of file diff --git a/specification/monitor/data-plane/preview/2018-09-01-preview/examples/AzureMetrics_IngestMetrics.json b/specification/monitor/data-plane/preview/2018-09-01-preview/examples/AzureMetrics_IngestMetrics.json new file mode 100644 index 000000000000..fc964f585116 --- /dev/null +++ b/specification/monitor/data-plane/preview/2018-09-01-preview/examples/AzureMetrics_IngestMetrics.json @@ -0,0 +1,47 @@ +{ + "parameters": { + "api-version": "2018-09-01-preview", + "Content-Type": "application/json", + "Content-Length": 783, + "Authorization": "Bearer {AAD JWT token issued for https:\\\\monitoring.azure.com}", + "subscriptionId": "b7ac8a0c-fbae-4e29-a0f7-09999b8857a1", + "resourceGroupName": "CowsSeller", + "resourceProvider": "Microsoft.Storage", + "resourceTypeName": "storageAccounts", + "resourceName": "cowssellerstore", + "body": { + "time": "2018-08-24T 11:02:00-7:00", + "data": { + "baseData": { + "metric": "CowsSold", + "namespace": "Cows", + "dimNames": [ + "Breed", + "Color", + "Age" + ], + "series": [ + { + "dimValues": [ + "Angus", + "Blue", + "5" + ], + "min": 5, + "max": 20, + "sum": 30, + "count": 3 + } + ] + } + } + } + }, + "responses": { + "200": { + "body": { + "statusCode": 200 + } + } + } +} \ No newline at end of file diff --git a/specification/monitor/data-plane/readme.md b/specification/monitor/data-plane/readme.md new file mode 100644 index 000000000000..1b053b2185eb --- /dev/null +++ b/specification/monitor/data-plane/readme.md @@ -0,0 +1,147 @@ +# MonitorClient + +> see https://aka.ms/autorest + +This is the AutoRest configuration file for MonitorClient. + + + +--- +## Getting Started +To build the SDK for MonitorClient, simply [Install AutoRest](https://aka.ms/autorest/install) and in this folder, run: + +> `autorest` + +To see additional help and options, run: + +> `autorest --help` +--- + +## Configuration + + + +### Basic Information +These are the global settings for the MonitorClient API. + +``` yaml +title: MonitorClient +description: Monitor Management Client +openapi-type: data-plane + +tag: package-2018-09-preview + +``` +### Tag: package-2018-09-preview + +These settings apply only when `--tag=package-2018-09-preview` is specified on the command line. + +``` yaml $(tag) == 'package-2018-09-preview' +input-file: +- preview/2018-09-01-preview/azureMonitorCustomMetricsIngestionApi.json +``` + +# Code Generation + + +## Swagger to SDK + +This section describes what SDK should be generated by the automatic system. +This is not used by Autorest itself. + +``` yaml $(swagger-to-sdk) +swagger-to-sdk: + - repo: azure-sdk-for-python + - repo: azure-sdk-for-java + - repo: azure-sdk-for-go + - repo: azure-sdk-for-node + - repo: azure-sdk-for-ruby + after_scripts: + - bundle install && rake arm:regen_all_profiles['azure_monitor_metrics'] +``` + + +## C# + +These settings apply only when `--csharp` is specified on the command line. +Please also specify `--csharp-sdks-folder=`. + +``` yaml $(csharp) +csharp: + azure-arm: true + payload-flattening-threshold: 1 + license-header: MICROSOFT_MIT_NO_VERSION + namespace: Microsoft.Azure.Monitor.Metrics + output-folder: $(csharp-sdks-folder)/Monitor/Azure.Metrics/Generated + clear-output-folder: true +``` + + +## Go + +These settings apply only when `--go` is specified on the command line. + +``` yaml $(go) +go: + license-header: MICROSOFT_APACHE_NO_VERSION + namespace: monitor + clear-output-folder: true +``` + +### Go multi-api + +``` yaml $(go) && $(multiapi) +batch: + - tag: package-2018-09-preview +``` + +### Tag: package-2018-09-preview and go + +These settings apply only when `--tag=package-2018-09-preview --go` is specified on the command line. +Please also specify `--go-sdk-folder=`. + +``` yaml $(tag) == 'package-2018-09-preview' && $(go) +output-folder: $(go-sdk-folder)/services/preview/monitor/2018-09-01-preview/monitor +``` + +## Python + +These settings apply only when `--python` is specified on the command line. +Please also specify `--python-sdks-folder=`. +Use `--python-mode=update` if you already have a setup.py and just want to update the code itself. + +``` yaml $(python) +python-mode: create +python: + azure-arm: true + license-header: MICROSOFT_MIT_NO_VERSION + payload-flattening-threshold: 2 + namespace: azure.monitor + package-name: azure-monitor + package-version: 0.5.0 + clear-output-folder: true +``` +``` yaml $(python) && $(python-mode) == 'update' +python: + no-namespace-folders: true + output-folder: $(python-sdks-folder)/azure-monitor/azure/monitor +``` +``` yaml $(python) && $(python-mode) == 'create' +python: + basic-setup-py: true + output-folder: $(python-sdks-folder)/azure-monitor/azure/monitor +``` + +## Java + +These settings apply only when `--java` is specified on the command line. +Please also specify `--azure-libraries-for-java-folder=`. + +``` yaml $(java) +azure-arm: true +fluent: true +namespace: com.microsoft.azure.monitor +license-header: MICROSOFT_MIT_NO_CODEGEN +payload-flattening-threshold: 1 +output-folder: $(azure-libraries-for-java-folder)/monitor/data-plane +``` \ No newline at end of file