Skip to content
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

Add built in policy definition/set definition paths #1788

Merged
merged 10 commits into from
Oct 4, 2017
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,38 @@
}
}
},
"/providers/Microsoft.Authorization/policydefinitions/{policyDefinitionName}": {
Copy link
Contributor

Choose a reason for hiding this comment

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

was this api missing from the spec? or is it newly added to the existing api version?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this was missing from the spec

Copy link
Contributor

Choose a reason for hiding this comment

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

camel case ->policyDefinitions

"get": {
"tags": [
"PolicyDefinitions"
],
"operationId": "PolicyDefinitions_GetBuiltIn",
"description": "Gets the built in policy definition.",
"parameters": [
{
"name": "policyDefinitionName",
"in": "path",
"required": true,
"type": "string",
"description": "The name of the built in policy definition to get."
},
{
"$ref": "#/parameters/ApiVersionParameter"
}
],
"responses": {
"200": {
Copy link
Contributor

Choose a reason for hiding this comment

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

404 should be valid response correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep

"description": "OK - Returns information about the built in policy definition.",
"schema": {
"$ref": "#/definitions/PolicyDefinition"
}
},
"404": {
"description": "Not Found - the built in policy definition was not found."
}
}
}
},
"/providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policydefinitions/{policyDefinitionName}": {
"put": {
"tags": [
Expand Down Expand Up @@ -164,9 +196,6 @@
{
"$ref": "#/parameters/ApiVersionParameter"
},
{
"$ref": "#/parameters/SubscriptionIdParameter"
},
{
"$ref": "#/parameters/ManagementGroupIdParameter"
}
Expand Down Expand Up @@ -197,9 +226,6 @@
{
"$ref": "#/parameters/ApiVersionParameter"
},
{
"$ref": "#/parameters/SubscriptionIdParameter"
},
{
"$ref": "#/parameters/ManagementGroupIdParameter"
}
Expand Down Expand Up @@ -230,9 +256,6 @@
{
"$ref": "#/parameters/ApiVersionParameter"
},
{
"$ref": "#/parameters/SubscriptionIdParameter"
},
{
"$ref": "#/parameters/ManagementGroupIdParameter"
}
Expand All @@ -255,13 +278,6 @@
"operationId": "PolicyDefinitions_List",
"description": "Gets all the policy definitions for a subscription.",
"parameters": [
{
"name": "$filter",
Copy link
Member

Choose a reason for hiding this comment

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

So this was not supported and here by mistake?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, apparently, only policy assignment list supports filter. Not policy definitions and set definitions

Copy link
Member

Choose a reason for hiding this comment

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

ok, this was exposed in the CLI, I create an issue for that

Copy link
Member

Choose a reason for hiding this comment

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

"in": "query",
"required": false,
"type": "string",
"description": "The filter to apply on the operation."
},
{
"$ref": "#/parameters/ApiVersionParameter"
},
Expand All @@ -283,6 +299,32 @@
"x-ms-odata": "#/definitions/PolicyDefinition"
}
},
"/providers/Microsoft.Authorization/policydefinitions": {
Copy link
Contributor

Choose a reason for hiding this comment

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

was this api missing from the spec before but existed in the service?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, we never added this to spec

"get": {
"tags": [
"PolicyDefinitions"
],
"operationId": "PolicyDefinitions_ListBuiltIn",
"description": "Gets all the built in policy definitions.",
"parameters": [
{
"$ref": "#/parameters/ApiVersionParameter"
}
],
"responses": {
"200": {
"description": "OK - Returns an array of built in policy definitions.",
"schema": {
"$ref": "#/definitions/PolicyDefinitionListResult"
}
}
},
"x-ms-pageable": {
"nextLinkName": "nextLink"
},
"x-ms-odata": "#/definitions/PolicyDefinition"
}
},
"/providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policydefinitions": {
"get": {
"tags": [
Expand All @@ -291,19 +333,9 @@
"operationId": "PolicyDefinitions_ListByManagementGroup",
"description": "Gets all the policy definitions for a subscription at management group level.",
"parameters": [
{
"name": "$filter",
Copy link
Member

Choose a reason for hiding this comment

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

Same question, not supported?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, not supported

"in": "query",
"required": false,
"type": "string",
"description": "The filter to apply on the operation."
},
{
"$ref": "#/parameters/ApiVersionParameter"
},
{
"$ref": "#/parameters/SubscriptionIdParameter"
},
{
"$ref": "#/parameters/ManagementGroupIdParameter"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"parameters": {
"policySetDefinitionName": "costManagement",
"api-version": "2017-06-01-preview"
},
"responses": {
"200": {
"headers": {},
"body": {
"id": "/providers/Microsoft.Authorization/policySetDefinitions/costManagement",
"type": "Microsoft.Authorization/policySetDefinitions",
"name": "costManagement",
"properties": {
"displayName": "VM and Storage Cost Management",
"description": "Policies required to minimize the risk of accidental cost overruns",
"metadata": {
"category": "Cost Management"
},
"parameters": {
"allowedLocations": {
"type": "array",
"metadata": {
"description": "Regions that resources can be deployed to",
"displayName": "Valid Regions"
}
}
},
"policyDefinitions": [
{
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/storageSkus",
"parameters": {
"listOfAllowedSKUs": {
"value": [
"Standard_GRS",
"Standard_LRS"
]
}
}
},
{
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/vmSkus"
},
{
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/policyDefinitionId",
"parameters": {
"listOfAllowedLocations": {
"value": "[parameters('allowedLocations')]"
}
}
}
],
"policyType": "Custom"
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"parameters": {
"api-version": "2017-06-01-preview"
},
"responses": {
"200": {
"headers": {},
"body": {
"value": [
{
"id": "/providers/Microsoft.Authorization/policySetDefinitions/costManagement",
"type": "Microsoft.Authorization/policySetDefinitions",
"name": "costManagement",
"properties": {
"displayName": "VM and Storage Cost Management",
"description": "Policies required to minimize the risk of accidental cost overruns",
"metadata": {
"category": "Cost Management"
},
"parameters": {
"allowedLocations": {
"type": "array",
"metadata": {
"description": "Regions that resources can be deployed to",
"displayName": "Valid Regions"
}
}
},
"policyDefinitions": [
{
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/storageSkus",
"parameters": {
"locations": {
"value": "[parameters('allowedLocations')]"
}
}
}
],
"policyType": "Custom"
}
},
{
"id": "/providers/Microsoft.Authorization/policySetDefinitions/skuManagement",
"type": "Microsoft.Authorization/policySetDefinitions",
"name": "skuManagement",
"properties": {
"displayName": "VM Sku Management",
"description": "Policies required to minimize the risk of accidental cost overruns",
"metadata": {
"category": "Sku Management"
},
"policyDefinitions": [
{
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/vmSkus"
}
],
"policyType": "Custom"
}
}
]
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,49 @@
}
}
},
"/providers/Microsoft.Authorization/policysetdefinitions/{policySetDefinitionName}": {
"get": {
"tags": [
"PolicySetDefinitions"
],
"operationId": "PolicySetDefinitions_GetBuiltIn",
"description": "Gets the built in policy set definition.",
"x-ms-examples": {
"Get a built in policy set definition": {
"$ref": "./examples/getBuiltInPolicySetDefinition.json"
}
},
"parameters": [
{
"name": "policySetDefinitionName",
"in": "path",
"required": true,
"type": "string",
"description": "The name of the policy set definition to get."
},
{
"$ref": "#/parameters/ApiVersionParameter"
}
],
"responses": {
"200": {
"description": "OK - Returns information about the built in policy set definition.",
"schema": {
"$ref": "#/definitions/PolicySetDefinition"
}
},
"404": {
"description": "Not Found - the built in policy set definition was not found."
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
}
}
}
},
"/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policysetdefinitions": {
"get": {
"tags": [
Expand Down Expand Up @@ -213,6 +256,42 @@
}
}
},
"/providers/Microsoft.Authorization/policysetdefinitions": {
"get": {
"tags": [
"PolicySetDefinitions"
],
"operationId": "PolicySetDefinitions_ListBuiltIn",
"description": "Gets all the built in policy set definitions.",
"x-ms-examples": {
"List policy set definitions": {
"$ref": "./examples/listBuiltInPolicySetDefinitions.json"
}
},
"parameters": [
{
"$ref": "#/parameters/ApiVersionParameter"
}
],
"responses": {
"200": {
"description": "OK - Returns an array of built in policy set definitions.",
"schema": {
"$ref": "#/definitions/PolicySetDefinitionListResult"
}
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
}
},
"x-ms-pageable": {
"nextLinkName": "nextLink"
}
}
},
"/providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policysetdefinitions/{policySetDefinitionName}": {
"put": {
"tags": [
Expand Down Expand Up @@ -245,9 +324,6 @@
{
"$ref": "#/parameters/ApiVersionParameter"
},
{
"$ref": "#/parameters/SubscriptionIdParameter"
},
{
"$ref": "#/parameters/ManagementGroupIdParameter"
}
Expand Down Expand Up @@ -290,9 +366,6 @@
{
"$ref": "#/parameters/ApiVersionParameter"
},
{
"$ref": "#/parameters/SubscriptionIdParameter"
},
{
"$ref": "#/parameters/ManagementGroupIdParameter"
}
Expand Down Expand Up @@ -334,9 +407,6 @@
{
"$ref": "#/parameters/ApiVersionParameter"
},
{
"$ref": "#/parameters/SubscriptionIdParameter"
},
{
"$ref": "#/parameters/ManagementGroupIdParameter"
}
Expand Down Expand Up @@ -373,9 +443,6 @@
{
"$ref": "#/parameters/ApiVersionParameter"
},
{
"$ref": "#/parameters/SubscriptionIdParameter"
},
{
"$ref": "#/parameters/ManagementGroupIdParameter"
}
Expand Down