Skip to content

Commit

Permalink
Update policy assignments and exemptions api-version to support selec…
Browse files Browse the repository at this point in the history
…tors and overrides (#20672)

* Port previous version exemptions and assignments

* Update assignments and exemptions api-version

* fix file name casing

* Trigger checks

* Addressed comments

* Addressed comment

* Addressed comments

* Fixed the merge error
  • Loading branch information
robga authored Oct 11, 2022
1 parent 98891f1 commit 1cb05f0
Show file tree
Hide file tree
Showing 41 changed files with 3,941 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
{
"swagger": "2.0",
"info": {
"title": "PolicyClient",
"version": "v1"
},
"paths": {},
"definitions": {
"Selector": {
"description": "The selector expression.",
"type": "object",
"properties": {
"kind": {
"type": "string",
"description": "The selector kind.",
"enum": [
"resourceLocation",
"resourceType",
"resourceWithoutLocation",
"policyDefinitionReferenceId"
],
"x-ms-enum": {
"name": "SelectorKind",
"modelAsString": true,
"values": [
{
"value": "resourceLocation",
"description": "The selector kind to filter policies by the resource location."
},
{
"value": "resourceType",
"description": "The selector kind to filter policies by the resource type."
},
{
"value": "resourceWithoutLocation",
"description": "The selector kind to filter policies by the resource without location."
},
{
"value": "policyDefinitionReferenceId",
"description": "The selector kind to filter policies by the policy definition reference ID."
}
]
}
},
"in": {
"type": "array",
"items": {
"type": "string"
},
"description": "The list of values to filter in."
},
"notIn": {
"type": "array",
"items": {
"type": "string"
},
"description": "The list of values to filter out."
}
}
},
"ResourceSelector": {
"description": "The resource selector to filter policies by resource properties.",
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "The name of the resource selector."
},
"selectors": {
"type": "array",
"items": {
"$ref": "#/definitions/Selector"
},
"x-ms-identifiers": [],
"description": "The list of the selector expressions."
}
}
},
"Override": {
"description": "The policy property value override.",
"type": "object",
"properties": {
"kind": {
"type": "string",
"description": "The override kind.",
"enum": [
"policyEffect"
],
"x-ms-enum": {
"name": "OverrideKind",
"modelAsString": true,
"values": [
{
"value": "policyEffect",
"description": "It will override the policy effect type."
}
]
}
},
"value": {
"type": "string",
"description": "The value to override the policy property."
},
"selectors": {
"type": "array",
"items": {
"$ref": "#/definitions/Selector"
},
"x-ms-identifiers": [],
"description": "The list of the selector expressions."
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"parameters": {
"scope": "subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/resourceGroups/demoCluster",
"policyExemptionName": "DemoExpensiveVM",
"api-version": "2022-07-01-preview",
"parameters": {
"properties": {
"policyAssignmentId": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyAssignments/CostManagement",
"policyDefinitionReferenceIds": [
"Limit_Skus"
],
"exemptionCategory": "Waiver",
"displayName": "Exempt demo cluster",
"description": "Exempt demo cluster from limit sku",
"metadata": {
"reason": "Temporary exemption for a expensive VM demo"
}
}
}
},
"responses": {
"201": {
"headers": {},
"body": {
"properties": {
"policyAssignmentId": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyAssignments/CostManagement",
"policyDefinitionReferenceIds": [
"Limit_Skus"
],
"exemptionCategory": "Waiver",
"displayName": "Exempt demo cluster",
"description": "Exempt demo cluster from limit sku",
"metadata": {
"reason": "Temporary exemption for a expensive VM demo"
}
},
"systemData": {
"createdBy": "string",
"createdByType": "User",
"createdAt": "2020-07-01T01:01:01.1075056Z",
"lastModifiedBy": "string",
"lastModifiedByType": "User",
"lastModifiedAt": "2020-07-01T01:01:01.1075056Z"
},
"id": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/resourceGroups/demoCluster/providers/Microsoft.Authorization/policyExemptions/DemoExpensiveVM",
"type": "Microsoft.Authorization/policyExemptions",
"name": "DemoExpensiveVM"
}
},
"200": {
"headers": {},
"body": {
"properties": {
"policyAssignmentId": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyAssignments/CostManagement",
"policyDefinitionReferenceIds": [
"Limit_Skus"
],
"exemptionCategory": "Waiver",
"displayName": "Exempt demo cluster",
"description": "Exempt demo cluster from limit sku",
"metadata": {
"reason": "Temporary exemption for a expensive VM demo"
}
},
"systemData": {
"createdBy": "string",
"createdByType": "User",
"createdAt": "2020-07-01T01:01:01.1075056Z",
"lastModifiedBy": "string",
"lastModifiedByType": "User",
"lastModifiedAt": "2020-07-01T02:01:01.1075056Z"
},
"id": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/resourceGroups/demoCluster/providers/Microsoft.Authorization/policyExemptions/DemoExpensiveVM",
"type": "Microsoft.Authorization/policyExemptions",
"name": "DemoExpensiveVM"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
{
"parameters": {
"scope": "subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/resourceGroups/demoCluster",
"policyExemptionName": "DemoExpensiveVM",
"api-version": "2022-07-01-preview",
"parameters": {
"properties": {
"policyAssignmentId": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyAssignments/CostManagement",
"policyDefinitionReferenceIds": [
"Limit_Skus"
],
"exemptionCategory": "Waiver",
"displayName": "Exempt demo cluster",
"description": "Exempt demo cluster from limit sku",
"metadata": {
"reason": "Temporary exemption for a expensive VM demo"
},
"assignmentScopeValidation": "Default",
"resourceSelectors": [
{
"name": "SDPRegions",
"selectors": [
{
"kind": "resourceLocation",
"in": [
"eastus2euap",
"centraluseuap"
]
}
]
}
]
}
}
},
"responses": {
"201": {
"headers": {},
"body": {
"properties": {
"policyAssignmentId": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyAssignments/CostManagement",
"policyDefinitionReferenceIds": [
"Limit_Skus"
],
"exemptionCategory": "Waiver",
"displayName": "Exempt demo cluster",
"description": "Exempt demo cluster from limit sku",
"metadata": {
"reason": "Temporary exemption for a expensive VM demo"
},
"assignmentScopeValidation": "Default",
"resourceSelectors": [
{
"name": "SDPRegions",
"selectors": [
{
"kind": "resourceLocation",
"in": [
"eastus2euap",
"centraluseuap"
]
}
]
}
]
},
"systemData": {
"createdBy": "string",
"createdByType": "User",
"createdAt": "2020-07-01T01:01:01.1075056Z",
"lastModifiedBy": "string",
"lastModifiedByType": "User",
"lastModifiedAt": "2020-07-01T01:01:01.1075056Z"
},
"id": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/resourceGroups/demoCluster/providers/Microsoft.Authorization/policyExemptions/DemoExpensiveVM",
"type": "Microsoft.Authorization/policyExemptions",
"name": "DemoExpensiveVM"
}
},
"200": {
"headers": {},
"body": {
"properties": {
"policyAssignmentId": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyAssignments/CostManagement",
"policyDefinitionReferenceIds": [
"Limit_Skus"
],
"exemptionCategory": "Waiver",
"displayName": "Exempt demo cluster",
"description": "Exempt demo cluster from limit sku",
"metadata": {
"reason": "Temporary exemption for a expensive VM demo"
},
"assignmentScopeValidation": "Default",
"resourceSelectors": [
{
"name": "SDPRegions",
"selectors": [
{
"kind": "resourceLocation",
"in": [
"eastus2euap",
"centraluseuap"
]
}
]
}
]
},
"systemData": {
"createdBy": "string",
"createdByType": "User",
"createdAt": "2020-07-01T01:01:01.1075056Z",
"lastModifiedBy": "string",
"lastModifiedByType": "User",
"lastModifiedAt": "2020-07-01T02:01:01.1075056Z"
},
"id": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/resourceGroups/demoCluster/providers/Microsoft.Authorization/policyExemptions/DemoExpensiveVM",
"type": "Microsoft.Authorization/policyExemptions",
"name": "DemoExpensiveVM"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"parameters": {
"scope": "subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/resourceGroups/demoCluster",
"policyExemptionName": "DemoExpensiveVM",
"api-version": "2022-07-01-preview"
},
"responses": {
"200": {
"headers": {}
},
"204": {
"headers": {}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"parameters": {
"scope": "subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/resourceGroups/demoCluster",
"policyExemptionName": "DemoExpensiveVM",
"api-version": "2022-07-01-preview"
},
"responses": {
"200": {
"headers": {},
"body": {
"properties": {
"policyAssignmentId": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyAssignments/CostManagement",
"policyDefinitionReferenceIds": [
"Limit_Skus"
],
"exemptionCategory": "Waiver",
"displayName": "Exempt demo cluster",
"description": "Exempt demo cluster from limit sku",
"metadata": {
"reason": "Temporary exemption for a expensive VM demo"
}
},
"systemData": {
"createdBy": "string",
"createdByType": "User",
"createdAt": "2020-07-01T01:01:01.1075056Z",
"lastModifiedBy": "string",
"lastModifiedByType": "User",
"lastModifiedAt": "2020-07-01T02:01:01.1075056Z"
},
"id": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/resourceGroups/demoCluster/providers/Microsoft.Authorization/policyExemptions/DemoExpensiveVM",
"type": "Microsoft.Authorization/policyExemptions",
"name": "DemoExpensiveVM"
}
}
}
}
Loading

0 comments on commit 1cb05f0

Please sign in to comment.