Skip to content

Commit 7776ca8

Browse files
welovejdanieljurek
authored andcommitted
[TSP Migration]--powerbidedicated (#34282)
1 parent 168e32d commit 7776ca8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+4171
-1956
lines changed
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
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.PowerBIDedicated;
13+
/**
14+
* Represents an instance of an auto scale v-core resource.
15+
*/
16+
#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
17+
#suppress "@azure-tools/typespec-azure-core/no-private-usage" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
18+
#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
19+
@Azure.ResourceManager.Private.armResourceInternal(AutoScaleVCoreProperties)
20+
@TypeSpec.Http.Private.includeInapplicableMetadataInPayload(false)
21+
model AutoScaleVCore extends Azure.ResourceManager.Foundations.TrackedResource {
22+
...ResourceNameParameter<
23+
Resource = AutoScaleVCore,
24+
KeyName = "vcoreName",
25+
SegmentName = "autoScaleVCores",
26+
NamePattern = "^[-a-zA-Z0-9_]+$"
27+
>;
28+
29+
/**
30+
* The SKU of the auto scale v-core resource.
31+
*/
32+
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
33+
sku: AutoScaleVCoreSku;
34+
35+
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
36+
@doc("The resource-specific properties for this resource.")
37+
@Azure.ResourceManager.Private.armResourcePropertiesOptionality(true)
38+
properties: AutoScaleVCoreProperties;
39+
}
40+
41+
#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
42+
@armResourceOperations
43+
interface AutoScaleVCores {
44+
/**
45+
* Gets details about the specified auto scale v-core.
46+
*/
47+
get is ArmResourceRead<AutoScaleVCore, Error = ErrorResponse>;
48+
49+
/**
50+
* Provisions the specified auto scale v-core based on the configuration specified in the request.
51+
*/
52+
#suppress "@azure-tools/typespec-azure-resource-manager/arm-put-operation-response-codes" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
53+
create is ArmResourceCreateOrReplaceSync<
54+
AutoScaleVCore,
55+
Response = ArmResourceUpdatedResponse<AutoScaleVCore>,
56+
Error = ErrorResponse
57+
>;
58+
59+
/**
60+
* Updates the current state of the specified auto scale v-core.
61+
*/
62+
@patch(#{ implicitOptionality: false })
63+
update is ArmCustomPatchSync<
64+
AutoScaleVCore,
65+
PatchModel = AutoScaleVCoreUpdateParameters,
66+
Error = ErrorResponse
67+
>;
68+
69+
/**
70+
* Deletes the specified auto scale v-core.
71+
*/
72+
delete is ArmResourceDeleteSync<AutoScaleVCore, Error = ErrorResponse>;
73+
74+
/**
75+
* Gets all the auto scale v-cores for the given resource group.
76+
*/
77+
listByResourceGroup is ArmResourceListByParent<
78+
AutoScaleVCore,
79+
Response = ArmResponse<AutoScaleVCoreListResult>,
80+
Error = ErrorResponse
81+
>;
82+
83+
/**
84+
* Lists all the auto scale v-cores for the given subscription.
85+
*/
86+
listBySubscription is ArmListBySubscription<
87+
AutoScaleVCore,
88+
Response = ArmResponse<AutoScaleVCoreListResult>,
89+
Error = ErrorResponse
90+
>;
91+
}
92+
93+
@@maxLength(AutoScaleVCore.name, 63);
94+
@@minLength(AutoScaleVCore.name, 3);
95+
@@doc(AutoScaleVCore.name,
96+
"The name of the auto scale v-core. It must be a minimum of 3 characters, and a maximum of 63."
97+
);
98+
@@doc(AutoScaleVCore.properties,
99+
"Properties of an auto scale v-core resource."
100+
);
101+
@@doc(AutoScaleVCores.create::parameters.resource,
102+
"Contains the information used to provision the auto scale v-core."
103+
);
104+
@@doc(AutoScaleVCores.update::parameters.properties,
105+
"Request object that contains the updated information for the auto scale v-core."
106+
);
Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
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+
using Azure.ResourceManager.Private;
12+
13+
namespace Microsoft.PowerBIDedicated;
14+
/**
15+
* Represents an instance of a Dedicated Capacity resource.
16+
*/
17+
#suppress "@azure-tools/typespec-azure-core/no-private-usage" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
18+
#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
19+
@Azure.ResourceManager.Private.armResourceInternal(DedicatedCapacityProperties)
20+
@TypeSpec.Http.Private.includeInapplicableMetadataInPayload(false)
21+
model DedicatedCapacity
22+
extends Azure.ResourceManager.Foundations.TrackedResource {
23+
...ResourceNameParameter<
24+
Resource = DedicatedCapacity,
25+
KeyName = "dedicatedCapacityName",
26+
SegmentName = "capacities",
27+
NamePattern = "^[a-z][a-z0-9]*$"
28+
>;
29+
30+
/**
31+
* The SKU of the PowerBI Dedicated capacity resource.
32+
*/
33+
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
34+
sku: CapacitySku;
35+
36+
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
37+
@doc("The resource-specific properties for this resource.")
38+
@Azure.ResourceManager.Private.armResourcePropertiesOptionality(true)
39+
properties: DedicatedCapacityProperties;
40+
}
41+
42+
@armResourceOperations
43+
interface Capacities {
44+
/**
45+
* Gets details about the specified dedicated capacity.
46+
*/
47+
getDetails is ArmResourceRead<DedicatedCapacity, Error = ErrorResponse>;
48+
49+
/**
50+
* Provisions the specified Dedicated capacity based on the configuration specified in the request.
51+
*/
52+
create is ArmResourceCreateOrReplaceAsync<
53+
DedicatedCapacity,
54+
LroHeaders = ArmLroLocationHeader &
55+
Azure.Core.Foundations.RetryAfterHeader,
56+
Error = ErrorResponse
57+
>;
58+
59+
/**
60+
* Updates the current state of the specified Dedicated capacity.
61+
*/
62+
#suppress "@azure-tools/typespec-azure-resource-manager/no-response-body" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
63+
@patch(#{ implicitOptionality: false })
64+
update is ArmCustomPatchAsync<
65+
DedicatedCapacity,
66+
PatchModel = DedicatedCapacityUpdateParameters,
67+
Response = ArmResponse<DedicatedCapacity> | (ArmAcceptedLroResponse & {
68+
@bodyRoot
69+
_: DedicatedCapacity;
70+
}),
71+
Error = ErrorResponse
72+
>;
73+
74+
/**
75+
* Deletes the specified Dedicated capacity.
76+
*/
77+
#suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
78+
delete is ArmResourceDeleteWithoutOkAsync<
79+
DedicatedCapacity,
80+
Response = ArmDeletedResponse | ArmDeleteAcceptedLroResponse | ArmDeletedNoContentResponse,
81+
Error = ErrorResponse
82+
>;
83+
84+
/**
85+
* Gets all the Dedicated capacities for the given resource group.
86+
*/
87+
listByResourceGroup is ArmResourceListByParent<
88+
DedicatedCapacity,
89+
Response = ArmResponse<DedicatedCapacities>,
90+
Error = ErrorResponse
91+
>;
92+
93+
/**
94+
* Lists all the Dedicated capacities for the given subscription.
95+
*/
96+
list is ArmListBySubscription<
97+
DedicatedCapacity,
98+
Response = ArmResponse<DedicatedCapacities>,
99+
Error = ErrorResponse
100+
>;
101+
102+
/**
103+
* Suspends operation of the specified dedicated capacity instance.
104+
*/
105+
suspend is ArmResourceActionAsync<
106+
DedicatedCapacity,
107+
void,
108+
OkResponse,
109+
Error = ErrorResponse
110+
>;
111+
112+
/**
113+
* Resumes operation of the specified Dedicated capacity instance.
114+
*/
115+
resume is ArmResourceActionAsync<
116+
DedicatedCapacity,
117+
void,
118+
OkResponse,
119+
Error = ErrorResponse
120+
>;
121+
122+
/**
123+
* Lists eligible SKUs for a PowerBI Dedicated resource.
124+
*/
125+
@get
126+
@action("skus")
127+
listSkusForCapacity is ArmResourceActionSync<
128+
DedicatedCapacity,
129+
void,
130+
ArmResponse<SkuEnumerationForExistingResourceResult>,
131+
Error = ErrorResponse
132+
>;
133+
}
134+
135+
@@maxLength(DedicatedCapacity.name, 63);
136+
@@minLength(DedicatedCapacity.name, 3);
137+
@@doc(DedicatedCapacity.name,
138+
"The name of the dedicated capacity. It must be a minimum of 3 characters, and a maximum of 63."
139+
);
140+
@@doc(DedicatedCapacity.properties,
141+
"Properties of the provision operation request."
142+
);
143+
@@doc(Capacities.create::parameters.resource,
144+
"Contains the information used to provision the Dedicated capacity."
145+
);
146+
@@doc(Capacities.update::parameters.properties,
147+
"Request object that contains the updated information for the capacity."
148+
);
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import "@azure-tools/typespec-client-generator-core";
2+
3+
using Azure.ClientGenerator.Core;
4+
using Microsoft.PowerBIDedicated;
5+
6+
#suppress "deprecated" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
7+
@@flattenProperty(DedicatedCapacityUpdateParameters.properties);
8+
9+
#suppress "deprecated" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
10+
@@flattenProperty(AutoScaleVCoreUpdateParameters.properties);
11+
12+
@@clientName(Capacities.create::parameters.resource, "capacityParameters");
13+
@@clientName(Capacities.update::parameters.properties,
14+
"capacityUpdateParameters"
15+
);
16+
#suppress "deprecated" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
17+
@@flattenProperty(DedicatedCapacity.properties);
18+
19+
@@clientName(AutoScaleVCores.create::parameters.resource, "vCoreParameters");
20+
@@clientName(AutoScaleVCores.update::parameters.properties,
21+
"vCoreUpdateParameters"
22+
);
23+
#suppress "deprecated" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
24+
@@flattenProperty(AutoScaleVCore.properties);
25+
26+
@@clientName(CapacitiesOperationGroup.checkNameAvailability::parameters.body,
27+
"capacityParameters"
28+
);
29+
30+
// @@clientLocation decorators for @operationId operations
31+
@@clientLocation(CapacitiesOperationGroup.listSkus, Capacities);
32+
@@clientLocation(CapacitiesOperationGroup.checkNameAvailability, Capacities);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"parameters": {
3+
"api-version": "2021-01-01",
4+
"capacityParameters": {
5+
"name": "azsdktest",
6+
"type": "Microsoft.PowerBIDedicated/capacities"
7+
},
8+
"location": "West US",
9+
"subscriptionId": "613192d7-503f-477a-9cfe-4efc3ee2bd60"
10+
},
11+
"responses": {
12+
"200": {
13+
"body": {
14+
"nameAvailable": true
15+
},
16+
"headers": {}
17+
}
18+
},
19+
"operationId": "Capacities_CheckNameAvailability",
20+
"title": "Check name availability of a capacity"
21+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{
2+
"parameters": {
3+
"api-version": "2021-01-01",
4+
"resourceGroupName": "TestRG",
5+
"subscriptionId": "613192d7-503f-477a-9cfe-4efc3ee2bd60",
6+
"vCoreParameters": {
7+
"location": "West US",
8+
"properties": {
9+
"capacityLimit": 10,
10+
"capacityObjectId": "a28f00bd-5330-4572-88f1-fa883e074785"
11+
},
12+
"sku": {
13+
"name": "AutoScale",
14+
"capacity": 0,
15+
"tier": "AutoScale"
16+
},
17+
"tags": {
18+
"testKey": "testValue"
19+
}
20+
},
21+
"vcoreName": "testvcore"
22+
},
23+
"responses": {
24+
"200": {
25+
"body": {
26+
"name": "testvcore",
27+
"type": "Microsoft.PowerBIDedicated/autoScaleVCores",
28+
"id": "/subscriptions/613192d7-503f-477a-9cfe-4efc3ee2bd60/resourceGroups/TestRG/providers/Microsoft.PowerBIDedicated/autoScaleVCores/testvcore",
29+
"location": "West US",
30+
"properties": {
31+
"capacityLimit": 10,
32+
"capacityObjectId": "a28f00bd-5330-4572-88f1-fa883e074785",
33+
"provisioningState": "Succeeded"
34+
},
35+
"sku": {
36+
"name": "AutoScale",
37+
"capacity": 0,
38+
"tier": "AutoScale"
39+
},
40+
"systemData": {
41+
"createdAt": "2021-01-01T00:00:19.1234567Z",
42+
"createdBy": "app1",
43+
"createdByType": "Application",
44+
"lastModifiedAt": "2021-01-01T00:00:19.1234567Z",
45+
"lastModifiedBy": "app1",
46+
"lastModifiedByType": "Application"
47+
},
48+
"tags": {
49+
"testKey": "testValue"
50+
}
51+
},
52+
"headers": {}
53+
}
54+
},
55+
"operationId": "AutoScaleVCores_Create",
56+
"title": "Create auto scale v-core"
57+
}

0 commit comments

Comments
 (0)