-
Notifications
You must be signed in to change notification settings - Fork 83
Add Relationship Base Type #4892
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
Open
alexchro93
wants to merge
10
commits into
main
Choose a base branch
from
chrostow/base-rel
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
3c97bab
Add relationship base type
alexchro93 f0345db
Merge origin/main into chrostow/base-rel
alexchro93 b286b36
Update relationship model
alexchro93 3146af4
Merge remote-tracking branch 'origin/main' into chrostow/base-rel
alexchro93 8df8c5c
Update chronus
alexchro93 c931138
Merge remote-tracking branch 'origin/main' into chrostow/base-rel
alexchro93 cd9885c
Merge branch 'main' into chrostow/base-rel
markcowl 1251de2
Address some PR feedback
alexchro93 1ab1695
Merge remote-tracking branch 'origin/main' into chrostow/base-rel
alexchro93 7b6343d
Address PR comments about base type
alexchro93 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
.chronus/changes/add-relationship-base-type-2026-7-10-17-13-0.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| --- | ||
| changeKind: feature | ||
| packages: | ||
| - "@azure-tools/typespec-azure-resource-manager" | ||
| - "@azure-tools/typespec-azure-rulesets" | ||
| --- | ||
|
|
||
| Add the experimental Relationship base type for Azure Resource Manager extension resources, including flat relationship properties and lint validation for Relationship base type conformance. | ||
107 changes: 107 additions & 0 deletions
107
packages/samples/specs/resource-manager/resource-types/relationship/main.tsp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| import "@typespec/rest"; | ||
| import "@typespec/versioning"; | ||
| import "@azure-tools/typespec-azure-core"; | ||
| import "@azure-tools/typespec-azure-resource-manager"; | ||
|
|
||
| using Http; | ||
| using Rest; | ||
| using Versioning; | ||
| using Azure.ResourceManager; | ||
| using Azure.ResourceManager.BaseTypes.Relationships; | ||
|
|
||
| /** Contoso Relationships Resource Provider management API. */ | ||
| @armProviderNamespace | ||
| @service(#{ title: "ContosoRelationshipsClient" }) | ||
| @versioned(Versions) | ||
| namespace Microsoft.ContosoRelationships; | ||
|
|
||
| /** Contoso Relationships API versions */ | ||
| enum Versions { | ||
| /** 2024-06-01 version */ | ||
| @armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v5) | ||
| `2024-06-01`, | ||
| } | ||
|
|
||
| interface Operations extends Azure.ResourceManager.Operations {} | ||
|
|
||
| /** Metadata for a Contoso dependency relationship. */ | ||
| model DependencyOfMetadata { | ||
| /** The type of the relationship source. */ | ||
| sourceType: string; | ||
|
|
||
| /** The type of the relationship target. */ | ||
| targetType: string; | ||
|
|
||
| /** A human-readable relationship description. */ | ||
| description?: string; | ||
| } | ||
|
|
||
| /** Origin information for a Contoso dependency relationship. */ | ||
| model DependencyOfOriginInformation { | ||
| /** The origin type. */ | ||
| relationshipOriginType: string; | ||
|
|
||
| /** The discovery engine that found the relationship. */ | ||
| discoveryEngine?: string; | ||
| } | ||
|
|
||
| /** Provisioning state values for a Contoso dependency relationship async flow. */ | ||
| @Azure.Core.lroStatus | ||
| union DependencyOfProvisioningState { | ||
| /** Include standard terminal provisioning states. */ | ||
| ResourceProvisioningState, | ||
|
|
||
| /** The dependency relationship creation has been accepted. */ | ||
| Accepted: "Accepted", | ||
|
|
||
| /** The dependency relationship is being provisioned. */ | ||
| Provisioning: "Provisioning", | ||
|
|
||
| /** The dependency relationship is being deleted. */ | ||
| Deleting: "Deleting", | ||
|
|
||
| string, | ||
| } | ||
|
|
||
| /** Properties for a Contoso dependency relationship. */ | ||
| model DependencyOfProperties | ||
| is RelationshipProperties<ProvisioningState = DependencyOfProvisioningState> { | ||
| /** Metadata describing the relationship source and target types. */ | ||
| metadata: DependencyOfMetadata; | ||
|
|
||
| /** Information about the origin of the relationship. */ | ||
| originInformation?: DependencyOfOriginInformation; | ||
| } | ||
|
|
||
| /** | ||
| * A dependency relationship between a source scope and target entity. | ||
| */ | ||
| #suppress "@azure-tools/typespec-azure-resource-manager/basetypes-experimental" "Experimental BaseTypes" | ||
| model DependencyOf is Relationship<DependencyOfProperties> { | ||
| ...ResourceNameParameter< | ||
| Resource = DependencyOf, | ||
| KeyName = "relationshipName", | ||
| SegmentName = "dependencyOf", | ||
| NamePattern = "^[a-zA-Z0-9_.-]{1,64}$" | ||
| >; | ||
| } | ||
|
|
||
| /** Defines dependency relationship operations for a source scope. */ | ||
| interface DependencyOfOps<Scope extends Azure.ResourceManager.Foundations.SimpleResource> { | ||
| get is Extension.Read<Scope, DependencyOf>; | ||
| create is Extension.CreateOrReplaceAsync<Scope, DependencyOf>; | ||
| update is Extension.CustomPatchAsync< | ||
| Scope, | ||
| DependencyOf, | ||
| Azure.ResourceManager.Foundations.ResourceUpdateModel<DependencyOf, DependencyOfProperties> | ||
| >; | ||
| delete is Extension.DeleteWithoutOkAsync<Scope, DependencyOf>; | ||
| list is Extension.ListByTarget<Scope, DependencyOf>; | ||
| } | ||
|
|
||
| /** | ||
| * Operations over any source scope. | ||
| * Routes at: {scope}/providers/Microsoft.ContosoRelationships/dependencyOf/{relationshipName} | ||
| */ | ||
| @armResourceOperations | ||
| interface DependencyOfRelationships extends DependencyOfOps<Extension.ScopeParameter> {} |
7 changes: 7 additions & 0 deletions
7
packages/samples/specs/resource-manager/resource-types/relationship/sample-config.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| title: Relationship Base Type | ||
| description: Sample specification for a resource implementing the Relationship base type. | ||
|
|
||
| llmstxt: false | ||
| playground: false | ||
|
|
||
| order: 9 |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add a short example of usage here - this will go into the release notes and the release blog post