Skip to content

Commit 02ffe5a

Browse files
robgaanandanthony
authored andcommitted
Update policy assignments and exemptions api-version to support selectors and overrides (Azure#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
1 parent 60a04fc commit 02ffe5a

File tree

41 files changed

+3941
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+3941
-1
lines changed
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
{
2+
"swagger": "2.0",
3+
"info": {
4+
"title": "PolicyClient",
5+
"version": "v1"
6+
},
7+
"paths": {},
8+
"definitions": {
9+
"Selector": {
10+
"description": "The selector expression.",
11+
"type": "object",
12+
"properties": {
13+
"kind": {
14+
"type": "string",
15+
"description": "The selector kind.",
16+
"enum": [
17+
"resourceLocation",
18+
"resourceType",
19+
"resourceWithoutLocation",
20+
"policyDefinitionReferenceId"
21+
],
22+
"x-ms-enum": {
23+
"name": "SelectorKind",
24+
"modelAsString": true,
25+
"values": [
26+
{
27+
"value": "resourceLocation",
28+
"description": "The selector kind to filter policies by the resource location."
29+
},
30+
{
31+
"value": "resourceType",
32+
"description": "The selector kind to filter policies by the resource type."
33+
},
34+
{
35+
"value": "resourceWithoutLocation",
36+
"description": "The selector kind to filter policies by the resource without location."
37+
},
38+
{
39+
"value": "policyDefinitionReferenceId",
40+
"description": "The selector kind to filter policies by the policy definition reference ID."
41+
}
42+
]
43+
}
44+
},
45+
"in": {
46+
"type": "array",
47+
"items": {
48+
"type": "string"
49+
},
50+
"description": "The list of values to filter in."
51+
},
52+
"notIn": {
53+
"type": "array",
54+
"items": {
55+
"type": "string"
56+
},
57+
"description": "The list of values to filter out."
58+
}
59+
}
60+
},
61+
"ResourceSelector": {
62+
"description": "The resource selector to filter policies by resource properties.",
63+
"type": "object",
64+
"properties": {
65+
"name": {
66+
"type": "string",
67+
"description": "The name of the resource selector."
68+
},
69+
"selectors": {
70+
"type": "array",
71+
"items": {
72+
"$ref": "#/definitions/Selector"
73+
},
74+
"x-ms-identifiers": [],
75+
"description": "The list of the selector expressions."
76+
}
77+
}
78+
},
79+
"Override": {
80+
"description": "The policy property value override.",
81+
"type": "object",
82+
"properties": {
83+
"kind": {
84+
"type": "string",
85+
"description": "The override kind.",
86+
"enum": [
87+
"policyEffect"
88+
],
89+
"x-ms-enum": {
90+
"name": "OverrideKind",
91+
"modelAsString": true,
92+
"values": [
93+
{
94+
"value": "policyEffect",
95+
"description": "It will override the policy effect type."
96+
}
97+
]
98+
}
99+
},
100+
"value": {
101+
"type": "string",
102+
"description": "The value to override the policy property."
103+
},
104+
"selectors": {
105+
"type": "array",
106+
"items": {
107+
"$ref": "#/definitions/Selector"
108+
},
109+
"x-ms-identifiers": [],
110+
"description": "The list of the selector expressions."
111+
}
112+
}
113+
}
114+
}
115+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
{
2+
"parameters": {
3+
"scope": "subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/resourceGroups/demoCluster",
4+
"policyExemptionName": "DemoExpensiveVM",
5+
"api-version": "2022-07-01-preview",
6+
"parameters": {
7+
"properties": {
8+
"policyAssignmentId": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyAssignments/CostManagement",
9+
"policyDefinitionReferenceIds": [
10+
"Limit_Skus"
11+
],
12+
"exemptionCategory": "Waiver",
13+
"displayName": "Exempt demo cluster",
14+
"description": "Exempt demo cluster from limit sku",
15+
"metadata": {
16+
"reason": "Temporary exemption for a expensive VM demo"
17+
}
18+
}
19+
}
20+
},
21+
"responses": {
22+
"201": {
23+
"headers": {},
24+
"body": {
25+
"properties": {
26+
"policyAssignmentId": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyAssignments/CostManagement",
27+
"policyDefinitionReferenceIds": [
28+
"Limit_Skus"
29+
],
30+
"exemptionCategory": "Waiver",
31+
"displayName": "Exempt demo cluster",
32+
"description": "Exempt demo cluster from limit sku",
33+
"metadata": {
34+
"reason": "Temporary exemption for a expensive VM demo"
35+
}
36+
},
37+
"systemData": {
38+
"createdBy": "string",
39+
"createdByType": "User",
40+
"createdAt": "2020-07-01T01:01:01.1075056Z",
41+
"lastModifiedBy": "string",
42+
"lastModifiedByType": "User",
43+
"lastModifiedAt": "2020-07-01T01:01:01.1075056Z"
44+
},
45+
"id": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/resourceGroups/demoCluster/providers/Microsoft.Authorization/policyExemptions/DemoExpensiveVM",
46+
"type": "Microsoft.Authorization/policyExemptions",
47+
"name": "DemoExpensiveVM"
48+
}
49+
},
50+
"200": {
51+
"headers": {},
52+
"body": {
53+
"properties": {
54+
"policyAssignmentId": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyAssignments/CostManagement",
55+
"policyDefinitionReferenceIds": [
56+
"Limit_Skus"
57+
],
58+
"exemptionCategory": "Waiver",
59+
"displayName": "Exempt demo cluster",
60+
"description": "Exempt demo cluster from limit sku",
61+
"metadata": {
62+
"reason": "Temporary exemption for a expensive VM demo"
63+
}
64+
},
65+
"systemData": {
66+
"createdBy": "string",
67+
"createdByType": "User",
68+
"createdAt": "2020-07-01T01:01:01.1075056Z",
69+
"lastModifiedBy": "string",
70+
"lastModifiedByType": "User",
71+
"lastModifiedAt": "2020-07-01T02:01:01.1075056Z"
72+
},
73+
"id": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/resourceGroups/demoCluster/providers/Microsoft.Authorization/policyExemptions/DemoExpensiveVM",
74+
"type": "Microsoft.Authorization/policyExemptions",
75+
"name": "DemoExpensiveVM"
76+
}
77+
}
78+
}
79+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
{
2+
"parameters": {
3+
"scope": "subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/resourceGroups/demoCluster",
4+
"policyExemptionName": "DemoExpensiveVM",
5+
"api-version": "2022-07-01-preview",
6+
"parameters": {
7+
"properties": {
8+
"policyAssignmentId": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyAssignments/CostManagement",
9+
"policyDefinitionReferenceIds": [
10+
"Limit_Skus"
11+
],
12+
"exemptionCategory": "Waiver",
13+
"displayName": "Exempt demo cluster",
14+
"description": "Exempt demo cluster from limit sku",
15+
"metadata": {
16+
"reason": "Temporary exemption for a expensive VM demo"
17+
},
18+
"assignmentScopeValidation": "Default",
19+
"resourceSelectors": [
20+
{
21+
"name": "SDPRegions",
22+
"selectors": [
23+
{
24+
"kind": "resourceLocation",
25+
"in": [
26+
"eastus2euap",
27+
"centraluseuap"
28+
]
29+
}
30+
]
31+
}
32+
]
33+
}
34+
}
35+
},
36+
"responses": {
37+
"201": {
38+
"headers": {},
39+
"body": {
40+
"properties": {
41+
"policyAssignmentId": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyAssignments/CostManagement",
42+
"policyDefinitionReferenceIds": [
43+
"Limit_Skus"
44+
],
45+
"exemptionCategory": "Waiver",
46+
"displayName": "Exempt demo cluster",
47+
"description": "Exempt demo cluster from limit sku",
48+
"metadata": {
49+
"reason": "Temporary exemption for a expensive VM demo"
50+
},
51+
"assignmentScopeValidation": "Default",
52+
"resourceSelectors": [
53+
{
54+
"name": "SDPRegions",
55+
"selectors": [
56+
{
57+
"kind": "resourceLocation",
58+
"in": [
59+
"eastus2euap",
60+
"centraluseuap"
61+
]
62+
}
63+
]
64+
}
65+
]
66+
},
67+
"systemData": {
68+
"createdBy": "string",
69+
"createdByType": "User",
70+
"createdAt": "2020-07-01T01:01:01.1075056Z",
71+
"lastModifiedBy": "string",
72+
"lastModifiedByType": "User",
73+
"lastModifiedAt": "2020-07-01T01:01:01.1075056Z"
74+
},
75+
"id": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/resourceGroups/demoCluster/providers/Microsoft.Authorization/policyExemptions/DemoExpensiveVM",
76+
"type": "Microsoft.Authorization/policyExemptions",
77+
"name": "DemoExpensiveVM"
78+
}
79+
},
80+
"200": {
81+
"headers": {},
82+
"body": {
83+
"properties": {
84+
"policyAssignmentId": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyAssignments/CostManagement",
85+
"policyDefinitionReferenceIds": [
86+
"Limit_Skus"
87+
],
88+
"exemptionCategory": "Waiver",
89+
"displayName": "Exempt demo cluster",
90+
"description": "Exempt demo cluster from limit sku",
91+
"metadata": {
92+
"reason": "Temporary exemption for a expensive VM demo"
93+
},
94+
"assignmentScopeValidation": "Default",
95+
"resourceSelectors": [
96+
{
97+
"name": "SDPRegions",
98+
"selectors": [
99+
{
100+
"kind": "resourceLocation",
101+
"in": [
102+
"eastus2euap",
103+
"centraluseuap"
104+
]
105+
}
106+
]
107+
}
108+
]
109+
},
110+
"systemData": {
111+
"createdBy": "string",
112+
"createdByType": "User",
113+
"createdAt": "2020-07-01T01:01:01.1075056Z",
114+
"lastModifiedBy": "string",
115+
"lastModifiedByType": "User",
116+
"lastModifiedAt": "2020-07-01T02:01:01.1075056Z"
117+
},
118+
"id": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/resourceGroups/demoCluster/providers/Microsoft.Authorization/policyExemptions/DemoExpensiveVM",
119+
"type": "Microsoft.Authorization/policyExemptions",
120+
"name": "DemoExpensiveVM"
121+
}
122+
}
123+
}
124+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"parameters": {
3+
"scope": "subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/resourceGroups/demoCluster",
4+
"policyExemptionName": "DemoExpensiveVM",
5+
"api-version": "2022-07-01-preview"
6+
},
7+
"responses": {
8+
"200": {
9+
"headers": {}
10+
},
11+
"204": {
12+
"headers": {}
13+
}
14+
}
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"parameters": {
3+
"scope": "subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/resourceGroups/demoCluster",
4+
"policyExemptionName": "DemoExpensiveVM",
5+
"api-version": "2022-07-01-preview"
6+
},
7+
"responses": {
8+
"200": {
9+
"headers": {},
10+
"body": {
11+
"properties": {
12+
"policyAssignmentId": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyAssignments/CostManagement",
13+
"policyDefinitionReferenceIds": [
14+
"Limit_Skus"
15+
],
16+
"exemptionCategory": "Waiver",
17+
"displayName": "Exempt demo cluster",
18+
"description": "Exempt demo cluster from limit sku",
19+
"metadata": {
20+
"reason": "Temporary exemption for a expensive VM demo"
21+
}
22+
},
23+
"systemData": {
24+
"createdBy": "string",
25+
"createdByType": "User",
26+
"createdAt": "2020-07-01T01:01:01.1075056Z",
27+
"lastModifiedBy": "string",
28+
"lastModifiedByType": "User",
29+
"lastModifiedAt": "2020-07-01T02:01:01.1075056Z"
30+
},
31+
"id": "/subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/resourceGroups/demoCluster/providers/Microsoft.Authorization/policyExemptions/DemoExpensiveVM",
32+
"type": "Microsoft.Authorization/policyExemptions",
33+
"name": "DemoExpensiveVM"
34+
}
35+
}
36+
}
37+
}

0 commit comments

Comments
 (0)