-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Add policy set definition APIs #1587
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
Changes from 1 commit
7c4eedd
cdf4468
e9d9720
59a4fcc
ddd97a0
286e4a1
6b13491
ff2f6c8
139ee8d
28b7136
5721e81
2274b1c
b37a167
290fd9b
ddd44e0
0ceabfc
df1297f
ea7c1ed
780cc26
5bd98a3
f7776f4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| { | ||
| "parameters": { | ||
| "subscriptionId": "subid", | ||
| "policySetDefinitionName": "costManagement", | ||
| "api-version": "2017-06-01-preview", | ||
| "parameters": { | ||
| "properties": { | ||
| "displayName": "VM and Storage Cost Management", | ||
| "description": "Policies required to minimize the risk of accidental cost overruns", | ||
| "metadata": { | ||
| "category": "Cost Management" | ||
| }, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. example should include parameters since they are typically the most complex part of these objects |
||
| "policyDefinitions": [ | ||
| { | ||
| "policyDefinitionId": "/subscriptions/subId/providers/Microsoft.Authorization/policyDefinitions/vmSkus" | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| }, | ||
| "responses": { | ||
| "201": { | ||
| "headers": {}, | ||
| "body": { | ||
| "id": "/subscriptions/subid/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" | ||
| }, | ||
| "policyDefinitions": [ | ||
| { | ||
| "policyDefinitionId": "/subscriptions/subid/providers/Microsoft.Authorization/policyDefinitions/vmSkus" | ||
| } | ||
| ], | ||
| "policyType": "Custom" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| { | ||
| "parameters": { | ||
| "subscriptionId": "subid", | ||
| "policySetDefinitionName": "costManagement", | ||
| "api-version": "2017-06-01-preview" | ||
| }, | ||
| "responses": { | ||
| "200": { | ||
| "headers": {}, | ||
| "body": { | ||
| "id": "/subscriptions/subid/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": "/subscriptions/subid/providers/Microsoft.Authorization/policyDefinitions/storageSkus", | ||
| "parameters": { | ||
| "listOfAllowedSKUs": { | ||
| "value": [ | ||
| "�Standard_GRS�", | ||
|
||
| "�Standard_LRS�" | ||
| ] | ||
| } | ||
| } | ||
| }, | ||
| { | ||
| "policyDefinitionId": "/subscriptions/subid/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,77 @@ | ||
| { | ||
| "parameters": { | ||
| "subscriptionId": "subid", | ||
| "api-version": "2017-06-01-preview" | ||
| }, | ||
| "responses": { | ||
| "200": { | ||
| "headers": {}, | ||
| "body": { | ||
| "value": [ | ||
| { | ||
| "id": "/subscriptions/subid/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": { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. both policySets returned in this example are actually invalid. They have a parameter defined that is never used in a policyDefinition reference
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you please elaborate? This is listing the policy sets, where is policyDefinition reference defined here?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The sets in this example have an "allowedLocations" parameter. In order for this to be a valid set definition that "allowedLocations" parameter needs to be referenced by one of the parameters in the "policyDefinitions" array. Similar to what getPolicySetDefinition example has: {
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Got it! Thanks |
||
| "type": "array", | ||
| "metadata": { | ||
| "description": "Regions that resources can be deployed to", | ||
| "displayName": "Valid Regions" | ||
| } | ||
| } | ||
| }, | ||
| "policyDefinitions": [ | ||
| { | ||
| "policyDefinitionId": "/subscriptions/subid/providers/Microsoft.Authorization/policyDefinitions/storageSkus", | ||
| "parameters": { | ||
| "listOfAllowedSKUs": { | ||
| "value": [ | ||
|
||
| "�Standard_GRS�", | ||
|
||
| "�Standard_LRS�" | ||
| ] | ||
| } | ||
| } | ||
| } | ||
| ], | ||
| "policyType": "Custom" | ||
| } | ||
| }, | ||
| { | ||
| "id": "/subscriptions/subid/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" | ||
| }, | ||
| "parameters": { | ||
| "allowedLocations": { | ||
| "type": "array", | ||
| "metadata": { | ||
| "description": "Regions that resources can be deployed to", | ||
| "displayName": "Valid Regions" | ||
| } | ||
| } | ||
| }, | ||
| "policyDefinitions": [ | ||
| { | ||
| "policyDefinitionId": "/subscriptions/subid/providers/Microsoft.Authorization/policyDefinitions/vmSkus" | ||
| } | ||
| ], | ||
| "policyType": "Custom" | ||
| } | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these example files need to be referenced in the swagger spec for them to show up in documentation, right? See https://github.com/pilor/azure-rest-api-specs/blob/current/documentation/x-ms-examples.md
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of course they should! thanks for catching this