Skip to content

Commit b24da40

Browse files
authored
tsp - Add six brown field test cases (#1520)
* tsp - Add six brown field test cases * tsp - Ignore HardwareSecurityModules.cs
1 parent b7d7288 commit b24da40

File tree

4,366 files changed

+1222490
-3
lines changed

Some content is hidden

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

4,366 files changed

+1222490
-3
lines changed
Lines changed: 256 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,256 @@
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.HardwareSecurityModules;
13+
/**
14+
* Resource information with extended details.
15+
*/
16+
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
17+
model CloudHsmCluster
18+
is Azure.ResourceManager.TrackedResource<CloudHsmClusterProperties> {
19+
...ResourceNameParameter<
20+
Resource = CloudHsmCluster,
21+
KeyName = "cloudHsmClusterName",
22+
SegmentName = "cloudHsmClusters",
23+
NamePattern = "^[a-zA-Z0-9-]{3,23}$"
24+
>;
25+
26+
/**
27+
* Managed service identity (system assigned and/or user assigned identities)
28+
*/
29+
identity?: Azure.ResourceManager.CommonTypes.ManagedServiceIdentity;
30+
31+
/**
32+
* SKU details
33+
*/
34+
@visibility(Lifecycle.Read, Lifecycle.Create)
35+
sku?: CloudHsmClusterSku;
36+
}
37+
38+
@armResourceOperations
39+
interface CloudHsmClusters {
40+
/**
41+
* Gets the specified Cloud HSM Cluster
42+
*/
43+
get is ArmResourceRead<CloudHsmCluster>;
44+
45+
/**
46+
* Create or Update a Cloud HSM Cluster in the specified subscription.
47+
*/
48+
@Azure.Core.useFinalStateVia("original-uri")
49+
createOrUpdate is ArmResourceCreateOrReplaceAsync<CloudHsmCluster>;
50+
51+
/**
52+
* Update a Cloud HSM Cluster in the specified subscription.
53+
*/
54+
@patch(#{ implicitOptionality: false })
55+
update is ArmCustomPatchAsync<
56+
CloudHsmCluster,
57+
PatchModel = CloudHsmClusterPatchParameters
58+
>;
59+
60+
/**
61+
* Deletes the specified Cloud HSM Cluster
62+
*/
63+
delete is ArmResourceDeleteWithoutOkAsync<CloudHsmCluster>;
64+
65+
/**
66+
* The List operation gets information about the Cloud HSM Clusters associated with the subscription and within the specified resource group.
67+
*/
68+
listByResourceGroup is ArmResourceListByParent<
69+
CloudHsmCluster,
70+
Parameters = {
71+
/**
72+
* The page-continuation token to use with a paged version of this API
73+
*/
74+
@query("$skiptoken")
75+
$skiptoken?: string;
76+
}
77+
>;
78+
79+
/**
80+
* The List operation gets information about the Cloud HSM Clusters associated with the subscription.
81+
*/
82+
listBySubscription is ArmListBySubscription<
83+
CloudHsmCluster,
84+
Parameters = {
85+
/**
86+
* The page-continuation token to use with a paged version of this API
87+
*/
88+
@query("$skiptoken")
89+
$skiptoken?: string;
90+
}
91+
>;
92+
93+
/**
94+
* Pre Backup operation to validate whether the customer can perform a backup on the Cloud HSM Cluster resource in the specified subscription.
95+
*/
96+
#suppress "@azure-tools/typespec-azure-resource-manager/lro-location-header" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
97+
validateBackupProperties is ArmResourceActionAsync<
98+
CloudHsmCluster,
99+
BackupRequestProperties,
100+
ArmResponse<BackupResult> & Azure.Core.RequestIdResponseHeader,
101+
LroHeaders = ArmAsyncOperationHeader<FinalResult = BackupResult> &
102+
ArmLroLocationHeader &
103+
Azure.Core.Foundations.RetryAfterHeader &
104+
Azure.Core.RequestIdResponseHeader,
105+
OptionalRequestBody = true
106+
>;
107+
108+
/**
109+
* Create a backup of the Cloud HSM Cluster in the specified subscription
110+
*/
111+
#suppress "@azure-tools/typespec-azure-resource-manager/lro-location-header" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
112+
backup is ArmResourceActionAsync<
113+
CloudHsmCluster,
114+
BackupRequestProperties,
115+
ArmResponse<BackupResult> & Azure.Core.RequestIdResponseHeader,
116+
LroHeaders = ArmAsyncOperationHeader<FinalResult = BackupResult> &
117+
ArmLroLocationHeader &
118+
Azure.Core.Foundations.RetryAfterHeader &
119+
Azure.Core.RequestIdResponseHeader,
120+
OptionalRequestBody = true
121+
>;
122+
123+
/**
124+
* Queued validating pre restore operation
125+
*/
126+
#suppress "@azure-tools/typespec-azure-resource-manager/lro-location-header" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
127+
validateRestoreProperties is ArmResourceActionAsync<
128+
CloudHsmCluster,
129+
RestoreRequestProperties,
130+
ArmResponse<RestoreResult> & Azure.Core.RequestIdResponseHeader,
131+
LroHeaders = ArmAsyncOperationHeader<FinalResult = RestoreResult> &
132+
ArmLroLocationHeader &
133+
Azure.Core.Foundations.RetryAfterHeader &
134+
Azure.Core.RequestIdResponseHeader,
135+
OptionalRequestBody = true
136+
>;
137+
138+
/**
139+
* Restores all key materials of a specified Cloud HSM Cluster
140+
*/
141+
#suppress "@azure-tools/typespec-azure-resource-manager/lro-location-header" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
142+
restore is ArmResourceActionAsync<
143+
CloudHsmCluster,
144+
RestoreRequestProperties,
145+
ArmResponse<RestoreResult> & Azure.Core.RequestIdResponseHeader,
146+
LroHeaders = ArmAsyncOperationHeader<FinalResult = RestoreResult> &
147+
ArmLroLocationHeader &
148+
Azure.Core.Foundations.RetryAfterHeader &
149+
Azure.Core.RequestIdResponseHeader
150+
>;
151+
152+
/**
153+
* Gets the private link resources supported for the Cloud Hsm Cluster.
154+
*/
155+
#suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
156+
@get
157+
@action("privateLinkResources")
158+
@list
159+
listByCloudHsmCluster is ArmResourceActionSync<
160+
CloudHsmCluster,
161+
void,
162+
CommonTypes.PrivateLinkResourceListResult
163+
>;
164+
165+
/**
166+
* Gets the backup operation status of the specified Cloud HSM Cluster
167+
*/
168+
#suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
169+
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-operation" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
170+
#suppress "@azure-tools/typespec-azure-resource-manager/lro-location-header" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
171+
@get
172+
cloudHsmClusterBackupStatusGet(
173+
...ResourceInstanceParameters<
174+
Resource,
175+
Azure.ResourceManager.Foundations.DefaultBaseParameters<CloudHsmCluster>
176+
>,
177+
178+
#suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
179+
@path
180+
@segment("cloudHsmClusters")
181+
@minLength(3)
182+
@maxLength(23)
183+
@pattern("^[a-zA-Z0-9-]{3,23}$")
184+
cloudHsmClusterName: string,
185+
186+
/**
187+
* Identifier for the backup operation
188+
*/
189+
@path
190+
@segment("backupOperationStatus")
191+
jobId: string,
192+
): (BackupResult &
193+
Azure.Core.RequestIdResponseHeader) | ArmAcceptedResponse<ExtraHeaders = {
194+
@header("Location")
195+
@doc("The Location header contains the URL where the status of the long running operation can be checked.")
196+
location?: string;
197+
} & Azure.Core.RequestIdResponseHeader> | ErrorResponse;
198+
/**
199+
* Gets the restore operation status of the specified Cloud HSM Cluster
200+
*/
201+
#suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
202+
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-operation" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
203+
#suppress "@azure-tools/typespec-azure-resource-manager/lro-location-header" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
204+
@get
205+
cloudHsmClusterRestoreStatusGet(
206+
...ResourceInstanceParameters<
207+
Resource,
208+
Azure.ResourceManager.Foundations.DefaultBaseParameters<CloudHsmCluster>
209+
>,
210+
211+
/**
212+
* Name of the Cloud HSM Cluster
213+
*/
214+
@path
215+
@segment("cloudHsmClusters")
216+
@minLength(3)
217+
@maxLength(23)
218+
@pattern("^[a-zA-Z0-9-]{3,23}$")
219+
cloudHsmClusterName: string,
220+
221+
/**
222+
* Identifier for the restore operation
223+
*/
224+
@path
225+
@segment("restoreOperationStatus")
226+
jobId: string,
227+
): (RestoreResult &
228+
Azure.Core.RequestIdResponseHeader) | ArmAcceptedResponse<ExtraHeaders = {
229+
@header("Location")
230+
@doc("The Location header contains the URL where the status of the long running operation can be checked.")
231+
location?: string;
232+
} & Azure.Core.RequestIdResponseHeader> | ErrorResponse;
233+
}
234+
235+
@@maxLength(CloudHsmCluster.name, 23);
236+
@@minLength(CloudHsmCluster.name, 3);
237+
@@doc(CloudHsmCluster.name,
238+
"The name of the Cloud HSM Cluster within the specified resource group. Cloud HSM Cluster names must be between 3 and 23 characters in length."
239+
);
240+
@@doc(CloudHsmCluster.properties, "Properties of the Cloud HSM Cluster");
241+
@@doc(CloudHsmClusters.createOrUpdate::parameters.resource,
242+
"Parameters to create Cloud HSM Cluster"
243+
);
244+
@@doc(CloudHsmClusters.update::parameters.properties,
245+
"Parameters to create Cloud HSM Cluster"
246+
);
247+
@@doc(CloudHsmClusters.restore::parameters.body,
248+
"Restore Operation Required properties"
249+
);
250+
@@doc(CloudHsmClusters.validateRestoreProperties::parameters.body,
251+
"Optional Parameters to validate prior performing a restore operation."
252+
);
253+
@@doc(CloudHsmClusters.backup::parameters.body, "Azure storage Resource Uri");
254+
@@doc(CloudHsmClusters.validateBackupProperties::parameters.body,
255+
"Backup Operation Required properties"
256+
);
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
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.HardwareSecurityModules;
13+
/**
14+
* Resource information with extended details.
15+
*/
16+
#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance" "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+
@Azure.ResourceManager.Private.armResourceInternal(DedicatedHsmProperties)
19+
@TypeSpec.Http.Private.includeInapplicableMetadataInPayload(false)
20+
model DedicatedHsm extends Foundations.TrackedResource {
21+
...ResourceNameParameter<
22+
Resource = DedicatedHsm,
23+
KeyName = "name",
24+
SegmentName = "dedicatedHSMs"
25+
>;
26+
27+
/**
28+
* SKU details
29+
*/
30+
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
31+
sku: Sku;
32+
33+
...Azure.ResourceManager.AvailabilityZonesProperty;
34+
35+
/**
36+
* Properties of the dedicated HSM
37+
*/
38+
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
39+
@Azure.ResourceManager.Private.armResourcePropertiesOptionality(false)
40+
properties: DedicatedHsmProperties;
41+
}
42+
43+
@armResourceOperations
44+
interface DedicatedHsms {
45+
/**
46+
* Gets the specified Azure dedicated HSM.
47+
*/
48+
#suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
49+
get is ArmResourceRead<DedicatedHsm, Error = DedicatedHsmError>;
50+
51+
/**
52+
* Create or Update a dedicated HSM in the specified subscription.
53+
*/
54+
#suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
55+
createOrUpdate is ArmResourceCreateOrReplaceAsync<
56+
DedicatedHsm,
57+
Error = DedicatedHsmError
58+
>;
59+
60+
/**
61+
* Update a dedicated HSM in the specified subscription.
62+
*/
63+
#suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
64+
@patch(#{ implicitOptionality: false })
65+
update is ArmCustomPatchAsync<
66+
DedicatedHsm,
67+
PatchModel = DedicatedHsmPatchParameters,
68+
Error = DedicatedHsmError
69+
>;
70+
71+
/**
72+
* Deletes the specified Azure Dedicated HSM.
73+
*/
74+
#suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
75+
delete is ArmResourceDeleteWithoutOkAsync<
76+
DedicatedHsm,
77+
Error = DedicatedHsmError
78+
>;
79+
80+
/**
81+
* The List operation gets information about the dedicated HSMs associated with the subscription and within the specified resource group.
82+
*/
83+
#suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
84+
listByResourceGroup is ArmResourceListByParent<
85+
DedicatedHsm,
86+
Parameters = {
87+
/**
88+
* Maximum number of results to return.
89+
*/
90+
@query("$top")
91+
$top?: int32;
92+
},
93+
Error = DedicatedHsmError
94+
>;
95+
96+
/**
97+
* The List operation gets information about the dedicated HSMs associated with the subscription.
98+
*/
99+
#suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
100+
listBySubscription is ArmListBySubscription<
101+
DedicatedHsm,
102+
Parameters = {
103+
/**
104+
* Maximum number of results to return.
105+
*/
106+
@query("$top")
107+
$top?: int32;
108+
},
109+
Error = DedicatedHsmError
110+
>;
111+
112+
/**
113+
* Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified dedicated hsm resource. The operation returns properties of each egress endpoint.
114+
*/
115+
#suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
116+
@get
117+
@action("outboundNetworkDependenciesEndpoints")
118+
@list
119+
listOutboundNetworkDependenciesEndpoints is ArmResourceActionSync<
120+
DedicatedHsm,
121+
void,
122+
ArmResponse<OutboundEnvironmentEndpointCollection>,
123+
Error = DedicatedHsmError
124+
>;
125+
}
126+
127+
@@doc(DedicatedHsm.name, "Name of the dedicated Hsm");
128+
@@doc(DedicatedHsm.properties, "Properties of the dedicated HSM");
129+
@@doc(DedicatedHsms.createOrUpdate::parameters.resource,
130+
"Parameters to create or update the dedicated hsm"
131+
);
132+
@@doc(DedicatedHsms.update::parameters.properties,
133+
"Parameters to patch the dedicated HSM"
134+
);

0 commit comments

Comments
 (0)