Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 3 additions & 0 deletions packages/typespec-powershell/src/utils/modelUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,9 @@ export function getSchemaForType(
case "rfc7231":
(<any>propertySchema).format = "date-time-rfc1123";
break;
case "unixTimestamp":
(<any>propertySchema).type = SchemaType.UnixTime;
break;
default:
break;
}
Expand Down
2 changes: 1 addition & 1 deletion powershell/plugins/plugin-create-inline-properties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ export async function createVirtuals(state: State): Promise<PwshModel> {
for (const each of conflicts) {
state.error(each, ['circular reference']);
}
throw new Error('Circular references exists, must mark models as `no-inline`');
throw new Error('Circular references exists, must mark models as `no-inline`\n' + conflicts.join('\n'));
}
//dolauli update operations under commands
for (const operation of values(state.model.commands.operations)) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
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.KeyVault;

@subscriptionResource
@parentResource(SubscriptionLocationResource)
model DeletedManagedHsm
is Azure.ResourceManager.ProxyResource<DeletedManagedHsmProperties> {
...ResourceNameParameter<
Resource = DeletedManagedHsm,
KeyName = "name",
SegmentName = "deletedManagedHSMs",
NamePattern = ""
>;
}

@armResourceOperations
interface DeletedManagedHsms {
/**
* Gets the specified deleted managed HSM.
*/
getDeleted is ArmResourceRead<DeletedManagedHsm, Error = ManagedHsmError>;

/**
* Permanently deletes the specified managed HSM.
*/
@action("purge")
purgeDeleted is ArmResourceActionAsyncBase<
DeletedManagedHsm,
void,
Response = ArmAcceptedLroResponse,
BaseParameters = Azure.ResourceManager.Foundations.SubscriptionBaseParameters,
Error = ManagedHsmError
>;
}

@@doc(DeletedManagedHsm.name, "The name of the deleted managed HSM.");
@@doc(DeletedManagedHsm.properties, "Properties of the deleted managed HSM");
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
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.KeyVault;
/**
* Deleted vault information with extended details.
*/
@subscriptionResource
@parentResource(SubscriptionLocationResource)
model DeletedVault
is Azure.ResourceManager.ProxyResource<DeletedVaultProperties> {
...ResourceNameParameter<
Resource = DeletedVault,
KeyName = "vaultName",
SegmentName = "deletedVaults",
NamePattern = ""
>;
}

@armResourceOperations
interface DeletedVaults {
/**
* Gets the deleted Azure key vault.
*/
getDeleted is ArmResourceRead<DeletedVault, Error = CloudError>;

/**
* Permanently deletes the specified vault. aka Purges the deleted Azure key vault.
*/
@action("purge")
purgeDeleted is ArmResourceActionAsyncBase<
DeletedVault,
void,
Response = OkResponse | ArmAcceptedLroResponse<LroHeaders = ArmLroLocationHeader &
Azure.Core.Foundations.RetryAfterHeader>,
BaseParameters = Azure.ResourceManager.Foundations.SubscriptionBaseParameters,
Error = CloudError
>;
}

@@doc(DeletedVault.name, "The name of the vault.");
@@doc(DeletedVault.properties, "Properties of the vault");
145 changes: 145 additions & 0 deletions tests-upgrade/tests-emitter/KeyVault.Management.brown/Key.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";
import "@typespec/openapi";
import "@typespec/rest";
import "./models.tsp";
import "./Vault.tsp";

using TypeSpec.Rest;
using Azure.ResourceManager;
using TypeSpec.Http;
using TypeSpec.OpenAPI;

namespace Microsoft.KeyVault;
/**
* The key resource.
*/
@parentResource(Vault)
model Key is Azure.ResourceManager.ProxyResource<KeyProperties, false> {
...ResourceNameParameter<
Resource = Key,
KeyName = "keyName",
SegmentName = "keys",
NamePattern = "^[a-zA-Z0-9-]{1,127}$"
>;

/**
* The supported Azure location where the managed HSM Pool should be created.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@visibility(Lifecycle.Read)
location?: string;

/**
* Resource tags
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@visibility(Lifecycle.Read)
tags?: Record<string>;
}

@armResourceOperations
interface KeyOps
extends Azure.ResourceManager.Legacy.LegacyOperations<
{
...ApiVersionParameter,
...SubscriptionIdParameter,
...ResourceGroupParameter,
...Azure.ResourceManager.Legacy.Provider,

/** The name of the vault which contains the key to be retrieved. */
@path
@segment("vaults")
@key
@pattern("^[a-zA-Z0-9-]{3,24}$")
vaultName: string,
},
{
/** The name of the key to be retrieved. */
@path
@segment("keys")
@key
@pattern("^[a-zA-Z0-9-]{1,127}$")
keyName: string,
}
> {}

