Skip to content
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,93 @@
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";
import "@typespec/openapi";
import "@typespec/rest";
import "./models.tsp";

using TypeSpec.Rest;
using Azure.ResourceManager;
using TypeSpec.Http;
using TypeSpec.OpenAPI;

namespace Microsoft.AlertsManagement;
/**
* A Tenant Activity Log Alert rule resource.
*/
#suppress "@azure-tools/typespec-azure-core/no-legacy-usage" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
model TenantActivityLogAlertResource
is Azure.ResourceManager.Legacy.TrackedResourceWithOptionalLocation<
AlertRuleProperties,
false
> {
...ResourceNameParameter<
Resource = TenantActivityLogAlertResource,
KeyName = "alertRuleName",
SegmentName = "tenantActivityLogAlerts",
NamePattern = "^[-\\w\\._\\(\\)]+$"
>;
}

@armResourceOperations
interface TenantActivityLogAlertResources {
/**
* Get a list of all Tenant Activity Log Alert rules in the tenant.
*/
listByTenant is Extension.ListByTarget<
Extension.Tenant,
TenantActivityLogAlertResource,
Response = ArmResponse<TenantAlertRuleList>
>;

/**
* Get Tenant Activity Log Alert rule.
*/
get is Extension.Read<ManagementGroup, TenantActivityLogAlertResource>;

/**
* Create a new Tenant Activity Log Alert rule or update an existing one.
*/
createOrUpdate is Extension.CreateOrReplaceSync<
ManagementGroup,
TenantActivityLogAlertResource
>;

/**
* Updates 'tags' and 'enabled' fields in an existing Tenant Alert rule. This method is used to update the Alert rule tags, and to enable or disable the Alert rule. To update other fields use CreateOrUpdate operation.
*/
@patch(#{ implicitOptionality: false })
update is Extension.CustomPatchSync<
ManagementGroup,
TenantActivityLogAlertResource,
PatchModel = TenantAlertRulePatchObject
>;

/**
* Delete a Tenant Activity Log Alert rule.
*/
delete is Extension.DeleteSync<
ManagementGroup,
TenantActivityLogAlertResource
>;

/**
* Get a list of all Tenant Activity Log Alert rules in a management group.
*/
listByManagementGroup is Extension.ListByTarget<
ManagementGroup,
TenantActivityLogAlertResource,
Response = ArmResponse<TenantAlertRuleList>
>;
}

@@doc(TenantActivityLogAlertResource.name,
"The name of the Tenant Activity Log Alert rule."
);
@@doc(TenantActivityLogAlertResource.properties,
"The Activity Log Alert rule properties of the resource."
);
@@doc(TenantActivityLogAlertResources.createOrUpdate::parameters.resource,
"The Tenant Activity Log Alert rule to create or use for the update."
);
@@doc(TenantActivityLogAlertResources.update::parameters.properties,
"Parameters supplied to the operation."
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import "@azure-tools/typespec-client-generator-core";

using Azure.ClientGenerator.Core;
using Microsoft.AlertsManagement;

#suppress "@azure-tools/typespec-azure-core/no-legacy-usage" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@@Legacy.flattenProperty(TenantAlertRulePatchObject.properties);

@@clientLocation(TenantActivityLogAlertResources.get,
"TenantActivityLogAlerts"
);
@@clientLocation(TenantActivityLogAlertResources.createOrUpdate,
"TenantActivityLogAlerts"
);
@@clientName(TenantActivityLogAlertResources.createOrUpdate::parameters.resource,
"tenantActivityLogAlertRule"
);
@@clientLocation(TenantActivityLogAlertResources.update,
"TenantActivityLogAlerts"
);
@@clientName(TenantActivityLogAlertResources.update::parameters.properties,
"tenantActivityLogAlertRulePatch"
);
@@clientLocation(TenantActivityLogAlertResources.delete,
"TenantActivityLogAlerts"
);
@@clientLocation(TenantActivityLogAlertResources.listByManagementGroup,
"TenantActivityLogAlerts"
);
@@clientLocation(TenantActivityLogAlertResources.listByTenant,
"TenantActivityLogAlerts"
);
#suppress "@azure-tools/typespec-azure-core/no-legacy-usage" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@@Legacy.flattenProperty(TenantActivityLogAlertResource.properties);
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import "./main.tsp";
import "@azure-tools/typespec-client-generator-core";

using Azure.ClientGenerator.Core;

@@clientName(Microsoft.AlertsManagement,
"TenantActivityLogAlertsMgmtClient",
"python"
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
{
"parameters": {
"alertRuleName": "SampleActivityLogAlertSHRuleOnTenantLevel",
"api-version": "2023-04-01-preview",
"managementGroupName": "72f988bf-86f1-41af-91ab-2d7cd011db47",
"tenantActivityLogAlertRule": {
"location": "Global",
"properties": {
"description": "Description of sample Activity Log Alert service health rule on tenant level events.",
"actions": {
"actionGroups": [
{
"actionGroupId": "/providers/Microsoft.Management/ManagementGroups/72f988bf-86f1-41af-91ab-2d7cd011db47/providers/Microsoft.Insights/actionGroups/SampleActionGroup",
"actionProperties": {
"Email.Title": "my email title"
},
"webhookProperties": {
"sampleWebhookProperty": "SamplePropertyValue"
}
}
]
},
"condition": {
"allOf": [
{
"equals": "ServiceHealth",
"field": "category"
}
]
},
"enabled": true,
"tenantScope": "72f988bf-86f1-41af-91ab-2d7cd011db47"
},
"tags": {}
}
},
"responses": {
"200": {
"body": {
"name": "SampleActivityLogAlertSHRuleOnTenantLevel",
"type": "Microsoft.AlertsManagement/TenantActivityLogAlerts",
"id": "/providers/Microsoft.Management/ManagementGroups/72f988bf-86f1-41af-91ab-2d7cd011db47/providers/Microsoft.AlertsManagement/TenantActivityLogAlerts/SampleActivityLogAlertSHRuleOnTenantLevel",
"location": "Global",
"properties": {
"description": "Description of sample Activity Log Alert service health rule on tenant level events.",
"actions": {
"actionGroups": [
{
"actionGroupId": "/providers/Microsoft.Management/ManagementGroups/72f988bf-86f1-41af-91ab-2d7cd011db47/providers/Microsoft.Insights/actionGroups/SampleActionGroup",
"actionProperties": {
"Email.Title": "my email title"
},
"webhookProperties": {
"sampleWebhookProperty": "SamplePropertyValue"
}
}
]
},
"condition": {
"allOf": [
{
"equals": "ServiceHealth",
"field": "category"
}
]
},
"enabled": true,
"tenantScope": "72f988bf-86f1-41af-91ab-2d7cd011db47"
},
"tags": {}
},
"headers": {}
},
"201": {
"body": {
"name": "SampleActivityLogAlertSHRuleOnTenantLevel",
"type": "Microsoft.AlertsManagement/TenantActivityLogAlerts",
"id": "/providers/Microsoft.Management/ManagementGroups/72f988bf-86f1-41af-91ab-2d7cd011db47/providers/Microsoft.AlertsManagement/TenantActivityLogAlerts/SampleActivityLogAlertSHRuleOnTenantLevel",
"location": "Global",
"properties": {
"description": "Description of sample Activity Log Alert service health rule on tenant level events.",
"actions": {
"actionGroups": [
{
"actionGroupId": "/providers/Microsoft.Management/ManagementGroups/72f988bf-86f1-41af-91ab-2d7cd011db47/providers/Microsoft.Insights/actionGroups/SampleActionGroup",
"actionProperties": {
"Email.Title": "my email title"
},
"webhookProperties": {
"sampleWebhookProperty": "SamplePropertyValue"
}
}
]
},
"condition": {
"allOf": [
{
"equals": "ServiceHealth",
"field": "category"
}
]
},
"enabled": true,
"tenantScope": "72f988bf-86f1-41af-91ab-2d7cd011db47"
},
"tags": {}
},
"headers": {}
}
},
"operationId": "TenantActivityLogAlerts_CreateOrUpdate",
"title": "Create or update a Tenant Activity Log Alert rule for tenant level events"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"parameters": {
"alertRuleName": "SampleActivityLogAlertSHRuleOnTenantLevel",
"api-version": "2023-04-01-preview",
"managementGroupName": "72f988bf-86f1-41af-91ab-2d7cd011db47"
},
"responses": {
"200": {},
"204": {}
},
"operationId": "TenantActivityLogAlerts_Delete",
"title": "Delete a Tenant Activity Log Alert rule"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"parameters": {
"alertRuleName": "SampleActivityLogAlertSHRuleOnTenantLevel",
"api-version": "2023-04-01-preview",
"managementGroupName": "72f988bf-86f1-41af-91ab-2d7cd011db47"
},
"responses": {
"200": {
"body": {
"name": "SampleActivityLogAlertSHRuleOnTenantLevel",
"type": "Microsoft.AlertsManagement/TenantActivityLogAlerts",
"id": "/providers/Microsoft.Management/ManagementGroups/72f988bf-86f1-41af-91ab-2d7cd011db47/providers/Microsoft.AlertsManagement/TenantActivityLogAlerts/SampleActivityLogAlertSHRuleOnTenantLevel",
"location": "Global",
"properties": {
"description": "Description of sample Activity Log Alert service health rule on tenant level events.",
"actions": {
"actionGroups": [
{
"actionGroupId": "/providers/Microsoft.Management/ManagementGroups/72f988bf-86f1-41af-91ab-2d7cd011db47/providers/Microsoft.Insights/actionGroups/SampleActionGroup",
"actionProperties": {
"Email.Title": "my email title"
},
"webhookProperties": {
"sampleWebhookProperty": "SamplePropertyValue"
}
}
]
},
"condition": {
"allOf": [
{
"equals": "ServiceHealth",
"field": "category"
}
]
},
"enabled": true,
"tenantScope": "72f988bf-86f1-41af-91ab-2d7cd011db47"
},
"tags": {}
},
"headers": {}
}
},
"operationId": "TenantActivityLogAlerts_Get",
"title": "Get a Tenant Activity Log Alert rule"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"parameters": {
"api-version": "2023-04-01-preview",
"managementGroupName": "72f988bf-86f1-41af-91ab-2d7cd011db47"
},
"responses": {
"200": {
"body": {
"value": [
{
"name": "SampleActivityLogAlertSHRuleOnTenantLevel",
"type": "Microsoft.AlertsManagement/TenantActivityLogAlerts",
"id": "/providers/Microsoft.Management/ManagementGroups/72f988bf-86f1-41af-91ab-2d7cd011db47/providers/Microsoft.AlertsManagement/TenantActivityLogAlerts/SampleActivityLogAlertSHRuleOnTenantLevel",
"location": "Global",
"properties": {
"description": "Description of sample Activity Log Alert service health rule on tenant level events.",
"actions": {
"actionGroups": [
{
"actionGroupId": "/providers/Microsoft.Management/ManagementGroups/72f988bf-86f1-41af-91ab-2d7cd011db47/providers/Microsoft.Insights/actionGroups/SampleActionGroup",
"actionProperties": {
"Email.Title": "my email title"
},
"webhookProperties": {
"sampleWebhookProperty": "SamplePropertyValue"
}
}
]
},
"condition": {
"allOf": [
{
"equals": "ServiceHealth",
"field": "category"
}
]
},
"enabled": true,
"tenantScope": "72f988bf-86f1-41af-91ab-2d7cd011db47"
},
"tags": {}
}
]
},
"headers": {}
}
},
"operationId": "TenantActivityLogAlerts_ListByManagementGroup",
"title": "List Activity Log Alerts by management group"
}
Loading
Loading