Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial commit of ARM bug fix and rename/reorg #762

Merged
merged 20 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
899f640
Initial commit of ARM bug fix and rename/reorg
allenjzhang Apr 30, 2024
5bb4d1d
Merge branch 'main' into azhang_armReorg
allenjzhang Apr 30, 2024
68c1403
Adding back ExtensionResource base and fixing tests
allenjzhang Apr 30, 2024
114c3cb
Merge branch 'main' of https://github.com/Azure/typespec-azure into a…
allenjzhang Apr 30, 2024
2a49477
Merge branch 'main' of https://github.com/Azure/typespec-azure into a…
allenjzhang May 2, 2024
9cc1b4a
Update change log
allenjzhang May 2, 2024
5632f35
Merge branch 'main' into azhang_armReorg
allenjzhang May 2, 2024
4833217
Removed ArmResourceBase, doc update and other CR comments
allenjzhang May 5, 2024
cb2e043
Added a Private.ArmResourceTypeConstraint model to enforce constraint…
allenjzhang May 5, 2024
93ea008
Merge branch 'azhang_armReorg' of https://github.com/allenjzhang/type…
allenjzhang May 5, 2024
a62389f
Merge branch 'main' into azhang_armReorg
allenjzhang May 5, 2024
e60dff6
Merge branch 'main' of https://github.com/Azure/typespec-azure into a…
allenjzhang May 6, 2024
d3ef97e
Merge branch 'main' of https://github.com/Azure/typespec-azure into a…
allenjzhang May 6, 2024
4a9b9c2
Add @enforceConstraint decorator & tests
allenjzhang May 7, 2024
61de0d5
Merge branch 'main' of https://github.com/Azure/typespec-azure into a…
allenjzhang May 7, 2024
04ea6e7
Merge branch 'azhang_armReorg' of https://github.com/allenjzhang/type…
allenjzhang May 7, 2024
b0f1221
Update .chronus/changes/azhang_armReorg-2024-3-29-17-13-46.md
timotheeguerin May 7, 2024
d7e545e
Merge branch 'main' into azhang_armReorg
allenjzhang May 7, 2024
94fbb9b
Fixing CR comments
allenjzhang May 7, 2024
e23bd1b
Update doc
allenjzhang May 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .chronus/changes/azhang_armReorg-2024-3-29-17-13-46.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
changeKind: internal
timotheeguerin marked this conversation as resolved.
Show resolved Hide resolved
packages:
- "@azure-tools/typespec-azure-resource-manager"
---

Renaming internal TypeSpec ARM foundation model names to be consistent with ARM common-type definitions.
However, these are `Azure.Resource.Manager.Foundations` models that would not normally be used directly in service specs.

- Deprecate `Foundations.ArmResource`. `Foundations.Resource` should be used instead.

- Deprecate `Foundations.ResourceSkuType`. `Foundations.Sku` should be used instead.

- Deprecate `Foundations.ResourcePlanType`. `Foundations.Plan` should be used instead.

- Deprecate `Foundations.TrackedResourceBase`. `Foundations.TrackedResource` should be used instead.

- Deprecate `Foundations.ProxyResourceBase`. `Foundations.ProxyResource` should be used instead.

- Deprecate `Foundations.ExtensionResourceBase`. `Foundations.ExtensionResource` should be used instead.
150 changes: 82 additions & 68 deletions docs/libraries/azure-resource-manager/reference/data-types.md

Large diffs are not rendered by default.

13 changes: 7 additions & 6 deletions docs/libraries/azure-resource-manager/reference/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -190,17 +190,17 @@ npm install --save-peer @azure-tools/typespec-azure-resource-manager

### Models

