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

Update policy assignments and exemptions api-version to support selectors and overrides #20672

Merged
merged 10 commits into from
Oct 11, 2022
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