Skip to content

Commit

Permalink
Fix to support nextLink with post calls for python sdk (Azure#14035)
Browse files Browse the repository at this point in the history
* single example with post nextLinl

* address suggestions

* remove examples

* Add nextLink param

* Post on nextLink for all requests

* Add api-version as param

* update readme

* prettier fix

* fix lint err try

* rename operation id

* fix generation for python

* fix casing of next link

* Remove package

* change one next link op to normal path

* readme.python config

* Update readme.python.md

Co-authored-by: Namrata Jagasia <[email protected]>
Co-authored-by: iscai-msft <[email protected]>
Co-authored-by: Zed <[email protected]>
Co-authored-by: msyyc <[email protected]>
  • Loading branch information
5 people authored and mkarmark committed Jul 20, 2021
1 parent 6d0d84b commit 404050e
Show file tree
Hide file tree
Showing 7 changed files with 337 additions and 65 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{
"parameters": {
"api-version": "2019-10-01",
"$skiptoken": "WpmWfBSvPhkAK6QD",
"nextLink": "{nextLink}"
},
"responses": {
"200": {
"body": {
"@odata.nextLink": null,
"@odata.context": "https://management.azure.com/providers/Microsoft.Management/managementGroups/myManagementGroup/providers/Microsoft.PolicyInsights/policyEvents/$metadata#default",
"@odata.count": 2,
"value": [
{
"@odata.id": null,
"@odata.context": "https://management.azure.com/providers/Microsoft.Management/managementGroups/myManagementGroup/providers/Microsoft.PolicyInsights/policyEvents/$metadata#default/$entity",
"timestamp": "2018-02-07T22:19:18.8896095Z",
"resourceId": "/subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/resourceGroups/myrg/providers/Microsoft.Compute/virtualMachines/myvm1/extensions/DAExtension",
"policyAssignmentId": "/providers/Microsoft.Management/managementGroups/myManagementGroup/providers/Microsoft.Authorization/policyAssignments/1ef5d536aec743a0aa801c1a",
"policyDefinitionId": "/providers/Microsoft.Management/managementGroups/myManagementGroup/providers/Microsoft.Authorization/policyDefinitions/022d9357-5a90-46f7-9554-21d30ce4c32d",
"effectiveParameters": null,
"isCompliant": false,
"subscriptionId": "fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef",
"resourceType": "/Microsoft.Compute/virtualMachines/extensions",
"resourceLocation": "westeurope",
"resourceGroup": "myrg",
"resourceTags": "tbd",
"policyAssignmentName": "1ef5d536aec743a0aa801c1a",
"policyAssignmentOwner": "tbd",
"policyAssignmentParameters": "{}",
"policyAssignmentScope": "/providers/Microsoft.Management/managementGroups/myManagementGroup",
"policyDefinitionName": "022d9357-5a90-46f7-9554-21d30ce4c32d",
"policyDefinitionAction": "audit",
"policyDefinitionCategory": "tbd",
"policySetDefinitionId": "/providers/Microsoft.Management/managementGroups/myManagementGroup/providers/Microsoft.Authorization/policySetDefinitions/335cefd2-ab16-430f-b364-974a170eb1d5",
"policySetDefinitionName": "335cefd2-ab16-430f-b364-974a170eb1d5",
"policySetDefinitionOwner": null,
"policySetDefinitionCategory": null,
"policySetDefinitionParameters": null,
"managementGroupIds": "myManagementGroup,fff988bf-fff1-ffff-fffb-fffcd011db47",
"policyDefinitionReferenceId": "15521232277412542086",
"tenantId": "fff988bf-fff1-ffff-fffb-fffcd011db47",
"principalOid": "fff3e452-fff2-fff1-fff8-fff12618f1b8",
"complianceState": "NonCompliant"
},
{
"@odata.id": null,
"@odata.context": "https://management.azure.com/providers/Microsoft.Management/managementGroups/myManagementGroup/providers/Microsoft.PolicyInsights/policyEvents/$metadata#default/$entity",
"timestamp": "2018-02-07T22:19:18.8896095Z",
"resourceId": "/subscriptions/fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef/resourceGroups/myrg/providers/Microsoft.Compute/virtualMachines/myvm1/extensions/DAExtension",
"policyAssignmentId": "/providers/Microsoft.Management/managementGroups/myManagementGroup/providers/Microsoft.Authorization/policyAssignments/95816fce53454b15a7ed803d",
"policyDefinitionId": "/providers/Microsoft.Management/managementGroups/myManagementGroup/providers/Microsoft.Authorization/policyDefinitions/a2c0414b-82e4-459d-97d5-94c79a89232c",
"effectiveParameters": null,
"isCompliant": false,
"subscriptionId": "fff8dfdb-fff3-fff0-fff4-fffdcbe6b2ef",
"resourceType": "/Microsoft.Compute/virtualMachines/extensions",
"resourceLocation": "westeurope",
"resourceGroup": "myrg",
"resourceTags": "tbd",
"policyAssignmentName": "95816fce53454b15a7ed803d",
"policyAssignmentOwner": "tbd",
"policyAssignmentParameters": "{\"allowedLocations\":{\"value\":[\"eastus\"]}}",
"policyAssignmentScope": "/providers/Microsoft.Management/managementGroups/myManagementGroup",
"policyDefinitionName": "a2c0414b-82e4-459d-97d5-94c79a89232c",
"policyDefinitionAction": "audit",
"policyDefinitionCategory": "tbd",
"policySetDefinitionId": "",
"policySetDefinitionName": "",
"policySetDefinitionOwner": null,
"policySetDefinitionCategory": null,
"policySetDefinitionParameters": null,
"managementGroupIds": "myManagementGroup,fff988bf-fff1-ffff-fffb-fffcd011db47",
"policyDefinitionReferenceId": "",
"tenantId": "fff988bf-fff1-ffff-fffb-fffcd011db47",
"principalOid": "fff3e452-fff2-fff1-fff8-fff12618f1b8",
"complianceState": "NonCompliant"
}
]
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{
"parameters": {
"api-version": "2019-10-01",
"$skiptoken": "WpmghrfhqlwpqqdrwpwmgWfBSvPhkAK6QD",
"nextLink": "{nextLink}"
},
"responses": {
"200": {
"body": {
"@odata.context": "https://management.azure.com/providers/Microsoft.Management/managementGroups/myManagementGroup/providers/Microsoft.PolicyInsights/policyStates/$metadata#latest",
"@odata.count": 2,
"value": [
{
"@odata.id": null,
"@odata.context": "https://management.azure.com/providers/Microsoft.Management/managementGroups/myManagementGroup/providers/Microsoft.PolicyInsights/policyStates/$metadata#latest/$entity",
"timestamp": "2019-10-09T17:41:47Z",
"resourceId": "/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/resourceGroups/myrg1/providers/microsoft.insights/autoscalesettings/mytest1",
"policyAssignmentId": "/providers/Microsoft.Management/managementGroups/myManagementGroup/providers/Microsoft.Authorization/policyAssignments/1ef5d536aec743a0aa801c1a",
"policyDefinitionId": "/providers/Microsoft.Management/managementGroups/myManagementGroup/providers/Microsoft.Authorization/policyDefinitions/022d9357-5a90-46f7-9554-21d30ce4c32d",
"effectiveParameters": null,
"isCompliant": false,
"subscriptionId": "fffedd8f-ffff-fffd-fffd-fffed2f84852",
"resourceType": "/microsoft.insights/autoscalesettings",
"resourceLocation": "westus",
"resourceGroup": "myrg1",
"resourceTags": "tbd",
"policyAssignmentName": "1ef5d536aec743a0aa801c1a",
"policyAssignmentOwner": "tbd",
"policyAssignmentParameters": "{}",
"policyAssignmentScope": "/providers/Microsoft.Management/managementGroups/myManagementGroup",
"policyDefinitionName": "022d9357-5a90-46f7-9554-21d30ce4c32d",
"policyDefinitionAction": "audit",
"policyDefinitionCategory": "tbd",
"policySetDefinitionId": "/providers/Microsoft.Management/managementGroups/myManagementGroup/providers/Microsoft.Authorization/policySetDefinitions/335cefd2-ab16-430f-b364-974a170eb1d5",
"policySetDefinitionName": "335cefd2-ab16-430f-b364-974a170eb1d5",
"policySetDefinitionOwner": null,
"policySetDefinitionCategory": null,
"policySetDefinitionParameters": null,
"managementGroupIds": "myManagementGroup,fff988bf-fff1-ffff-fffb-fffcd011db47",
"policyDefinitionReferenceId": "15521232277412542086",
"complianceState": "NonCompliant",
"policyDefinitionGroupNames": [
"myGroup"
]
},
{
"@odata.id": null,
"@odata.context": "https://management.azure.com/providers/Microsoft.Management/managementGroups/myManagementGroup/providers/Microsoft.PolicyInsights/policyStates/$metadata#latest/$entity",
"timestamp": "2019-10-09T17:41:47Z",
"resourceId": "/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/resourceGroups/myrg1/providers/microsoft.insights/autoscalesettings/mytest1",
"policyAssignmentId": "/providers/Microsoft.Management/managementGroups/myManagementGroup/providers/Microsoft.Authorization/policyAssignments/186044306c044a1d8c0ff76c",
"policyDefinitionId": "/providers/Microsoft.Management/managementGroups/myManagementGroup/providers/Microsoft.Authorization/policyDefinitions/022d9357-5a90-46f7-9554-21d30ce4c32d",
"effectiveParameters": null,
"isCompliant": true,
"subscriptionId": "fffedd8f-ffff-fffd-fffd-fffed2f84852",
"resourceType": "/microsoft.insights/autoscalesettings",
"resourceLocation": "westus",
"resourceGroup": "myrg1",
"resourceTags": "tbd",
"policyAssignmentName": "186044306c044a1d8c0ff76c",
"policyAssignmentOwner": "tbd",
"policyAssignmentParameters": "{\"allowedLocations\":{\"value\":[\"centralus\"]}}",
"policyAssignmentScope": "/providers/Microsoft.Management/managementGroups/myManagementGroup",
"policyDefinitionName": "022d9357-5a90-46f7-9554-21d30ce4c32d",
"policyDefinitionAction": "audit",
"policyDefinitionCategory": "tbd",
"policySetDefinitionId": "",
"policySetDefinitionName": "",
"policySetDefinitionOwner": null,
"policySetDefinitionCategory": null,
"policySetDefinitionParameters": null,
"managementGroupIds": "myManagementGroup,fff988bf-fff1-ffff-fffb-fffcd011db47",
"policyDefinitionReferenceId": "",
"complianceState": "Compliant",
"policyDefinitionGroupNames": [
"myGroup"
]
}
]
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@
}
},
"x-ms-pageable": {
"nextLinkName": "@odata.nextLink"
"nextLinkName": "@odata.nextLink",
"operationName": "PolicyEvents_NextLink"
},
"x-ms-examples": {
"Query at management group scope": {
Expand Down Expand Up @@ -153,7 +154,8 @@
}
},
"x-ms-pageable": {
"nextLinkName": "@odata.nextLink"
"nextLinkName": "@odata.nextLink",
"operationName": "PolicyEvents_NextLink"
},
"x-ms-examples": {
"Query at subscription scope": {
Expand Down Expand Up @@ -237,7 +239,8 @@
}
},
"x-ms-pageable": {
"nextLinkName": "@odata.nextLink"
"nextLinkName": "@odata.nextLink",
"operationName": "PolicyEvents_NextLink"
},
"x-ms-examples": {
"Query at resource group scope": {
Expand Down Expand Up @@ -306,7 +309,8 @@
}
},
"x-ms-pageable": {
"nextLinkName": "@odata.nextLink"
"nextLinkName": "@odata.nextLink",
"operationName": "PolicyEvents_NextLink"
},
"x-ms-examples": {
"Query at resource scope": {
Expand Down Expand Up @@ -393,7 +397,8 @@
}
},
"x-ms-pageable": {
"nextLinkName": "@odata.nextLink"
"nextLinkName": "@odata.nextLink",
"operationName": "PolicyEvents_NextLink"
},
"x-ms-examples": {
"Query at subscription level policy set definition scope": {
Expand Down Expand Up @@ -465,7 +470,8 @@
}
},
"x-ms-pageable": {
"nextLinkName": "@odata.nextLink"
"nextLinkName": "@odata.nextLink",
"operationName": "PolicyEvents_NextLink"
},
"x-ms-examples": {
"Query at subscription level policy definition scope": {
Expand Down Expand Up @@ -537,7 +543,8 @@
}
},
"x-ms-pageable": {
"nextLinkName": "@odata.nextLink"
"nextLinkName": "@odata.nextLink",
"operationName": "PolicyEvents_NextLink"
},
"x-ms-examples": {
"Query at subscription level policy assignment scope": {
Expand Down Expand Up @@ -612,7 +619,8 @@
}
},
"x-ms-pageable": {
"nextLinkName": "@odata.nextLink"
"nextLinkName": "@odata.nextLink",
"operationName": "PolicyEvents_NextLink"
},
"x-ms-examples": {
"Query at resource group level policy assignment scope": {
Expand All @@ -625,6 +633,49 @@
}
}
},
"x-ms-paths": {
"/{nextLink}?Next paging op for policy events": {
"post": {
"operationId": "PolicyEvents_NextLink",
"description": "Subsequent post calls to the next link",
"parameters": [
{
"$ref": "#/parameters/apiVersionParameter"
},
{
"$ref": "#/parameters/skipTokenParameter"
},
{
"name": "nextLink",
"in": "path",
"required": true,
"type": "string",
"description": "Next link for list operation.",
"x-ms-skip-url-encoding": true
}
],
"responses": {
"200": {
"description": "Query results.",
"schema": {
"$ref": "#/definitions/PolicyEventsQueryResults"
}
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "#/definitions/QueryFailure"
}
}
},
"x-ms-examples": {
"Query latest at resource group level policy assignment scope with next link": {
"$ref": "./examples/PolicyEvents_QueryManagementGroupScopeNextLinkSkipToken.json"
}
}
}
}
},
"definitions": {
"PolicyEventsQueryResults": {
"description": "Query results.",
Expand Down
Loading

0 comments on commit 404050e

Please sign in to comment.