|
| 1 | +import "@azure-tools/typespec-azure-core"; |
| 2 | +import "@azure-tools/typespec-azure-resource-manager"; |
| 3 | +import "@typespec/openapi"; |
| 4 | +import "@typespec/rest"; |
| 5 | +import "./models.tsp"; |
| 6 | + |
| 7 | +using TypeSpec.Rest; |
| 8 | +using Azure.ResourceManager; |
| 9 | +using TypeSpec.Http; |
| 10 | +using TypeSpec.OpenAPI; |
| 11 | + |
| 12 | +namespace Microsoft.AlertsManagement; |
| 13 | +/** |
| 14 | + * A Tenant Activity Log Alert rule resource. |
| 15 | + */ |
| 16 | +#suppress "@azure-tools/typespec-azure-core/no-legacy-usage" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" |
| 17 | +model TenantActivityLogAlertResource |
| 18 | + is Azure.ResourceManager.Legacy.TrackedResourceWithOptionalLocation< |
| 19 | + AlertRuleProperties, |
| 20 | + false |
| 21 | + > { |
| 22 | + ...ResourceNameParameter< |
| 23 | + Resource = TenantActivityLogAlertResource, |
| 24 | + KeyName = "alertRuleName", |
| 25 | + SegmentName = "tenantActivityLogAlerts", |
| 26 | + NamePattern = "^[-\\w\\._\\(\\)]+$" |
| 27 | + >; |
| 28 | +} |
| 29 | + |
| 30 | +@armResourceOperations |
| 31 | +interface TenantActivityLogAlertResources { |
| 32 | + /** |
| 33 | + * Get a list of all Tenant Activity Log Alert rules in the tenant. |
| 34 | + */ |
| 35 | + listByTenant is Extension.ListByTarget< |
| 36 | + Extension.Tenant, |
| 37 | + TenantActivityLogAlertResource, |
| 38 | + Response = ArmResponse<TenantAlertRuleList> |
| 39 | + >; |
| 40 | + |
| 41 | + /** |
| 42 | + * Get Tenant Activity Log Alert rule. |
| 43 | + */ |
| 44 | + get is Extension.Read<ManagementGroup, TenantActivityLogAlertResource>; |
| 45 | + |
| 46 | + /** |
| 47 | + * Create a new Tenant Activity Log Alert rule or update an existing one. |
| 48 | + */ |
| 49 | + createOrUpdate is Extension.CreateOrReplaceSync< |
| 50 | + ManagementGroup, |
| 51 | + TenantActivityLogAlertResource |
| 52 | + >; |
| 53 | + |
| 54 | + /** |
| 55 | + * 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. |
| 56 | + */ |
| 57 | + @patch(#{ implicitOptionality: false }) |
| 58 | + update is Extension.CustomPatchSync< |
| 59 | + ManagementGroup, |
| 60 | + TenantActivityLogAlertResource, |
| 61 | + PatchModel = TenantAlertRulePatchObject |
| 62 | + >; |
| 63 | + |
| 64 | + /** |
| 65 | + * Delete a Tenant Activity Log Alert rule. |
| 66 | + */ |
| 67 | + delete is Extension.DeleteSync< |
| 68 | + ManagementGroup, |
| 69 | + TenantActivityLogAlertResource |
| 70 | + >; |
| 71 | + |
| 72 | + /** |
| 73 | + * Get a list of all Tenant Activity Log Alert rules in a management group. |
| 74 | + */ |
| 75 | + listByManagementGroup is Extension.ListByTarget< |
| 76 | + ManagementGroup, |
| 77 | + TenantActivityLogAlertResource, |
| 78 | + Response = ArmResponse<TenantAlertRuleList> |
| 79 | + >; |
| 80 | +} |
| 81 | + |
| 82 | +@@doc(TenantActivityLogAlertResource.name, |
| 83 | + "The name of the Tenant Activity Log Alert rule." |
| 84 | +); |
| 85 | +@@doc(TenantActivityLogAlertResource.properties, |
| 86 | + "The Activity Log Alert rule properties of the resource." |
| 87 | +); |
| 88 | +@@doc(TenantActivityLogAlertResources.createOrUpdate::parameters.resource, |
| 89 | + "The Tenant Activity Log Alert rule to create or use for the update." |
| 90 | +); |
| 91 | +@@doc(TenantActivityLogAlertResources.update::parameters.properties, |
| 92 | + "Parameters supplied to the operation." |
| 93 | +); |
0 commit comments