- [`ArmResource`](./data-types.md#Azure.ResourceManager.Foundations.ArmResource)
- [`ArmResourceBase`](./data-types.md#Azure.ResourceManager.Foundations.ArmResourceBase)
- [`ArmTagsProperty`](./data-types.md#Azure.ResourceManager.Foundations.ArmTagsProperty)
- [`AzureEntityResource`](./data-types.md#Azure.ResourceManager.Foundations.AzureEntityResource)
- [`CheckNameAvailabilityRequest`](./data-types.md#Azure.ResourceManager.Foundations.CheckNameAvailabilityRequest)
- [`CheckNameAvailabilityResponse`](./data-types.md#Azure.ResourceManager.Foundations.CheckNameAvailabilityResponse)
- [`DefaultBaseParameters`](./data-types.md#Azure.ResourceManager.Foundations.DefaultBaseParameters)
- [`ErrorAdditionalInfo`](./data-types.md#Azure.ResourceManager.Foundations.ErrorAdditionalInfo)
- [`ErrorDetail`](./data-types.md#Azure.ResourceManager.Foundations.ErrorDetail)
- [`ExtendedLocation`](./data-types.md#Azure.ResourceManager.Foundations.ExtendedLocation)
- [`ExtensionBaseParameters`](./data-types.md#Azure.ResourceManager.Foundations.ExtensionBaseParameters)
- [`ExtensionResourceBase`](./data-types.md#Azure.ResourceManager.Foundations.ExtensionResourceBase)
- [`ExtensionResource`](./data-types.md#Azure.ResourceManager.Foundations.ExtensionResource)
- [`ExtensionScope`](./data-types.md#Azure.ResourceManager.Foundations.ExtensionScope)
- [`LocationBaseParameters`](./data-types.md#Azure.ResourceManager.Foundations.LocationBaseParameters)
- [`LocationScope`](./data-types.md#Azure.ResourceManager.Foundations.LocationScope)
Expand All @@ -211,19 +211,20 @@ npm install --save-peer @azure-tools/typespec-azure-resource-manager
- [`OperationIdParameter`](./data-types.md#Azure.ResourceManager.Foundations.OperationIdParameter)
- [`OperationListResult`](./data-types.md#Azure.ResourceManager.Foundations.OperationListResult)
- [`OperationStatusResult`](./data-types.md#Azure.ResourceManager.Foundations.OperationStatusResult)
- [`ProxyResourceBase`](./data-types.md#Azure.ResourceManager.Foundations.ProxyResourceBase)
- [`Plan`](./data-types.md#Azure.ResourceManager.Foundations.Plan)
- [`ProxyResource`](./data-types.md#Azure.ResourceManager.Foundations.ProxyResource)
- [`ProxyResourceUpdateModel`](./data-types.md#Azure.ResourceManager.Foundations.ProxyResourceUpdateModel)
- [`Resource`](./data-types.md#Azure.ResourceManager.Foundations.Resource)
- [`ResourceGroupBaseParameters`](./data-types.md#Azure.ResourceManager.Foundations.ResourceGroupBaseParameters)
- [`ResourceGroupScope`](./data-types.md#Azure.ResourceManager.Foundations.ResourceGroupScope)
- [`ResourcePlanType`](./data-types.md#Azure.ResourceManager.Foundations.ResourcePlanType)
- [`ResourceSkuType`](./data-types.md#Azure.ResourceManager.Foundations.ResourceSkuType)
- [`ResourceUpdateModel`](./data-types.md#Azure.ResourceManager.Foundations.ResourceUpdateModel)
- [`ResourceUpdateModelProperties`](./data-types.md#Azure.ResourceManager.Foundations.ResourceUpdateModelProperties)
- [`Sku`](./data-types.md#Azure.ResourceManager.Foundations.Sku)
- [`SubscriptionBaseParameters`](./data-types.md#Azure.ResourceManager.Foundations.SubscriptionBaseParameters)
- [`SubscriptionScope`](./data-types.md#Azure.ResourceManager.Foundations.SubscriptionScope)
- [`SystemData`](./data-types.md#Azure.ResourceManager.Foundations.SystemData)
- [`TagsUpdateModel`](./data-types.md#Azure.ResourceManager.Foundations.TagsUpdateModel)
- [`TenantBaseParameters`](./data-types.md#Azure.ResourceManager.Foundations.TenantBaseParameters)
- [`TenantScope`](./data-types.md#Azure.ResourceManager.Foundations.TenantScope)
- [`TrackedResourceBase`](./data-types.md#Azure.ResourceManager.Foundations.TrackedResourceBase)
- [`TrackedResource`](./data-types.md#Azure.ResourceManager.Foundations.TrackedResource)
- [`UserAssignedIdentity`](./data-types.md#Azure.ResourceManager.Foundations.UserAssignedIdentity)
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ using TypeSpec.Http;
using TypeSpec.Rest;
using TypeSpec.Versioning;
using Azure.ResourceManager;
using Azure.ResourceManager.Foundations;
// using Azure.ResourceManager.Foundations;
allenjzhang marked this conversation as resolved.
Show resolved Hide resolved
using Autorest;

@armProviderNamespace
Expand Down Expand Up @@ -164,7 +164,7 @@ interface MarketplaceAgreements extends ResourceListBySubscription<ConfluentAgre
@doc("Create a new marketplace agreement.")
@armResourceCreateOrUpdate(ConfluentAgreementResource)
create(
...SubscriptionScope<ConfluentAgreementResource>,
...Foundations.SubscriptionScope<ConfluentAgreementResource>,
...KeysOf<ConfluentAgreementResource>,

@doc("The agreement details.")
Expand Down
21 changes: 11 additions & 10 deletions packages/typespec-azure-resource-manager/lib/arm.foundations.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ model ExtensionBaseParameters is TenantBaseParameters {
@doc("The updatable properties of the {name}.", Resource)
@friendlyName("{name}UpdateProperties", Resource)
model ResourceUpdateModelProperties<
Resource extends ArmResource,
Resource extends Foundations.Resource,
Properties extends TypeSpec.Reflection.Model
> is OptionalProperties<UpdateableProperties<Properties>>;

Expand All @@ -111,7 +111,7 @@ model ResourceUpdateModelProperties<
@friendlyName("{name}Update", Resource)
@omitIfEmpty("properties")
model ResourceUpdateModel<
Resource extends ArmResource,
Resource extends Foundations.Resource,
Properties extends TypeSpec.Reflection.Model
> is OptionalProperties<UpdateableProperties<OmitProperties<Resource, "Name" | "name">>> {
@extension("x-ms-client-flatten", true)
Expand All @@ -124,47 +124,48 @@ model ResourceUpdateModel<
*/
@doc("The type used for updating tags in {name} resources.", Resource)
@friendlyName("{name}TagsUpdate", Resource)
model TagsUpdateModel<Resource extends ArmResource> {
model TagsUpdateModel<Resource extends Foundations.Resource> {
...ArmTagsProperty;
}

// Tenant resource operation definitions

alias TenantParentScope<Resource extends ArmResource> = TenantScope<Resource>;
alias TenantParentScope<Resource extends Foundations.Resource> = TenantScope<Resource>;

/**
* Parameter model for listing a resource at the tenant scope
* @template Resource The type of the resource.
*/
model TenantScope<Resource extends ArmResource>
model TenantScope<Resource extends Foundations.Resource>
is ResourceParentParameters<Resource, TenantBaseParameters>;

/**
* Parameter model for listing a resource at the subscription scope
* @template Resource The type of the resource.
*/
model SubscriptionScope<Resource extends ArmResource>
model SubscriptionScope<Resource extends Foundations.Resource>
is ResourceParentParameters<Resource, SubscriptionBaseParameters>;

/**
* Parameter model for listing a resource at the location scope
* @template Resource The type of the resource.
*/
model LocationScope<Resource extends ArmResource>
model LocationScope<Resource extends Foundations.Resource>
is ResourceParentParameters<Resource, LocationBaseParameters>;

/**
* Parameter model for listing an extension resource
* @template Resource The type of the resource.
*/
model ExtensionScope<Resource extends ArmResource>
model ExtensionScope<Resource extends Foundations.Resource>
is ResourceParentParameters<Resource, ExtensionBaseParameters>;

/**
* Parameter model for listing a resource at the resource group scope
* @template Resource The type of the resource.
*/
model ResourceGroupScope<Resource extends ArmResource> is ResourceParentParameters<Resource>;
model ResourceGroupScope<Resource extends Foundations.Resource>
is ResourceParentParameters<Resource>;

/**
* The type used for update operations of the resource.
Expand All @@ -174,7 +175,7 @@ model ResourceGroupScope<Resource extends ArmResource> is ResourceParentParamete
@doc("The type used for update operations of the {name}.", Resource)
@friendlyName("{name}Update", Resource)
model ProxyResourceUpdateModel<
Resource extends ArmResource,
Resource extends Foundations.Resource,
Properties extends TypeSpec.Reflection.Model
> {
@extension("x-ms-client-flatten", true)
Expand Down
1 change: 1 addition & 0 deletions packages/typespec-azure-resource-manager/lib/arm.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import "@azure-tools/typespec-azure-core";

import "./arm.foundations.tsp";
import "./common-types/common-types.tsp";
import "./common-types/backcompat.tsp";
import "./common-types/types.tsp";
import "./common-types/managed-identity.tsp";
import "./common-types/private-links.tsp";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
namespace Azure.ResourceManager.Foundations;

#deprecated "Please use Foundations.Resource instead of Foundations.ArmResource"
alias ArmResource = Resource;

#deprecated "Please use Foundations.TrackedResource instead of Foundations.TrackedResourceBase"
alias TrackedResourceBase = TrackedResource;

#deprecated "Please use Foundations.ProxyResource instead of Foundations.ProxyResourceBase"
alias ProxyResourceBase = ProxyResource;

#deprecated "Please use Foundations.ProxyResource instead of Foundations.ExtensionResourceBase"
alias ExtensionResourceBase = ExtensionResource;

#deprecated "Please use Foundations.Sku instead of Foundations.ResourceSkuType"
alias ResourceSkuType = Sku;

#deprecated "Please use Foundations.Plan instead of Foundations.ResourcePlanType"
alias ResourcePlanType = Plan;
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ model PrivateEndpoint {
}

/** The private endpoint connection resource */
model PrivateEndpointConnection extends Azure.ResourceManager.Foundations.ProxyResourceBase {
model PrivateEndpointConnection extends Azure.ResourceManager.Foundations.ProxyResource {
/** The private endpoint connection properties */
properties?: PrivateEndpointConnectionProperties;
}
Expand Down Expand Up @@ -120,7 +120,7 @@ union PrivateEndpointServiceConnectionStatus {
string,
}

model PrivateLinkResource extends Azure.ResourceManager.Foundations.ProxyResourceBase {
model PrivateLinkResource extends Azure.ResourceManager.Foundations.ProxyResource {
/** Properties of the private link resource. */
properties?: PrivateLinkResourceProperties;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using TypeSpec.Http;
using TypeSpec.OpenAPI;
using Azure.Core;
using Azure.ResourceManager.Private;

namespace Azure.ResourceManager.Foundations;
Expand All @@ -11,24 +12,34 @@ model ArmResourceBase {}
* Base model that defines common properties for all Azure Resource Manager resources.
*/
@doc("Common properties for all Azure Resource Manager resources.")
model ArmResource extends ArmResourceBase {
model Resource extends ArmResourceBase {
allenjzhang marked this conversation as resolved.
Show resolved Hide resolved
@doc("Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}")
@visibility("read")
id: string;
id?: armResourceIdentifier;
allenjzhang marked this conversation as resolved.
Show resolved Hide resolved

@doc("The name of the resource")
@visibility("read")
name: string;
name?: string;

@doc("The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or \"Microsoft.Storage/storageAccounts\"")
@visibility("read")
type: string;
type?: string;

@doc("Azure Resource Manager metadata containing createdBy and modifiedBy information.")
@visibility("read")
systemData?: SystemData;
}

/** The resource model definition for an Azure Resource Manager resource with an etag. */
@armCommonDefinition("TrackedResource", Azure.ResourceManager.CommonTypes.Versions.v3)
@armCommonDefinition("TrackedResource", Azure.ResourceManager.CommonTypes.Versions.v4)
@armCommonDefinition("TrackedResource", Azure.ResourceManager.CommonTypes.Versions.v5)
model AzureEntityResource extends Resource {
/** Resource Etag. */
@visibility("read")
etag: string;
}

/**
* Standard type definition for Azure Resource Manager Tags property.
*
Expand All @@ -46,8 +57,8 @@ model ArmTagsProperty {
@armCommonDefinition("TrackedResource", Azure.ResourceManager.CommonTypes.Versions.v3)
@armCommonDefinition("TrackedResource", Azure.ResourceManager.CommonTypes.Versions.v4)
@armCommonDefinition("TrackedResource", Azure.ResourceManager.CommonTypes.Versions.v5)
@doc("The resource model definition for an Azure Resource Manager tracked top level resource")
model TrackedResourceBase extends ArmResource {
@doc("The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'")
model TrackedResource extends Resource {
@doc("The geo-location where the resource lives")
@visibility("read", "create")
location: string;
Expand All @@ -62,7 +73,7 @@ model TrackedResourceBase extends ArmResource {
@armCommonDefinition("ProxyResource", Azure.ResourceManager.CommonTypes.Versions.v3)
@armCommonDefinition("ProxyResource", Azure.ResourceManager.CommonTypes.Versions.v4)
@armCommonDefinition("ProxyResource", Azure.ResourceManager.CommonTypes.Versions.v5)
model ProxyResourceBase extends ArmResource {}
model ProxyResource extends Resource {}

/**
* The base extension resource.
Expand All @@ -72,7 +83,7 @@ model ProxyResourceBase extends ArmResource {}
@armCommonDefinition("ProxyResource", Azure.ResourceManager.CommonTypes.Versions.v3)
@armCommonDefinition("ProxyResource", Azure.ResourceManager.CommonTypes.Versions.v4)
@armCommonDefinition("ProxyResource", Azure.ResourceManager.CommonTypes.Versions.v5)
model ExtensionResourceBase extends ArmResource {}
model ExtensionResource extends Resource {}

/**
* The SKU (Stock Keeping Unit) assigned to this resource.
Expand All @@ -81,7 +92,7 @@ model ExtensionResourceBase extends ArmResource {}
@armCommonDefinition("Sku", Azure.ResourceManager.CommonTypes.Versions.v3)
@armCommonDefinition("Sku", Azure.ResourceManager.CommonTypes.Versions.v4)
@armCommonDefinition("Sku", Azure.ResourceManager.CommonTypes.Versions.v5)
model ResourceSkuType {
model Sku {
@doc("The name of the SKU, usually a combination of letters and numbers, for example, 'P3'")
name: string;

Expand Down Expand Up @@ -379,7 +390,7 @@ union createdByType {
@armCommonDefinition("Plan", Azure.ResourceManager.CommonTypes.Versions.v3)
@armCommonDefinition("Plan", Azure.ResourceManager.CommonTypes.Versions.v4)
@armCommonDefinition("Plan", Azure.ResourceManager.CommonTypes.Versions.v5)
model ResourcePlanType {
model Plan {
@doc("A user defined name of the 3rd Party Artifact that is being procured.")
name: string;

Expand Down
Loading
Loading