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

Dataplane policy states and events API swagger #8562

Merged
merged 16 commits into from
Apr 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"parameters": {
"policyEventsResource": "default",
"subscriptionId": "fffedd8f-ffff-fffd-fffd-fffed2f84852",
"api-version": "2019-10-01",
"$from": "2018-02-05T18:00:00Z",
"$filter": "PolicyDefinitionAction eq 'deny'",
"$apply": "aggregate($count as NumDenyEvents)"
},
"responses": {
"200": {
"body": {
"@odata.context": "https://management.azure.com/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/Microsoft.PolicyInsights/policyEvents/$metadata#default",
"@odata.count": 1,
"value": [
{
"@odata.id": null,
"@odata.context": "https://management.azure.com/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/Microsoft.PolicyInsights/policyEvents/$metadata#default/$entity",
"NumDenyEvents": 40
}
]
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"parameters": {
"policyEventsResource": "default",
"subscriptionId": "fffedd8f-ffff-fffd-fffd-fffed2f84852",
"api-version": "2019-10-01",
"$from": "2018-02-05T18:00:00Z",
"$filter": "PolicyDefinitionAction eq 'audit' or PolicyDefinitionAction eq 'deny'",
"$apply": "groupby((PolicyAssignmentId, PolicyDefinitionId, PolicyDefinitionAction, ResourceId), aggregate($count as NumEvents))",
"$top": 2
},
"responses": {
"200": {
"body": {
"@odata.context": "https://management.azure.com/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/Microsoft.PolicyInsights/policyEvents/$metadata#default",
"@odata.count": 2,
"value": [
{
"@odata.id": null,
"@odata.context": "https://management.azure.com/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/Microsoft.PolicyInsights/policyEvents/$metadata#default/$entity",
"policyAssignmentId": "/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/microsoft.authorization/policyassignments/3f3c4330183b4e218fe6fd29",
"policyDefinitionId": "/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/microsoft.authorization/policydefinitions/24813039-7534-408a-9842-eb99f45721b1",
"policyDefinitionAction": "audit",
"resourceId": "/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/resourcegroups/myResourceGroup/providers/microsoft.servicefabric/clusters/myCluster/applications/resourcescachemonitor/services/myService",
"NumEvents": 1
},
{
"@odata.id": null,
"@odata.context": "https://management.azure.com/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/Microsoft.PolicyInsights/policyEvents/$metadata#default/$entity",
"policyAssignmentId": "/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/microsoft.authorization/policyassignments/d6be6bb37e5f4333baa95c2a",
"policyDefinitionId": "/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/microsoft.authorization/policydefinitions/5948d091-78b7-4d3b-a404-cc6a0329b0c6",
"policyDefinitionAction": "audit",
"resourceId": "/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/resourcegroups/myResourceGroup/providers/microsoft.servicefabric/clusters/myCluster/applications/resourcescachemonitor/services/myService",
"NumEvents": 1
}
]
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"parameters": {
"policyEventsResource": "default",
"subscriptionId": "fffedd8f-ffff-fffd-fffd-fffed2f84852",
"api-version": "2019-10-01",
"$from": "2018-01-05T18:00:00Z",
"$filter": "PolicyDefinitionAction ne 'audit' and PolicyDefinitionAction ne 'append'",
"$apply": "groupby((PolicyAssignmentId, PolicyDefinitionId, PolicyDefinitionAction, ResourceId))",
"$top": 2
},
"responses": {
"200": {
"body": {
"@odata.context": "https://management.azure.com/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/Microsoft.PolicyInsights/policyEvents/$metadata#default",
"@odata.count": 2,
"value": [
{
"@odata.id": null,
"@odata.context": "https://management.azure.com/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/Microsoft.PolicyInsights/policyEvents/$metadata#default/$entity",
"policyAssignmentId": "/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/resourcegroups/5bc427ca-0089-4d0d-85bd-e98d1e40b3bf/providers/microsoft.authorization/policyassignments/storageaccountsku",
"policyDefinitionId": "/providers/microsoft.authorization/policydefinitions/7433c107-6db4-4ad1-b57a-a76dce0154a1",
"policyDefinitionAction": "deny",
"resourceId": "/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/resourcegroups/5bc427ca-0089-4d0d-85bd-e98d1e40b3bf/providers/microsoft.storage/storageaccounts/7d528d3a"
},
{
"@odata.id": null,
"@odata.context": "https://management.azure.com/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/Microsoft.PolicyInsights/policyEvents/$metadata#default/$entity",
"policyAssignmentId": "/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/resourcegroups/myResourceGroup/providers/microsoft.authorization/policyassignments/da43b50031bf4bce84584faa",
"policyDefinitionId": "/providers/microsoft.authorization/policydefinitions/1e30110a-5ceb-460c-a204-c1c3969c6d62",
"policyDefinitionAction": "deny",
"resourceId": "/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/resourcegroups/myResourceGroup/providers/microsoft.storage/storageaccounts/mysa1"
}
]
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"parameters": {
"policyEventsResource": "default",
"subscriptionId": "fffedd8f-ffff-fffd-fffd-fffed2f84852",
"api-version": "2019-10-01",
"$from": "2018-01-01T00:00:00Z",
"$filter": "PolicyDefinitionAction eq 'deny'",
"$apply": "groupby((PolicyAssignmentId, PolicyDefinitionId, ResourceId))/groupby((PolicyAssignmentId, PolicyDefinitionId), aggregate($count as NumDeniedResources))",
"$orderby": "NumDeniedResources desc",
"$top": 10
},
"responses": {
"200": {
"body": {
"@odata.context": "https://management.azure.com/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/Microsoft.PolicyInsights/policyEvents/$metadata#default",
"@odata.count": 6,
"value": [
{
"@odata.id": null,
"@odata.context": "https://management.azure.com/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/Microsoft.PolicyInsights/policyEvents/$metadata#default/$entity",
"policyAssignmentId": "/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/resourcegroups/myResourceGroup1/providers/microsoft.authorization/policyassignments/0591f497c35344fcbaf7a393",
"policyDefinitionId": "/providers/microsoft.authorization/policydefinitions/e56962a6-4747-49cd-b67b-bf8b01975c4c",
"NumDeniedResources": 3
},
{
"@odata.id": null,
"@odata.context": "https://management.azure.com/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/Microsoft.PolicyInsights/policyEvents/$metadata#default/$entity",
"policyAssignmentId": "/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/resourcegroups/myResourceGroup1/providers/microsoft.authorization/policyassignments/myassignment1",
"policyDefinitionId": "/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/microsoft.authorization/policydefinitions/mydefinition1",
"NumDeniedResources": 2
},
{
"@odata.id": null,
"@odata.context": "https://management.azure.com/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/Microsoft.PolicyInsights/policyEvents/$metadata#default/$entity",
"policyAssignmentId": "/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/resourcegroups/myResourceGroup1/providers/microsoft.authorization/policyassignments/myassignment1",
"policyDefinitionId": "/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/microsoft.authorization/policydefinitions/mydefinition2",
"NumDeniedResources": 2
},
{
"@odata.id": null,
"@odata.context": "https://management.azure.com/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/Microsoft.PolicyInsights/policyEvents/$metadata#default/$entity",
"policyAssignmentId": "/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/resourcegroups/5bc427ca-0089-4d0d-85bd-e98d1e40b3bf/providers/microsoft.authorization/policyassignments/storageaccountsku",
"policyDefinitionId": "/providers/microsoft.authorization/policydefinitions/7433c107-6db4-4ad1-b57a-a76dce0154a1",
"NumDeniedResources": 1
},
{
"@odata.id": null,
"@odata.context": "https://management.azure.com/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/Microsoft.PolicyInsights/policyEvents/$metadata#default/$entity",
"policyAssignmentId": "/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/resourcegroups/myResourceGroup2/providers/microsoft.authorization/policyassignments/da43b50031bf4bce84584faa",
"policyDefinitionId": "/providers/microsoft.authorization/policydefinitions/1e30110a-5ceb-460c-a204-c1c3969c6d62",
"NumDeniedResources": 1
},
{
"@odata.id": null,
"@odata.context": "https://management.azure.com/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/Microsoft.PolicyInsights/policyEvents/$metadata#default/$entity",
"policyAssignmentId": "/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/resourcegroups/myResourceGroup2/providers/microsoft.authorization/policyassignments/myassignment2",
"policyDefinitionId": "/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/microsoft.authorization/policydefinitions/mydefinition3",
"NumDeniedResources": 1
}
]
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"parameters": {
"scope": "subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852",
"api-version": "2019-10-01"
},
"responses": {
"200": {
"headers": {
"content-type": "application/xml"
},
"body": "<edmx:Edmx Version=\"4.0\" xmlns:edmx=\"http://docs.oasis-open.org/odata/ns/edmx\"> <edmx:DataServices> <Schema Namespace=\"Microsoft.WindowsAzure.Governance.Policy.Provider\" xmlns=\"http://docs.oasis-open.org/odata/ns/edm\"> <EntityType Name=\"PolicyEvent\"> <Key> <PropertyRef Name=\"Timestamp\" /> <PropertyRef Name=\"ResourceId\" /> <PropertyRef Name=\"PolicyAssignmentId\" /> <PropertyRef Name=\"PolicyDefinitionId\" /> </Key> <Property Name=\"Timestamp\" Type=\"Edm.DateTimeOffset\" /> <Property Name=\"ResourceId\" Type=\"Edm.String\" /> <Property Name=\"PolicyAssignmentId\" Type=\"Edm.String\" /> <Property Name=\"PolicyDefinitionId\" Type=\"Edm.String\" /> <Property Name=\"EffectiveParameters\" Type=\"Edm.String\" /> <Property Name=\"IsCompliant\" Type=\"Edm.Boolean\" /> <Property Name=\"SubscriptionId\" Type=\"Edm.String\" /> <Property Name=\"ResourceType\" Type=\"Edm.String\" /> <Property Name=\"ResourceLocation\" Type=\"Edm.String\" /> <Property Name=\"ResourceGroup\" Type=\"Edm.String\" /> <Property Name=\"ResourceTags\" Type=\"Edm.String\" /> <Property Name=\"PolicyAssignmentName\" Type=\"Edm.String\" /> <Property Name=\"PolicyAssignmentOwner\" Type=\"Edm.String\" /> <Property Name=\"PolicyAssignmentParameters\" Type=\"Edm.String\" /> <Property Name=\"PolicyAssignmentScope\" Type=\"Edm.String\" /> <Property Name=\"PolicyDefinitionName\" Type=\"Edm.String\" /> <Property Name=\"PolicyDefinitionAction\" Type=\"Edm.String\" /> <Property Name=\"PolicyDefinitionCategory\" Type=\"Edm.String\" /> <Property Name=\"PolicySetDefinitionId\" Type=\"Edm.String\" /> <Property Name=\"PolicySetDefinitionName\" Type=\"Edm.String\" /> <Property Name=\"PolicySetDefinitionOwner\" Type=\"Edm.String\" /> <Property Name=\"PolicySetDefinitionCategory\" Type=\"Edm.String\" /> <Property Name=\"PolicySetDefinitionParameters\" Type=\"Edm.String\" /> <Property Name=\"ManagementGroupIds\" Type=\"Edm.String\" /> <Property Name=\"PolicyDefinitionReferenceId\" Type=\"Edm.String\" /> <Property Name=\"TenantId\" Type=\"Edm.String\" /> <Property Name=\"PrincipalOid\" Type=\"Edm.String\" /> </EntityType> <Action Name=\"queryResults\" IsBound=\"true\" EntitySetPath=\"default\"> <Parameter Name=\"default\" Type=\"Collection(Microsoft.WindowsAzure.Governance.Policy.Provider.PolicyEvent)\" Nullable=\"false\" /> <ReturnType Type=\"Collection(Microsoft.WindowsAzure.Governance.Policy.Provider.PolicyEvent)\" Nullable=\"false\" /> </Action> <EntityContainer Name=\"DefaultContainer\"> <EntitySet Name=\"default\" EntityType=\"Microsoft.WindowsAzure.Governance.Policy.Provider.PolicyEvent\"> <Annotation Term=\"Org.OData.Core.V1.ResourcePath\" String=\"default\" /> <Annotation Term=\"Org.OData.Capabilities.V1.SearchRestrictions\"> <Record> <PropertyValue Property=\"Searchable\" Bool=\"false\" /> </Record> </Annotation> <Annotation Term=\"Org.OData.Capabilities.V1.InsertRestrictions\"> <Record> <PropertyValue Property=\"Insertable\" Bool=\"false\" /> </Record> </Annotation> <Annotation Term=\"Org.OData.Capabilities.V1.UpdateRestrictions\"> <Record> <PropertyValue Property=\"Updatable\" Bool=\"false\" /> </Record> </Annotation> <Annotation Term=\"Org.OData.Capabilities.V1.DeleteRestrictions\"> <Record> <PropertyValue Property=\"Deletable\" Bool=\"false\" /> </Record> </Annotation> </EntitySet> <Annotation Term=\"Org.OData.Core.V1.Description\" String=\"Policy Events\" /> </EntityContainer> <Annotations Target=\"Microsoft.WindowsAzure.Governance.Policy.Provider.DefaultContainer\"> <Annotation Term=\"Org.OData.Capabilities.V1.ConformanceLevel\"> <EnumMember>Org.OData.Capabilities.V1.ConformanceLevelType/Minimal</EnumMember> </Annotation> <Annotation Term=\"Org.OData.Capabilities.V1.SupportedFormats\"> <Collection> <String>application/json;odata.metadata=minimal;IEEE754Compatible=false;odata.streaming=true</String> <String>application/json;odata.metadata=none;IEEE754Compatible=false;odata.streaming=true</String> </Collection> </Annotation> <Annotation Term=\"Org.OData.Capabilities.V1.AsynchronousRequestsSupported\" Bool=\"true\" /> </Annotations> </Schema> </edmx:DataServices></edmx:Edmx>"
}
}
}
Loading