-
Notifications
You must be signed in to change notification settings - Fork 5.8k
[TSP Migration]--datadog #34281
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
[TSP Migration]--datadog #34281
Changes from 5 commits
50cab8f
69812e6
23d3875
5386953
3fb2691
bbe71f7
4e30424
e9ddc49
2a21db9
f4105f7
e82088f
bb7b192
d480385
ecbeb46
a7cbf79
846483b
f3333a7
04b7287
fa7b056
5fbf01c
8ab2204
1f0a9d0
9ee2977
d26919a
c21e550
40921b4
3dbc32a
0d3f8aa
5e357c5
2756877
d5c8748
ac9cc3e
80be29c
5f8f3dc
e1d953d
bf65c02
397b66d
c37407d
13ea7d0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,191 @@ | ||
| 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.Datadog; | ||
|
|
||
| model DatadogMonitorResource | ||
| is Azure.ResourceManager.TrackedResource<MonitorProperties> { | ||
| ...ResourceNameParameter< | ||
| Resource = DatadogMonitorResource, | ||
| KeyName = "monitorName", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove since this is the default value. |
||
| SegmentName = "monitors", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove since this is the default value. |
||
| NamePattern = "" | ||
| >; | ||
| #suppress "@azure-tools/typespec-azure-core/documentation-required" "" | ||
| #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "For backward compatibility" | ||
| sku?: ResourceSku; | ||
| #suppress "@azure-tools/typespec-azure-core/documentation-required" "" | ||
| #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "For backward compatibility" | ||
| identity?: IdentityProperties; | ||
| } | ||
|
|
||
| @armResourceOperations | ||
| interface DatadogMonitorResources { | ||
| /** | ||
| * Get the properties of a specific monitor resource. | ||
| */ | ||
| #suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations" | ||
| @operationId("Monitors_Get") | ||
| get is ArmResourceRead<DatadogMonitorResource>; | ||
|
|
||
| /** | ||
| * Create a monitor resource. | ||
| */ | ||
| #suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations" | ||
| @operationId("Monitors_Create") | ||
| create is ArmResourceCreateOrReplaceAsync<DatadogMonitorResource>; | ||
|
|
||
| /** | ||
| * Update a monitor resource. | ||
| */ | ||
| #suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations" | ||
| @patch(#{ implicitOptionality: false }) | ||
| @operationId("Monitors_Update") | ||
| update is ArmCustomPatchAsync< | ||
| DatadogMonitorResource, | ||
| PatchModel = DatadogMonitorResourceUpdateParameters, | ||
| Response = ArmResponse<DatadogMonitorResource> | ArmResourceCreatedResponse< | ||
| DatadogMonitorResource, | ||
| LroHeaders = ArmAsyncOperationHeader<FinalResult = DatadogMonitorResource> & | ||
| Azure.Core.Foundations.RetryAfterHeader | ||
| > | ||
| >; | ||
|
|
||
| /** | ||
| * Delete a monitor resource. | ||
| */ | ||
| #suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations" | ||
| #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility" | ||
| @operationId("Monitors_Delete") | ||
| delete is ArmResourceDeleteWithoutOkAsync< | ||
| DatadogMonitorResource, | ||
| Response = ArmDeletedResponse | ArmDeleteAcceptedLroResponse | ArmDeletedNoContentResponse | ||
| >; | ||
|
|
||
| /** | ||
| * List all monitors under the specified resource group. | ||
| */ | ||
| #suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations" | ||
| @operationId("Monitors_ListByResourceGroup") | ||
| listByResourceGroup is ArmResourceListByParent< | ||
| DatadogMonitorResource, | ||
| Response = ArmResponse<DatadogMonitorResourceListResponse> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be a standard list response I assume. |
||
| >; | ||
|
|
||
| /** | ||
| * List all monitors under the specified subscription. | ||
| */ | ||
| #suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations" | ||
| @operationId("Monitors_List") | ||
| list is ArmListBySubscription< | ||
| DatadogMonitorResource, | ||
| Response = ArmResponse<DatadogMonitorResourceListResponse> | ||
| >; | ||
|
|
||
| /** | ||
| * List the api keys for a given monitor resource. | ||
| */ | ||
| #suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations" | ||
| @operationId("Monitors_ListApiKeys") | ||
| listApiKeys is ArmResourceActionSync< | ||
| DatadogMonitorResource, | ||
| void, | ||
| ArmResponse<DatadogApiKeyListResponse> | ||
| >; | ||
|
|
||
| /** | ||
| * Get the default api key. | ||
| */ | ||
| #suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations" | ||
| @operationId("Monitors_GetDefaultKey") | ||
| getDefaultKey is ArmResourceActionSync< | ||
| DatadogMonitorResource, | ||
| void, | ||
| ArmResponse<DatadogApiKey> | ||
| >; | ||
|
|
||
| /** | ||
| * Set the default api key. | ||
| */ | ||
| #suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations" | ||
| @operationId("Monitors_SetDefaultKey") | ||
| setDefaultKey is ArmResourceActionSync< | ||
| DatadogMonitorResource, | ||
| { | ||
| @bodyRoot | ||
| body?: DatadogApiKey; | ||
| }, | ||
| OkResponse | ||
| >; | ||
|
|
||
| /** | ||
| * List the hosts for a given monitor resource. | ||
| */ | ||
| #suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations" | ||
| @operationId("Monitors_ListHosts") | ||
| listHosts is ArmResourceActionSync< | ||
| DatadogMonitorResource, | ||
| void, | ||
| ArmResponse<DatadogHostListResponse> | ||
| >; | ||
|
|
||
| /** | ||
| * List all Azure resources associated to the same Datadog organization as the target resource. | ||
| */ | ||
| #suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations" | ||
| @operationId("Monitors_ListLinkedResources") | ||
| listLinkedResources is ArmResourceActionSync< | ||
| DatadogMonitorResource, | ||
| void, | ||
| ArmResponse<LinkedResourceListResponse> | ||
| >; | ||
|
|
||
| /** | ||
| * List the resources currently being monitored by the Datadog monitor resource. | ||
| */ | ||
| #suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations" | ||
| @operationId("Monitors_ListMonitoredResources") | ||
| listMonitoredResources is ArmResourceActionSync< | ||
| DatadogMonitorResource, | ||
| void, | ||
| ArmResponse<MonitoredResourceListResponse> | ||
| >; | ||
|
|
||
| /** | ||
| * Refresh the set password link and return a latest one. | ||
| */ | ||
| #suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations" | ||
| @operationId("Monitors_RefreshSetPasswordLink") | ||
| refreshSetPasswordLink is ArmResourceActionSync< | ||
| DatadogMonitorResource, | ||
| void, | ||
| ArmResponse<DatadogSetPasswordLink> | ||
| >; | ||
|
|
||
| /** | ||
| * Get marketplace and organization info mapped to the given monitor. | ||
| */ | ||
| #suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations" | ||
| @action("getBillingInfo") | ||
| @operationId("BillingInfo_Get") | ||
| billingInfoGet is ArmResourceActionSync< | ||
| DatadogMonitorResource, | ||
| void, | ||
| ArmResponse<BillingInfoResponse> | ||
| >; | ||
| } | ||
|
|
||
| @@doc(DatadogMonitorResource.name, "Monitor resource name"); | ||
| @@doc(DatadogMonitorResource.properties, | ||
| "Properties specific to the monitor resource." | ||
| ); | ||
| @@doc(DatadogMonitorResources.create::parameters.resource, ""); | ||
| @@doc(DatadogMonitorResources.update::parameters.properties, ""); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| import "@azure-tools/typespec-azure-core"; | ||
| import "@azure-tools/typespec-azure-resource-manager"; | ||
| import "@typespec/openapi"; | ||
| import "@typespec/rest"; | ||
| import "./models.tsp"; | ||
| import "./DatadogMonitorResource.tsp"; | ||
|
|
||
| using TypeSpec.Rest; | ||
| using Azure.ResourceManager; | ||
| using TypeSpec.Http; | ||
| using TypeSpec.OpenAPI; | ||
|
|
||
| namespace Microsoft.Datadog; | ||
|
|
||
| @parentResource(DatadogMonitorResource) | ||
| model DatadogSingleSignOnResource | ||
| is Azure.ResourceManager.ProxyResource<DatadogSingleSignOnProperties> { | ||
| ...ResourceNameParameter< | ||
| Resource = DatadogSingleSignOnResource, | ||
| KeyName = "configurationName", | ||
| SegmentName = "singleSignOnConfigurations", | ||
| NamePattern = "" | ||
| >; | ||
| } | ||
|
|
||
| #suppress "@azure-tools/typespec-azure-resource-manager/no-resource-delete-operation" "" | ||
| @armResourceOperations | ||
| interface DatadogSingleSignOnResources { | ||
| /** | ||
| * Gets the datadog single sign-on resource for the given Monitor. | ||
| */ | ||
| #suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations" | ||
| @operationId("SingleSignOnConfigurations_Get") | ||
| get is ArmResourceRead<DatadogSingleSignOnResource>; | ||
|
|
||
| /** | ||
| * Configures single-sign-on for this resource. | ||
| */ | ||
| #suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations" | ||
| @operationId("SingleSignOnConfigurations_CreateOrUpdate") | ||
| createOrUpdate is ArmResourceCreateOrReplaceAsync<DatadogSingleSignOnResource>; | ||
|
|
||
| /** | ||
| * List the single sign-on configurations for a given monitor resource. | ||
| */ | ||
| #suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations" | ||
| @operationId("SingleSignOnConfigurations_List") | ||
| list is ArmResourceListByParent< | ||
| DatadogSingleSignOnResource, | ||
| Response = ArmResponse<DatadogSingleSignOnResourceListResponse> | ||
| >; | ||
| } | ||
|
|
||
| @@doc(DatadogSingleSignOnResource.name, "Configuration name"); | ||
| @@doc(DatadogSingleSignOnResource.properties, ""); | ||
| @@doc(DatadogSingleSignOnResources.createOrUpdate::parameters.resource, ""); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| import "@azure-tools/typespec-azure-core"; | ||
| import "@azure-tools/typespec-azure-resource-manager"; | ||
| import "@typespec/openapi"; | ||
| import "@typespec/rest"; | ||
| import "./models.tsp"; | ||
| import "./DatadogMonitorResource.tsp"; | ||
|
|
||
| using TypeSpec.Rest; | ||
| using Azure.ResourceManager; | ||
| using TypeSpec.Http; | ||
| using TypeSpec.OpenAPI; | ||
|
|
||
| namespace Microsoft.Datadog; | ||
| /** | ||
| * The request to update subscriptions needed to be monitored by the Datadog monitor resource. | ||
| */ | ||
| @parentResource(DatadogMonitorResource) | ||
| model MonitoredSubscriptionProperties | ||
| is Azure.ResourceManager.ProxyResource<SubscriptionList> { | ||
| ...ResourceNameParameter< | ||
| Resource = MonitoredSubscriptionProperties, | ||
| KeyName = "configurationName", | ||
| SegmentName = "monitoredSubscriptions", | ||
| NamePattern = "" | ||
| >; | ||
| } | ||
|
|
||
| @armResourceOperations | ||
| interface MonitoredSubscriptions { | ||
| /** | ||
| * List the subscriptions currently being monitored by the Datadog monitor resource. | ||
| */ | ||
| get is ArmResourceRead<MonitoredSubscriptionProperties>; | ||
|
|
||
| /** | ||
| * Add the subscriptions that should be monitored by the Datadog monitor resource. | ||
| */ | ||
| #suppress "@azure-tools/typespec-azure-resource-manager/arm-put-operation-response-codes" "For backward compatibility" | ||
| createorUpdate is ArmResourceCreateOrReplaceAsync< | ||
| MonitoredSubscriptionProperties, | ||
| Response = ArmResourceUpdatedResponse<MonitoredSubscriptionProperties> | ArmResourceCreatedResponse< | ||
| MonitoredSubscriptionProperties, | ||
| ArmLroLocationHeader & Azure.Core.Foundations.RetryAfterHeader | ||
|
pshao25 marked this conversation as resolved.
Outdated
|
||
| > | ArmAcceptedLroResponse | ||
| >; | ||
|
|
||
| /** | ||
| * Updates the subscriptions that are being monitored by the Datadog monitor resource | ||
| */ | ||
| @patch(#{ implicitOptionality: false }) | ||
| update is ArmCustomPatchAsync< | ||
| MonitoredSubscriptionProperties, | ||
| PatchModel = MonitoredSubscriptionProperties | ||
| >; | ||
|
|
||
| /** | ||
| * Updates the subscriptions that are being monitored by the Datadog monitor resource | ||
| */ | ||
| #suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility" | ||
| delete is ArmResourceDeleteWithoutOkAsync< | ||
| MonitoredSubscriptionProperties, | ||
| Response = ArmDeletedResponse | ArmDeleteAcceptedLroResponse | ArmDeletedNoContentResponse | ||
| >; | ||
|
|
||
| /** | ||
| * List the subscriptions currently being monitored by the Datadog monitor resource. | ||
| */ | ||
| list is ArmResourceListByParent< | ||
| MonitoredSubscriptionProperties, | ||
| Response = ArmResponse<MonitoredSubscriptionPropertiesList> | ||
| >; | ||
| } | ||
|
|
||
| @@doc(MonitoredSubscriptionProperties.name, | ||
| "The configuration name. Only 'default' value is supported." | ||
| ); | ||
| @@doc(MonitoredSubscriptionProperties.properties, | ||
| "The request to update subscriptions needed to be monitored by the Datadog monitor resource." | ||
| ); | ||
| @@doc(MonitoredSubscriptions.createorUpdate::parameters.resource, ""); | ||
| @@doc(MonitoredSubscriptions.update::parameters.properties, ""); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| import "@azure-tools/typespec-azure-core"; | ||
| import "@azure-tools/typespec-azure-resource-manager"; | ||
| import "@typespec/openapi"; | ||
| import "@typespec/rest"; | ||
| import "./models.tsp"; | ||
| import "./DatadogMonitorResource.tsp"; | ||
|
|
||
| using TypeSpec.Rest; | ||
| using Azure.ResourceManager; | ||
| using TypeSpec.Http; | ||
| using TypeSpec.OpenAPI; | ||
|
|
||
| namespace Microsoft.Datadog; | ||
| /** | ||
| * Capture logs and metrics of Azure resources based on ARM tags. | ||
| */ | ||
| @parentResource(DatadogMonitorResource) | ||
| model MonitoringTagRules | ||
| is Azure.ResourceManager.ProxyResource<MonitoringTagRulesProperties> { | ||
| ...ResourceNameParameter< | ||
| Resource = MonitoringTagRules, | ||
| KeyName = "ruleSetName", | ||
| SegmentName = "tagRules", | ||
| NamePattern = "" | ||
| >; | ||
| } | ||
|
|
||
| #suppress "@azure-tools/typespec-azure-resource-manager/no-resource-delete-operation" "" | ||
| @armResourceOperations | ||
| interface TagRules { | ||
| /** | ||
| * Get a tag rule set for a given monitor resource. | ||
| */ | ||
| get is ArmResourceRead<MonitoringTagRules>; | ||
|
|
||
| /** | ||
| * Create or update a tag rule set for a given monitor resource. | ||
| */ | ||
| #suppress "@azure-tools/typespec-azure-resource-manager/arm-put-operation-response-codes" "For backward compatibility" | ||
| createOrUpdate is ArmResourceCreateOrReplaceSync< | ||
| MonitoringTagRules, | ||
| Response = ArmResourceUpdatedResponse<MonitoringTagRules> | ||
| >; | ||
|
|
||
| /** | ||
| * List the tag rules for a given monitor resource. | ||
| */ | ||
| list is ArmResourceListByParent< | ||
| MonitoringTagRules, | ||
| Response = ArmResponse<MonitoringTagRulesListResponse> | ||
| >; | ||
| } | ||
|
|
||
| @@doc(MonitoringTagRules.name, "Rule set name"); | ||
| @@doc(MonitoringTagRules.properties, | ||
| "Definition of the properties for a TagRules resource." | ||
| ); | ||
| @@doc(TagRules.createOrUpdate::parameters.resource, ""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should use the canonical name for the resource type (
Monitor) and customize for client code/openapi by augmentation decorator.