@armResourceOperations
interface Keys {
/**
* Gets the current version of the specified key from the specified key vault.
*/
get is KeyOps.Read<Key, OverrideErrorType = CloudError>;

/**
* 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.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-put-operation-response-codes" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
createIfNotExist is KeyOps.CreateOrUpdateSync<
Key,
Request = KeyCreateParameters,
Response = ArmResourceUpdatedResponse<Key>,
OverrideErrorType = CloudError
>;

/**
* Lists the keys in the specified key vault.
*/
list is KeyOps.List<Key, OverrideErrorType = CloudError>;
}
@armResourceOperations
interface KeyOperationGroupOps
extends Azure.ResourceManager.Legacy.LegacyOperations<
{
...ApiVersionParameter,
...SubscriptionIdParameter,
...ResourceGroupParameter,
...Azure.ResourceManager.Legacy.Provider,

/** The name of the vault which contains the key version to be retrieved. */
@path
@segment("vaults")
@key
@pattern("^[a-zA-Z0-9-]{3,24}$")
vaultName: string,

/** The name of the key version to be retrieved. */
@path
@segment("keys")
@key
@pattern("^[a-zA-Z0-9-]{1,127}$")
keyName: string,
},
{
/** The version of the key to be retrieved. */
@path
@segment("versions")
@key
@pattern("^[a-fA-F0-9]{32}$")
keyVersion: string,
}
> {}

#suppress "@azure-tools/typespec-azure-resource-manager/no-resource-delete-operation" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@armResourceOperations
interface KeyOperationGroup {
/**
* Gets the specified version of the specified key in the specified key vault.
*/
getVersion is KeyOperationGroupOps.Read<Key, OverrideErrorType = CloudError>;

/**
* Lists the keys in the specified key vault.
*/
listVersions is KeyOperationGroupOps.List<
Key,
OverrideErrorType = CloudError
>;
}

@@doc(Key.name, "The name of the key to be retrieved.");
@@doc(Key.properties, "The properties of the key.");
@@doc(Keys.createIfNotExist::parameters.resource,
"The parameters used to create the specified key."
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
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.KeyVault;

@subscriptionResource
@parentResource(SubscriptionLocationResource)
model DeletedManagedHsm
is Azure.ResourceManager.ProxyResource<DeletedManagedHsmProperties> {
...ResourceNameParameter<
Resource = DeletedManagedHsm,
KeyName = "name",
SegmentName = "deletedManagedHSMs",
NamePattern = ""
>;
}

@armResourceOperations
interface DeletedManagedHsms {
/**
* Gets the specified deleted managed HSM.
*/
getDeleted is ArmResourceRead<DeletedManagedHsm, Error = ManagedHsmError>;

/**
* Permanently deletes the specified managed HSM.
*/
@action("purge")
purgeDeleted is ArmResourceActionAsyncBase<
DeletedManagedHsm,
void,
Response = ArmAcceptedLroResponse,
BaseParameters = Azure.ResourceManager.Foundations.SubscriptionBaseParameters,
Error = ManagedHsmError
>;
}

@@doc(DeletedManagedHsm.name, "The name of the deleted managed HSM.");
@@doc(DeletedManagedHsm.properties, "Properties of the deleted managed HSM");
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
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.KeyVault;
/**
* Deleted vault information with extended details.
*/
@subscriptionResource
@parentResource(SubscriptionLocationResource)
model DeletedVault
is Azure.ResourceManager.ProxyResource<DeletedVaultProperties> {
...ResourceNameParameter<
Resource = DeletedVault,
KeyName = "vaultName",
SegmentName = "deletedVaults",
NamePattern = ""
>;
}

@armResourceOperations
interface DeletedVaults {
/**
* Gets the deleted Azure key vault.
*/
getDeleted is ArmResourceRead<DeletedVault, Error = CloudError>;

/**
* Permanently deletes the specified vault. aka Purges the deleted Azure key vault.
*/
@action("purge")
purgeDeleted is ArmResourceActionAsyncBase<
DeletedVault,
void,
Response = OkResponse | ArmAcceptedLroResponse<LroHeaders = ArmLroLocationHeader &
Azure.Core.Foundations.RetryAfterHeader>,
BaseParameters = Azure.ResourceManager.Foundations.SubscriptionBaseParameters,
Error = CloudError
>;
}

@@doc(DeletedVault.name, "The name of the vault.");
@@doc(DeletedVault.properties, "Properties of the vault");
Loading
Loading