forked from Azure/azure-rest-api-specs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMetricAlertResource.tsp
More file actions
172 lines (156 loc) · 4.28 KB
/
Copy pathMetricAlertResource.tsp
File metadata and controls
172 lines (156 loc) · 4.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
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;
using Microsoft.Common;
namespace MetricAlertApi;
/**
* The metric alert resource.
*/
model MetricAlertResource
is Azure.ResourceManager.TrackedResource<MetricAlertProperties, false> {
...ResourceNameParameter<
Resource = MetricAlertResource,
KeyName = "ruleName",
SegmentName = "metricAlerts",
NamePattern = ""
>;
/**
* The identity of the resource.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
identity?: Identity;
}
alias MetricAlertResourcesOps = Azure.ResourceManager.Legacy.RoutedOperations<
MetricAlertResourcesParentParameters,
MetricAlertResourcesParameters,
ResourceRoute = #{
route: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Insights/metricAlerts/{ruleName}/status/{statusName}",
}
>;
alias MetricAlertResourcesParentParameters = {
...ApiVersionParameter;
...SubscriptionIdParameter;
...ResourceGroupParameter;
/**
* The name of the rule.
*/
@path
@segment("metricAlerts")
ruleName: string;
};
alias MetricAlertResourcesParameters = {
/**
* The name of the status.
*/
@path
@segment("status")
statusName: string;
};
@armResourceOperations(#{ omitTags: true, allowStaticRoutes: true })
interface MetricAlertResources {
/**
* Retrieve an alert rule definition.
*/
@tag("MetricAlerts")
get is ArmResourceRead<MetricAlertResource, Error = MetricAlertErrorResponse>;
/**
* Create or update a metric alert definition.
*/
@tag("MetricAlerts")
createOrUpdate is ArmResourceCreateOrReplaceSync<
MetricAlertResource,
Error = MetricAlertErrorResponse
>;
/**
* Update a metric alert definition.
*/
@patch(#{ implicitOptionality: false })
@tag("MetricAlerts")
update is ArmCustomPatchSync<
MetricAlertResource,
PatchModel = MetricAlertResourcePatch,
Error = MetricAlertErrorResponse
>;
/**
* Delete an alert rule definition.
*/
@tag("MetricAlerts")
delete is ArmResourceDeleteSync<
MetricAlertResource,
Error = MetricAlertErrorResponse
>;
/**
* Retrieve alert rule definitions in a resource group.
*/
@tag("MetricAlerts")
listByResourceGroup is ArmResourceListByParent<
MetricAlertResource,
Response = ArmResponse<MetricAlertResourceCollection>,
Error = MetricAlertErrorResponse
>;
/**
* Retrieve alert rule definitions in a subscription.
*/
@tag("MetricAlerts")
listBySubscription is ArmListBySubscription<
MetricAlertResource,
Response = ArmResponse<MetricAlertResourceCollection>,
Error = MetricAlertErrorResponse
>;
/**
* Retrieve an alert rule status.
*/
@action("status")
@tag("MetricAlertsStatus")
@segment("")
list is Azure.ResourceManager.Legacy.ArmListSinglePageByParent<
MetricAlertResource,
Response = ArmResponse<MetricAlertStatusCollection>,
Parameters = {
/**
* The name of the rule.
*/
@path
@segment("metricAlerts")
ruleName: string;
},
Error = MetricAlertErrorResponse
>;
/**
* Retrieve an alert rule status.
*/
@tag("MetricAlertsStatus")
@route("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}/status/{statusName}")
listByName is MetricAlertResourcesOps.ListSinglePage<
MetricAlertResource,
Response = ArmResponse<MetricAlertStatusCollection>,
Parameters = {
/**
* The name of the status.
*/
@path
@segment("status")
statusName: string;
},
OverrideErrorType = MetricAlertErrorResponse
>;
}
@@doc(MetricAlertResource.name, "The name of the rule.");
@@doc(
MetricAlertResource.properties,
"The alert rule properties of the resource."
);
@@doc(
MetricAlertResources.createOrUpdate::parameters.resource,
"The parameters of the rule to create or update."
);
@@doc(
MetricAlertResources.update::parameters.properties,
"The parameters of the rule to update."
);