diff --git a/specification/advisor/resource-manager/Microsoft.Advisor/stable/2017-04-19/advisor.json b/specification/advisor/resource-manager/Microsoft.Advisor/stable/2017-04-19/advisor.json index 7a585a28ef5b..f3ea1e125da2 100644 --- a/specification/advisor/resource-manager/Microsoft.Advisor/stable/2017-04-19/advisor.json +++ b/specification/advisor/resource-manager/Microsoft.Advisor/stable/2017-04-19/advisor.json @@ -16,6 +16,76 @@ "application/json" ], "paths": { + "/providers/Microsoft.Advisor/metadata/{name}": { + "get": { + "tags": [ + "Metadata" + ], + "summary": "Gets the metadata entity.", + "operationId": "RecommendationMetadata_Get", + "parameters": [ + { + "name": "name", + "in": "path", + "description": "Name of metadata entity.", + "required": true, + "type": "string" + }, + { + "$ref": "#/parameters/apiVersionParameter" + } + ], + "responses": { + "200": { + "description": "OK. Successfully retrieved metadata entities", + "schema": { + "$ref": "#/definitions/MetadataEntity" + } + }, + "404": { + "description": "Client sent unknown metadata name", + "schema": { + "$ref": "#/definitions/ARMErrorResponseBody" + } + } + }, + "x-ms-examples": { + "GetMetadata": { + "$ref": "./examples/GetRecommendationMetadataEntity.json" + } + } + } + }, + "/providers/Microsoft.Advisor/metadata": { + "get": { + "tags": [ + "Metadata" + ], + "summary": "Gets the list of metadata entities.", + "operationId": "RecommendationMetadata_List", + "parameters": [ + { + "$ref": "#/parameters/apiVersionParameter" + } + ], + "responses": { + "200": { + "description": "OK. Successfully retrieved metadata entities", + "schema": { + "$ref": "#/definitions/MetadataEntityListResult" + } + } + }, + "x-ms-examples": { + "GetMetadata": { + "$ref": "./examples/ListRecommendationMetadata.json" + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, "/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/configurations": { "get": { "tags": [ @@ -582,6 +652,84 @@ } }, "definitions": { + "MetadataEntityListResult": { + "description": "The list of metadata entities", + "type": "object", + "properties": { + "value": { + "description": "The list of metadata entities.", + "type": "array", + "items": { + "$ref": "#/definitions/MetadataEntity" + } + }, + "nextLink": { + "description": "The link used to get the next page of metadata.", + "type": "string" + } + } + }, + "MetadataEntity": { + "description": "The metadata entity contract.", + "type": "object", + "properties": { + "id": { + "description": "The resource Id of the metadata entity.", + "type": "string" + }, + "type": { + "description": "The type of the metadata entity.", + "type": "string" + }, + "name": { + "description": "The name of the metadata entity.", + "type": "string" + }, + "properties": { + "$ref": "#/definitions/MetadataEntityProperties", + "description": "The metadata entity properties.", + "x-ms-client-flatten": true + } + } + }, + "MetadataEntityProperties": { + "description": "The metadata entity properties", + "type": "object", + "properties": { + "displayName": { + "description": "The display name.", + "type": "string" + }, + "dependsOn": { + "description": "The list of keys on which this entity depends on.", + "type": "array", + "items": { + "type": "string" + } + }, + "supportedValues": { + "description": "The list of supported values.", + "type": "array", + "items": { + "$ref": "#/definitions/MetadataSupportedValueDetail" + } + } + } + }, + "MetadataSupportedValueDetail": { + "description": "The metadata supported value detail.", + "type": "object", + "properties": { + "id": { + "description": "The id.", + "type": "string" + }, + "displayName": { + "description": "The display name.", + "type": "string" + } + } + }, "ConfigurationListResult": { "description": "The list of Advisor configurations.", "type": "object", @@ -940,4 +1088,4 @@ ] } ] -} \ No newline at end of file +} diff --git a/specification/advisor/resource-manager/Microsoft.Advisor/stable/2017-04-19/examples/GetRecommendationMetadataEntity.json b/specification/advisor/resource-manager/Microsoft.Advisor/stable/2017-04-19/examples/GetRecommendationMetadataEntity.json new file mode 100644 index 000000000000..d04a29e49b5b --- /dev/null +++ b/specification/advisor/resource-manager/Microsoft.Advisor/stable/2017-04-19/examples/GetRecommendationMetadataEntity.json @@ -0,0 +1,38 @@ +{ + "parameters": { + "name": "types", + "api-version": "2017-04-19" + }, + "responses": { + "200": { + "body": { + "id": "providers/Microsoft.Advisor/metadata/recommendationType", + "name": "recommendationType", + "type": "Microsoft.Advisor/metadata", + "properties": { + "displayName": "Recommendation Type", + "dependsOn": [ + "category", + "impact" + ], + "supportedValues": [ + { + "id": "6a2b1e70-bd4c-4163-86de-5243d7ac05ee", + "displayName": "Upgrade your SKU or add more instances to ensure fault tolerance" + }, + { + "id": "da6630fb-4286-4996-92a3-a43f5f26dd34", + "displayName": "Delete ExpressRoute circuits in the provider status of Not Provisioned" + } + ] + } + } + }, + "404": { + "body": { + "code": "NotFound", + "message": "Unknown metadata name" + } + } + } +} diff --git a/specification/advisor/resource-manager/Microsoft.Advisor/stable/2017-04-19/examples/ListRecommendationMetadata.json b/specification/advisor/resource-manager/Microsoft.Advisor/stable/2017-04-19/examples/ListRecommendationMetadata.json new file mode 100644 index 000000000000..15348097c243 --- /dev/null +++ b/specification/advisor/resource-manager/Microsoft.Advisor/stable/2017-04-19/examples/ListRecommendationMetadata.json @@ -0,0 +1,78 @@ +{ + "parameters": { + "api-version": "2017-04-19" + }, + "responses": { + "200": { + "body": { + "nextLink": "string", + "value": [ + { + "id": "providers/Microsoft.Advisor/metadata/recommendationType", + "name": "recommendationType", + "type": "Microsoft.Advisor/metadata", + "properties": { + "displayName": "Recommendation Type", + "dependsOn": [ + "category", + "impact" + ], + "supportedValues": [ + { + "id": "6a2b1e70-bd4c-4163-86de-5243d7ac05ee", + "displayName": "Upgrade your SKU or add more instances to ensure fault tolerance" + }, + { + "id": "da6630fb-4286-4996-92a3-a43f5f26dd34", + "displayName": "Delete ExpressRoute circuits in the provider status of Not Provisioned" + } + ] + } + }, + { + "id": "providers/Microsoft.Advisor/metadata/recommendationCategory", + "name": "recommendationCategory", + "type": "Microsoft.Advisor/metadata", + "properties": { + "displayName": "Category", + "dependsOn": null, + "supportedValues": [ + { + "id": "Cost", + "displayName": "Cost" + }, + { + "id": "Performance", + "displayName": "Performance" + } + ] + } + }, + { + "id": "providers/Microsoft.Advisor/metadata/recommendationImpact", + "name": "recommendationImpact", + "type": "Microsoft.Advisor/metadata", + "properties": { + "displayName": "Impact", + "dependsOn": null, + "supportedValues": [ + { + "id": "High", + "displayName": "High" + }, + { + "id": "Medium", + "displayName": "Medium" + }, + { + "id": "Low", + "displayName": "Low" + } + ] + } + } + ] + } + } + } +} diff --git a/specification/advisor/resource-manager/Microsoft.Advisor/stable/2017-04-19/feedback.md b/specification/advisor/resource-manager/Microsoft.Advisor/stable/2017-04-19/feedback.md new file mode 100644 index 000000000000..4e6252c1da70 --- /dev/null +++ b/specification/advisor/resource-manager/Microsoft.Advisor/stable/2017-04-19/feedback.md @@ -0,0 +1,55 @@ +### Feedback #1 ### +Use ARM error model for next API version. + +PR where feedback was given - https://github.com/Azure/azure-rest-api-specs/pull/5826 + +Link to ARM Error model - https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-details.md#error-response-content + +### Error Response Content ### + +If the resource provider needs to return an error to any operation, it should return the appropriate HTTP error code and a message body as can be seen below. The message should be localized per the Accept-Language header specified in the original request such that it could be directly be exposed to users. + +The resource providers must return the \*code\* and \*message\* fields; however, the other fields are acceptable as additions. This format matches [the OData v4.0 schema](http://docs.oasis-open.org/odata/odata-json-format/v4.0/os/odata-json-format-v4.0-os.html#_Toc372793091) for error responses. + +#### Response Body #### +``` +{ +"error": { + "code": "BadArgument", + "message": "The provided database 'foo' has an invalid username.", + "target": "query", + "details": [ + { + "code": "301", + "target": "$search" + "message": "$search query option not supported", + }, + { + "code": "ConflictingAppendPolicies", + "target": "", + "message": "", + "additionalInfo": [ + { + "type": "PolicyViolation", + "info": { + "policySetDefinitionDisplayName": "Secure the environment", + "policySetDefinitionId":"/subscriptions/00000-00000-0000-000/providers/Microsoft.Authorization/policySetDefinitions/TestPolicySet", + "policyDefinitionDisplayName": "Allowed locations", + "policyDefinitionId":"/subscriptions/00000-00000-0000-000/providers/Microsoft.Authorization/policyDefinitions/TestPolicy1", + "policyAssignmentDisplayName": "Allow Central US and WEU only", + "policyAsssignmentId":"/subscriptions/00000-00000-0000-000/providers/Microsoft.Authorization/policyAssignments/TestAssignment1" + } + } + ] + } + ] +} +``` + +| Element name | Type | Description | +| --- | --- | --- | +| message | string (required) | Describes the error in detail and provides debugging information. If Accept-Language is set in the request, it must be localized to that language. | +| code | string (required) | Unlocalized string which can be used to programmatically identify the error. The code should be Pascal-cased, and should serve to uniquely identify a particular class of error, for example "BadArgument". | +| target | string (optional) | The target of the particular error (for example, the name of the property in error). | +| details | array (optional) | An array of additional nested error response info objects, as described by this contract. | +| additionalInfo | array (optional) | An array of objects with "type" (string), and "info" (object) properties. The schema of "info" is service-specific and dependent on the "type" string. |