Skip to content

Commit e0e2ccb

Browse files
authored
tsp - Add support for unixtime and testcase keyvault (#1535)
1 parent 7453cbe commit e0e2ccb

File tree

892 files changed

+201985
-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.

892 files changed

+201985
-3
lines changed

packages/typespec-powershell/src/utils/modelUtils.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,9 @@ export function getSchemaForType(
221221
case "rfc7231":
222222
(<any>propertySchema).format = "date-time-rfc1123";
223223
break;
224+
case "unixTimestamp":
225+
(<any>propertySchema).type = SchemaType.UnixTime;
226+
break;
224227
default:
225228
break;
226229
}

powershell/plugins/plugin-create-inline-properties.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ export async function createVirtuals(state: State): Promise<PwshModel> {
435435
for (const each of conflicts) {
436436
state.error(each, ['circular reference']);
437437
}
438-
throw new Error('Circular references exists, must mark models as `no-inline`');
438+
throw new Error('Circular references exists, must mark models as `no-inline`\n' + conflicts.join('\n'));
439439
}
440440
//dolauli update operations under commands
441441
for (const operation of values(state.model.commands.operations)) {
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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.KeyVault;
13+
14+
@subscriptionResource
15+
@parentResource(SubscriptionLocationResource)
16+
model DeletedManagedHsm
17+
is Azure.ResourceManager.ProxyResource<DeletedManagedHsmProperties> {
18+
...ResourceNameParameter<
19+
Resource = DeletedManagedHsm,
20+
KeyName = "name",
21+
SegmentName = "deletedManagedHSMs",
22+
NamePattern = ""
23+
>;
24+
}
25+
26+
@armResourceOperations
27+
interface DeletedManagedHsms {
28+
/**
29+
* Gets the specified deleted managed HSM.
30+
*/
31+
getDeleted is ArmResourceRead<DeletedManagedHsm, Error = ManagedHsmError>;
32+
33+
/**
34+
* Permanently deletes the specified managed HSM.
35+
*/
36+
@action("purge")
37+
purgeDeleted is ArmResourceActionAsyncBase<
38+
DeletedManagedHsm,
39+
void,
40+
Response = ArmAcceptedLroResponse,
41+
BaseParameters = Azure.ResourceManager.Foundations.SubscriptionBaseParameters,
42+
Error = ManagedHsmError
43+
>;
44+
}
45+
46+
@@doc(DeletedManagedHsm.name, "The name of the deleted managed HSM.");
47+
@@doc(DeletedManagedHsm.properties, "Properties of the deleted managed HSM");
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
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.KeyVault;
13+
/**
14+
* Deleted vault information with extended details.
15+
*/
16+
@subscriptionResource
17+
@parentResource(SubscriptionLocationResource)
18+
model DeletedVault
19+
is Azure.ResourceManager.ProxyResource<DeletedVaultProperties> {
20+
...ResourceNameParameter<
21+
Resource = DeletedVault,
22+
KeyName = "vaultName",
23+
SegmentName = "deletedVaults",
24+
NamePattern = ""
25+
>;
26+
}
27+
28+
@armResourceOperations
29+
interface DeletedVaults {
30+
/**
31+
* Gets the deleted Azure key vault.
32+
*/
33+
getDeleted is ArmResourceRead<DeletedVault, Error = CloudError>;
34+
35+
/**
36+
* Permanently deletes the specified vault. aka Purges the deleted Azure key vault.
37+
*/
38+
@action("purge")
39+
purgeDeleted is ArmResourceActionAsyncBase<
40+
DeletedVault,
41+
void,
42+
Response = OkResponse | ArmAcceptedLroResponse<LroHeaders = ArmLroLocationHeader &
43+
Azure.Core.Foundations.RetryAfterHeader>,
44+
BaseParameters = Azure.ResourceManager.Foundations.SubscriptionBaseParameters,
45+
Error = CloudError
46+
>;
47+
}
48+
49+
@@doc(DeletedVault.name, "The name of the vault.");
50+
@@doc(DeletedVault.properties, "Properties of the vault");
Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
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+
import "./Vault.tsp";
7+
8+
using TypeSpec.Rest;
9+
using Azure.ResourceManager;
10+
using TypeSpec.Http;
11+
using TypeSpec.OpenAPI;
12+
13+
namespace Microsoft.KeyVault;
14+
/**
15+
* The key resource.
16+
*/
17+
@parentResource(Vault)
18+
model Key is Azure.ResourceManager.ProxyResource<KeyProperties, false> {
19+
...ResourceNameParameter<
20+
Resource = Key,
21+
KeyName = "keyName",
22+
SegmentName = "keys",
23+
NamePattern = "^[a-zA-Z0-9-]{1,127}$"
24+
>;
25+
26+
/**
27+
* The supported Azure location where the managed HSM Pool should be created.
28+
*/
29+
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
30+
@visibility(Lifecycle.Read)
31+
location?: string;
32+
33+
/**
34+
* Resource tags
35+
*/
36+
#suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
37+
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
38+
@visibility(Lifecycle.Read)
39+
tags?: Record<string>;
40+
}
41+
42+
@armResourceOperations
43+
interface KeyOps
44+
extends Azure.ResourceManager.Legacy.LegacyOperations<
45+
{
46+
...ApiVersionParameter,
47+
...SubscriptionIdParameter,
48+
...ResourceGroupParameter,
49+
...Azure.ResourceManager.Legacy.Provider,
50+
51+
/** The name of the vault which contains the key to be retrieved. */
52+
@path
53+
@segment("vaults")
54+
@key
55+
@pattern("^[a-zA-Z0-9-]{3,24}$")
56+
vaultName: string,
57+
},
58+
{
59+
/** The name of the key to be retrieved. */
60+
@path
61+
@segment("keys")
62+
@key
63+
@pattern("^[a-zA-Z0-9-]{1,127}$")
64+
keyName: string,
65+
}
66+
> {}
67+
68+
@armResourceOperations
69+
interface Keys {
70+
/**
71+
* Gets the current version of the specified key from the specified key vault.
72+
*/
73+
get is KeyOps.Read<Key, OverrideErrorType = CloudError>;
74+
75+
/**
76+
* Creates the first version of a new key if it does not exist. If it already exists, then the existing key is returned without any write operations being performed. This API does not create subsequent versions, and does not update existing keys.
77+
*/
78+
#suppress "@azure-tools/typespec-azure-resource-manager/arm-put-operation-response-codes" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
79+
createIfNotExist is KeyOps.CreateOrUpdateSync<
80+
Key,
81+
Request = KeyCreateParameters,
82+
Response = ArmResourceUpdatedResponse<Key>,
83+
OverrideErrorType = CloudError
84+
>;
85+
86+
/**
87+
* Lists the keys in the specified key vault.
88+
*/
89+
list is KeyOps.List<Key, OverrideErrorType = CloudError>;
90+
}
91+
@armResourceOperations
92+
interface KeyOperationGroupOps
93+
extends Azure.ResourceManager.Legacy.LegacyOperations<
94+
{
95+
...ApiVersionParameter,
96+
...SubscriptionIdParameter,
97+
...ResourceGroupParameter,
98+
...Azure.ResourceManager.Legacy.Provider,
99+
100+
/** The name of the vault which contains the key version to be retrieved. */
101+
@path
102+
@segment("vaults")
103+
@key
104+
@pattern("^[a-zA-Z0-9-]{3,24}$")
105+
vaultName: string,
106+
107+
/** The name of the key version to be retrieved. */
108+
@path
109+
@segment("keys")
110+
@key
111+
@pattern("^[a-zA-Z0-9-]{1,127}$")
112+
keyName: string,
113+
},
114+
{
115+
/** The version of the key to be retrieved. */
116+
@path
117+
@segment("versions")
118+
@key
119+
@pattern("^[a-fA-F0-9]{32}$")
120+
keyVersion: string,
121+
}
122+
> {}
123+
124+
#suppress "@azure-tools/typespec-azure-resource-manager/no-resource-delete-operation" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
125+
@armResourceOperations
126+
interface KeyOperationGroup {
127+
/**
128+
* Gets the specified version of the specified key in the specified key vault.
129+
*/
130+
getVersion is KeyOperationGroupOps.Read<Key, OverrideErrorType = CloudError>;
131+
132+
/**
133+
* Lists the keys in the specified key vault.
134+
*/
135+
listVersions is KeyOperationGroupOps.List<
136+
Key,
137+
OverrideErrorType = CloudError
138+
>;
139+
}
140+
141+
@@doc(Key.name, "The name of the key to be retrieved.");
142+
@@doc(Key.properties, "The properties of the key.");
143+
@@doc(Keys.createIfNotExist::parameters.resource,
144+
"The parameters used to create the specified key."
145+
);
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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.KeyVault;
13+
14+
@subscriptionResource
15+
@parentResource(SubscriptionLocationResource)
16+
model DeletedManagedHsm
17+
is Azure.ResourceManager.ProxyResource<DeletedManagedHsmProperties> {
18+
...ResourceNameParameter<
19+
Resource = DeletedManagedHsm,
20+
KeyName = "name",
21+
SegmentName = "deletedManagedHSMs",
22+
NamePattern = ""
23+
>;
24+
}
25+
26+
@armResourceOperations
27+
interface DeletedManagedHsms {
28+
/**
29+
* Gets the specified deleted managed HSM.
30+
*/
31+
getDeleted is ArmResourceRead<DeletedManagedHsm, Error = ManagedHsmError>;
32+
33+
/**
34+
* Permanently deletes the specified managed HSM.
35+
*/
36+
@action("purge")
37+
purgeDeleted is ArmResourceActionAsyncBase<
38+
DeletedManagedHsm,
39+
void,
40+
Response = ArmAcceptedLroResponse,
41+
BaseParameters = Azure.ResourceManager.Foundations.SubscriptionBaseParameters,
42+
Error = ManagedHsmError
43+
>;
44+
}
45+
46+
@@doc(DeletedManagedHsm.name, "The name of the deleted managed HSM.");
47+
@@doc(DeletedManagedHsm.properties, "Properties of the deleted managed HSM");
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
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.KeyVault;
13+
/**
14+
* Deleted vault information with extended details.
15+
*/
16+
@subscriptionResource
17+
@parentResource(SubscriptionLocationResource)
18+
model DeletedVault
19+
is Azure.ResourceManager.ProxyResource<DeletedVaultProperties> {
20+
...ResourceNameParameter<
21+
Resource = DeletedVault,
22+
KeyName = "vaultName",
23+
SegmentName = "deletedVaults",
24+
NamePattern = ""
25+
>;
26+
}
27+
28+
@armResourceOperations
29+
interface DeletedVaults {
30+
/**
31+
* Gets the deleted Azure key vault.
32+
*/
33+
getDeleted is ArmResourceRead<DeletedVault, Error = CloudError>;
34+
35+
/**
36+
* Permanently deletes the specified vault. aka Purges the deleted Azure key vault.
37+
*/
38+
@action("purge")
39+
purgeDeleted is ArmResourceActionAsyncBase<
40+
DeletedVault,
41+
void,
42+
Response = OkResponse | ArmAcceptedLroResponse<LroHeaders = ArmLroLocationHeader &
43+
Azure.Core.Foundations.RetryAfterHeader>,
44+
BaseParameters = Azure.ResourceManager.Foundations.SubscriptionBaseParameters,
45+
Error = CloudError
46+
>;
47+
}
48+
49+
@@doc(DeletedVault.name, "The name of the vault.");
50+
@@doc(DeletedVault.properties, "Properties of the vault");

0 commit comments

Comments
 (0)