Skip to content

Commit 95b6443

Browse files
committed
TypeSpec migrated from swagger
1 parent dfef10d commit 95b6443

61 files changed

Lines changed: 5046 additions & 474 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
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.Insights;
13+
/**
14+
* The diagnostic settings category resource.
15+
*/
16+
@extensionResource
17+
model DiagnosticSettingsCategoryResource
18+
is Azure.ResourceManager.ExtensionResource<DiagnosticSettingsCategory> {
19+
...ResourceNameParameter<
20+
Resource = DiagnosticSettingsCategoryResource,
21+
KeyName = "name",
22+
SegmentName = "diagnosticSettingsCategories",
23+
NamePattern = ""
24+
>;
25+
}
26+
27+
@armResourceOperations(#{ omitTags: true })
28+
interface DiagnosticSettingsCategoryResources {
29+
/**
30+
* Gets the diagnostic settings category for the specified resource.
31+
*/
32+
#suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations"
33+
@operationId("DiagnosticSettingsCategory_Get")
34+
@tag("DiagnosticSettingsCategories")
35+
get is Extension.Read<
36+
Extension.ScopeParameter,
37+
DiagnosticSettingsCategoryResource,
38+
Error = ErrorResponse
39+
>;
40+
41+
/**
42+
* Lists the diagnostic settings categories for the specified resource.
43+
*/
44+
#suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations"
45+
@operationId("DiagnosticSettingsCategory_List")
46+
@tag("DiagnosticSettingsCategories")
47+
list is Extension.ListByTarget<
48+
Extension.ScopeParameter,
49+
DiagnosticSettingsCategoryResource,
50+
Response = ArmResponse<DiagnosticSettingsCategoryResourceCollection>,
51+
Error = ErrorResponse
52+
>;
53+
}
54+
55+
@@doc(
56+
DiagnosticSettingsCategoryResource.name,
57+
"The name of the diagnostic setting."
58+
);
59+
@@doc(
60+
DiagnosticSettingsCategoryResource.properties,
61+
"The properties of a Diagnostic Settings Category."
62+
);
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
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.Insights;
13+
/**
14+
* The diagnostic setting resource.
15+
*/
16+
@extensionResource
17+
model DiagnosticSettingsResource
18+
is Azure.ResourceManager.ExtensionResource<DiagnosticSettings> {
19+
...ResourceNameParameter<
20+
Resource = DiagnosticSettingsResource,
21+
KeyName = "name",
22+
SegmentName = "diagnosticSettings",
23+
NamePattern = ""
24+
>;
25+
}
26+
27+
@armResourceOperations(#{ omitTags: true })
28+
interface DiagnosticSettingsResources {
29+
/**
30+
* Gets the active diagnostic settings for the specified resource.
31+
*/
32+
#suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations"
33+
@operationId("DiagnosticSettings_Get")
34+
@tag("DiagnosticSettings")
35+
get is Extension.Read<
36+
Extension.ScopeParameter,
37+
DiagnosticSettingsResource,
38+
Error = ErrorResponse
39+
>;
40+
41+
/**
42+
* Creates or updates diagnostic settings for the specified resource.
43+
*/
44+
#suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations"
45+
#suppress "@azure-tools/typespec-azure-resource-manager/arm-put-operation-response-codes" "For backward compatibility"
46+
@operationId("DiagnosticSettings_CreateOrUpdate")
47+
@tag("DiagnosticSettings")
48+
createOrUpdate is Extension.CreateOrReplaceSync<
49+
Extension.ScopeParameter,
50+
DiagnosticSettingsResource,
51+
Response = ArmResourceUpdatedResponse<DiagnosticSettingsResource>,
52+
Error = ErrorResponse
53+
>;
54+
55+
/**
56+
* Deletes existing diagnostic settings for the specified resource.
57+
*/
58+
#suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations"
59+
@operationId("DiagnosticSettings_Delete")
60+
@tag("DiagnosticSettings")
61+
delete is Extension.DeleteSync<
62+
Extension.ScopeParameter,
63+
DiagnosticSettingsResource,
64+
Error = ErrorResponse
65+
>;
66+
67+
/**
68+
* Gets the active diagnostic settings list for the specified resource.
69+
*/
70+
#suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations"
71+
@operationId("DiagnosticSettings_List")
72+
@tag("DiagnosticSettings")
73+
list is Extension.ListByTarget<
74+
Extension.ScopeParameter,
75+
DiagnosticSettingsResource,
76+
Response = ArmResponse<DiagnosticSettingsResourceCollection>,
77+
Error = ErrorResponse
78+
>;
79+
}
80+
81+
@@doc(DiagnosticSettingsResource.name, "The name of the diagnostic setting.");
82+
@@doc(
83+
DiagnosticSettingsResource.properties,
84+
"Properties of a Diagnostic Settings Resource."
85+
);
86+
@@doc(
87+
DiagnosticSettingsResources.createOrUpdate::parameters.resource,
88+
"Parameters supplied to the operation."
89+
);
90+
@@key(Extension.ScopeParameter.scope, "resourceUri");
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import "@azure-tools/typespec-client-generator-core";
2+
3+
using Azure.ClientGenerator.Core;
4+
using Microsoft.Insights;
5+
6+
@@clientLocation(DiagnosticSettingsResources.get, "DiagnosticSettings");
7+
@@clientLocation(DiagnosticSettingsResources.createOrUpdate,
8+
"DiagnosticSettings"
9+
);
10+
@@clientName(DiagnosticSettingsResources.createOrUpdate::parameters.resource,
11+
"parameters"
12+
);
13+
@@clientLocation(DiagnosticSettingsResources.delete, "DiagnosticSettings");
14+
@@clientLocation(DiagnosticSettingsResources.list, "DiagnosticSettings");
15+
#suppress "@azure-tools/typespec-azure-core/no-legacy-usage" "Property flatten for SDK backward compatibility."
16+
@@Legacy.flattenProperty(DiagnosticSettingsResource.properties);
17+
18+
@@clientLocation(DiagnosticSettingsCategoryResources.get,
19+
"DiagnosticSettingsCategory"
20+
);
21+
@@clientLocation(DiagnosticSettingsCategoryResources.list,
22+
"DiagnosticSettingsCategory"
23+
);
24+
#suppress "@azure-tools/typespec-azure-core/no-legacy-usage" "Property flatten for SDK backward compatibility."
25+
@@Legacy.flattenProperty(DiagnosticSettingsCategoryResource.properties);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
{
2+
"parameters": {
3+
"name": "mysetting",
4+
"api-version": "2021-05-01-preview",
5+
"parameters": {
6+
"properties": {
7+
"eventHubAuthorizationRuleId": "/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/authorizationrules/myrule",
8+
"eventHubName": "myeventhub",
9+
"logAnalyticsDestinationType": "Dedicated",
10+
"logs": [
11+
{
12+
"categoryGroup": "allLogs",
13+
"enabled": true,
14+
"retentionPolicy": {
15+
"days": 0,
16+
"enabled": false
17+
}
18+
}
19+
],
20+
"marketplacePartnerId": "/subscriptions/abcdeabc-1234-1234-ab12-123a1234567a/resourceGroups/test-rg/providers/Microsoft.Datadog/monitors/dd1",
21+
"metrics": [
22+
{
23+
"category": "WorkflowMetrics",
24+
"enabled": true,
25+
"retentionPolicy": {
26+
"days": 0,
27+
"enabled": false
28+
}
29+
}
30+
],
31+
"storageAccountId": "/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1",
32+
"workspaceId": ""
33+
}
34+
},
35+
"resourceUri": "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6"
36+
},
37+
"responses": {
38+
"200": {
39+
"body": {
40+
"name": "mysetting",
41+
"type": "Microsoft.Insights/diagnosticSettings",
42+
"id": "/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6/providers/microsoft.insights/diagnosticSettings/mysetting",
43+
"properties": {
44+
"eventHubAuthorizationRuleId": "/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/authorizationrules/myrule",
45+
"eventHubName": "myeventhub",
46+
"logAnalyticsDestinationType": "Dedicated",
47+
"logs": [
48+
{
49+
"categoryGroup": "allLogs",
50+
"enabled": true,
51+
"retentionPolicy": {
52+
"days": 0,
53+
"enabled": false
54+
}
55+
}
56+
],
57+
"marketplacePartnerId": "/subscriptions/abcdeabc-1234-1234-ab12-123a1234567a/resourceGroups/test-rg/providers/Microsoft.Datadog/monitors/dd1",
58+
"metrics": [
59+
{
60+
"category": "WorkflowMetrics",
61+
"enabled": true,
62+
"retentionPolicy": {
63+
"days": 0,
64+
"enabled": false
65+
}
66+
}
67+
],
68+
"storageAccountId": "/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1",
69+
"workspaceId": ""
70+
}
71+
},
72+
"headers": {}
73+
}
74+
},
75+
"operationId": "DiagnosticSettings_CreateOrUpdate",
76+
"title": "Creates or Updates the diagnostic setting"
77+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
{
2+
"parameters": {
3+
"name": "mysetting",
4+
"api-version": "2021-05-01-preview",
5+
"parameters": {
6+
"properties": {
7+
"eventHubAuthorizationRuleId": "/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/authorizationrules/myrule",
8+
"eventHubName": "myeventhub",
9+
"logAnalyticsDestinationType": "Dedicated",
10+
"logs": [
11+
{
12+
"category": "WorkflowRuntime",
13+
"enabled": true,
14+
"retentionPolicy": {
15+
"days": 0,
16+
"enabled": false
17+
}
18+
}
19+
],
20+
"marketplacePartnerId": "/subscriptions/abcdeabc-1234-1234-ab12-123a1234567a/resourceGroups/test-rg/providers/Microsoft.Datadog/monitors/dd1",
21+
"metrics": [
22+
{
23+
"category": "WorkflowMetrics",
24+
"enabled": true,
25+
"retentionPolicy": {
26+
"days": 0,
27+
"enabled": false
28+
}
29+
}
30+
],
31+
"storageAccountId": "/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1",
32+
"workspaceId": ""
33+
}
34+
},
35+
"resourceUri": "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6"
36+
},
37+
"responses": {
38+
"200": {
39+
"body": {
40+
"name": "mysetting",
41+
"type": "",
42+
"id": "/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6/diagnosticSettings/mysetting",
43+
"properties": {
44+
"eventHubAuthorizationRuleId": "/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/authorizationrules/myrule",
45+
"eventHubName": "myeventhub",
46+
"logAnalyticsDestinationType": "Dedicated",
47+
"logs": [
48+
{
49+
"category": "WorkflowRuntime",
50+
"enabled": true,
51+
"retentionPolicy": {
52+
"days": 0,
53+
"enabled": false
54+
}
55+
}
56+
],
57+
"marketplacePartnerId": "/subscriptions/abcdeabc-1234-1234-ab12-123a1234567a/resourceGroups/test-rg/providers/Microsoft.Datadog/monitors/dd1",
58+
"metrics": [
59+
{
60+
"category": "WorkflowMetrics",
61+
"enabled": true,
62+
"retentionPolicy": {
63+
"days": 0,
64+
"enabled": false
65+
}
66+
}
67+
],
68+
"storageAccountId": "/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1",
69+
"workspaceId": ""
70+
}
71+
},
72+
"headers": {}
73+
}
74+
},
75+
"operationId": "DiagnosticSettings_CreateOrUpdate",
76+
"title": "Creates or Updates the diagnostic setting for category"
77+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"parameters": {
3+
"name": "mysetting",
4+
"api-version": "2021-05-01-preview",
5+
"resourceUri": "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6"
6+
},
7+
"responses": {
8+
"200": {},
9+
"204": {}
10+
},
11+
"operationId": "DiagnosticSettings_Delete",
12+
"title": "Deletes the diagnostic setting"
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"parameters": {
3+
"name": "mysetting",
4+
"api-version": "2021-05-01-preview",
5+
"resourceUri": "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6"
6+
},
7+
"responses": {
8+
"200": {
9+
"body": {
10+
"name": "mysetting",
11+
"type": "Microsoft.Insights/diagnosticSettings",
12+
"id": "/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6/providers/microsoft.insights/diagnosticSettings/mysetting",
13+
"properties": {
14+
"eventHubAuthorizationRuleId": "/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/authorizationrules/myrule",
15+
"logs": [
16+
{
17+
"categoryGroup": "allLogs",
18+
"enabled": true,
19+
"retentionPolicy": {
20+
"days": 0,
21+
"enabled": false
22+
}
23+
}
24+
],
25+
"marketplacePartnerId": "/subscriptions/abcdeabc-1234-1234-ab12-123a1234567a/resourceGroups/test-rg/providers/Microsoft.Datadog/monitors/dd1",
26+
"metrics": [
27+
{
28+
"category": "WorkflowMetrics",
29+
"enabled": true,
30+
"retentionPolicy": {
31+
"days": 0,
32+
"enabled": false
33+
}
34+
}
35+
],
36+
"storageAccountId": "/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1",
37+
"workspaceId": ""
38+
}
39+
},
40+
"headers": {}
41+
}
42+
},
43+
"operationId": "DiagnosticSettings_Get",
44+
"title": "Gets the diagnostic setting"
45+
}

0 commit comments

Comments
 (0)