Get the history a smart group, which captures any Smart Group state changes (New/Acknowledged/Closed) .
GET https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.AlertsManagement/smartGroups/{smartGroupId}/history?api-version=2019-05-05-preview
URI Parameters
Name |
In |
Required |
Type |
Description |
smartGroupId
|
path |
True
|
string
|
Smart group unique id.
|
subscriptionId
|
path |
True
|
string
|
The ID of the target subscription.
|
api-version
|
query |
True
|
api-version
|
client API version
|
Responses
Name |
Type |
Description |
200 OK
|
smartGroupModification
|
OK. Returns the list of changes of smart group.
|
Other Status Codes
|
errorResponse
|
Error response describing why the operation failed.
|
Examples
Resolve
Sample Request
GET https://management.azure.com/subscriptions/9e261de7-c804-4b9d-9ebf-6f50fe350a9a/providers/Microsoft.AlertsManagement/smartGroups/a808445e-bb38-4751-85c2-1b109ccc1059/history?api-version=2019-05-05-preview
import com.azure.core.util.Context;
/** Samples for SmartGroups GetHistory. */
public final class Main {
/*
* x-ms-original-file: specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2019-05-05-preview/examples/SmartGroups_History.json
*/
/**
* Sample code: Resolve.
*
* @param manager Entry point to AlertsManagementManager.
*/
public static void resolve(com.azure.resourcemanager.alertsmanagement.AlertsManagementManager manager) {
manager.smartGroups().getHistoryWithResponse("a808445e-bb38-4751-85c2-1b109ccc1059", Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.alertsmanagement import AlertsManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-alertsmanagement
# USAGE
python smart_groups_history.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = AlertsManagementClient(
credential=DefaultAzureCredential(),
subscription_id="9e261de7-c804-4b9d-9ebf-6f50fe350a9a",
)
response = client.smart_groups.get_history(
smart_group_id="a808445e-bb38-4751-85c2-1b109ccc1059",
)
print(response)
# x-ms-original-file: specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2019-05-05-preview/examples/SmartGroups_History.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armalertsmanagement_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/alertsmanagement/armalertsmanagement"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/6d2438481021a94793b07b226df06d5f3c61d51d/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2019-05-05-preview/examples/SmartGroups_History.json
func ExampleSmartGroupsClient_GetHistory() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armalertsmanagement.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewSmartGroupsClient().GetHistory(ctx, "a808445e-bb38-4751-85c2-1b109ccc1059", nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.SmartGroupModification = armalertsmanagement.SmartGroupModification{
// Name: to.Ptr("cpu alert"),
// Type: to.Ptr("Microsoft.AlertsManagement/alerts"),
// ID: to.Ptr("/subscriptions/9e261de7-c804-4b9d-9ebf-6f50fe350a9a/providers/Microsoft.AlertsManagement/smartGroups/a808445e-bb38-4751-85c2-1b109ccc1059/history/default"),
// Properties: &armalertsmanagement.SmartGroupModificationProperties{
// Modifications: []*armalertsmanagement.SmartGroupModificationItem{
// {
// Description: to.Ptr("New Smart Group is created"),
// Comments: to.Ptr(""),
// ModificationEvent: to.Ptr(armalertsmanagement.SmartGroupModificationEventSmartGroupCreated),
// ModifiedAt: to.Ptr("2018-06-06T12:35:09Z"),
// ModifiedBy: to.Ptr("System"),
// NewValue: to.Ptr(""),
// OldValue: to.Ptr(""),
// }},
// SmartGroupID: to.Ptr("a808445e-bb38-4751-85c2-1b109ccc1059"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.AlertsManagement;
using Azure.ResourceManager.AlertsManagement.Models;
// Generated from example definition: specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2019-05-05-preview/examples/SmartGroups_History.json
// this example is just showing the usage of "SmartGroups_GetHistory" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this SmartGroupResource created on azure
// for more information of creating SmartGroupResource, please refer to the document of SmartGroupResource
string subscriptionId = "9e261de7-c804-4b9d-9ebf-6f50fe350a9a";
Guid smartGroupId = Guid.Parse("a808445e-bb38-4751-85c2-1b109ccc1059");
ResourceIdentifier smartGroupResourceId = SmartGroupResource.CreateResourceIdentifier(subscriptionId, smartGroupId);
SmartGroupResource smartGroup = client.GetSmartGroupResource(smartGroupResourceId);
// invoke the operation
SmartGroupModification result = await smartGroup.GetHistoryAsync();
Console.WriteLine($"Succeeded: {result}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
{
"properties": {
"smartGroupId": "a808445e-bb38-4751-85c2-1b109ccc1059",
"modifications": [
{
"modificationEvent": "SmartGroupCreated",
"oldValue": "",
"newValue": "",
"modifiedAt": "2018-06-06T12:35:09Z",
"modifiedBy": "System",
"comments": "",
"description": "New Smart Group is created"
}
]
},
"id": "/subscriptions/9e261de7-c804-4b9d-9ebf-6f50fe350a9a/providers/Microsoft.AlertsManagement/smartGroups/a808445e-bb38-4751-85c2-1b109ccc1059/history/default",
"type": "Microsoft.AlertsManagement/alerts",
"name": "cpu alert"
}
Definitions
api-version
client API version
Name |
Type |
Description |
2019-05-05-preview
|
string
|
|
errorResponse
An error response from the service.
errorResponseBody
Details of error response.
Name |
Type |
Description |
code
|
string
|
Error code, intended to be consumed programmatically.
|
details
|
errorResponseBody[]
|
A list of additional details about the error.
|
message
|
string
|
Description of the error, intended for display in user interface.
|
target
|
string
|
Target of the particular error, for example name of the property.
|
smartGroupModification
Alert Modification details
Name |
Type |
Description |
id
|
string
|
Azure resource Id
|
name
|
string
|
Azure resource name
|
properties
|
smartGroupModificationProperties
|
Properties of the smartGroup modification item.
|
type
|
string
|
Azure resource type
|
SmartGroupModificationEvent
Reason for the modification
Name |
Type |
Description |
AlertAdded
|
string
|
|
AlertRemoved
|
string
|
|
SmartGroupCreated
|
string
|
|
StateChange
|
string
|
|
smartGroupModificationItem
smartGroup modification item.
Name |
Type |
Description |
comments
|
string
|
Modification comments
|
description
|
string
|
Description of the modification
|
modificationEvent
|
SmartGroupModificationEvent
|
Reason for the modification
|
modifiedAt
|
string
|
Modified date and time
|
modifiedBy
|
string
|
Modified user details (Principal client name)
|
newValue
|
string
|
New value
|
oldValue
|
string
|
Old value
|
smartGroupModificationProperties
Properties of the smartGroup modification item.
Name |
Type |
Description |
modifications
|
smartGroupModificationItem[]
|
Modification details
|
nextLink
|
string
|
URL to fetch the next set of results.
|
smartGroupId
|
string
|
Unique Id of the smartGroup for which the history is being retrieved
|