-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Convert Notificationhubs Swagger to Tsp #34320
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
mcgallan
wants to merge
35
commits into
Azure:main
Choose a base branch
from
mcgallan:Convert-Notificationhubs
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
35 commits
Select commit
Hold shift + click to select a range
cb9e762
convert generated
mcgallan 891a429
update
mcgallan ba41586
update
mcgallan 3a8d2ef
update
mcgallan c06ecaf
update
mcgallan ca42d48
Merge remote-tracking branch 'upstream/main' into Convert-Notificatio…
mcgallan d59b5ba
Merge branch 'main' of https://github.com/Azure/azure-rest-api-specs …
123422f
Merge branch 'Convert-Notificationhubs' of https://github.com/mcgalla…
a37cb57
update
mcgallan 3af5fc9
update
mcgallan 39b7d8a
Merge branch 'Convert-Notificationhubs' of https://github.com/mcgalla…
9c8aec9
update
mcgallan 68885fb
fix name
mcgallan 79e70f0
Merge branch 'main' into Convert-Notificationhubs
mcgallan bbe4112
update
mcgallan d178f91
Merge branch 'Convert-Notificationhubs' of https://github.com/mcgalla…
mcgallan f0e5d33
update
mcgallan b53585f
update
mcgallan b6c9684
update
mcgallan 84761fc
fix
mcgallan 91b30fa
Merge branch 'main' into Convert-Notificationhubs
mcgallan 3dbdf19
update
mcgallan dee7799
Merge branch 'main' into Convert-Notificationhubs
v-jiaodi 8e58cf4
Merge remote-tracking branch 'upstream/main' into Convert-Notificatio…
melina5656 9d47626
Delete conditionalClientFlatten
melina5656 4968c34
update
mcgallan e7be1c4
update justification
melina5656 99da564
update
melina5656 0e461f7
update
melina5656 a9244cf
Merge remote-tracking branch 'upstream/main' into Convert-Notificatio…
mcgallan 67b11dc
Merge branch 'Convert-Notificationhubs' of https://github.com/mcgalla…
mcgallan b1538ce
update
mcgallan c9d272e
remove legacy.tsp
welovej 8efcc17
Merge branch 'Convert-Notificationhubs' of https://github.com/mcgalla…
welovej 1273ec6
update
mcgallan 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
156 changes: 156 additions & 0 deletions
156
specification/notificationhubs/Notificationhubs.Management/NamespaceResource.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,156 @@ | ||
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.NotificationHubs; | ||
/** | ||
* Notification Hubs Namespace Resource. | ||
*/ | ||
#suppress "@azure-tools/typespec-azure-core/no-private-usage" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
#suppress "@azure-tools/typespec-azure-core/no-private-usage" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
@Azure.ResourceManager.Private.armResourceInternal(NamespaceProperties) | ||
@Http.Private.includeInapplicableMetadataInPayload(false) | ||
model NamespaceResource extends Foundations.TrackedResource { | ||
...ResourceNameParameter< | ||
Resource = NamespaceResource, | ||
KeyName = "namespaceName", | ||
SegmentName = "namespaces", | ||
NamePattern = "^[a-zA-Z][a-zA-Z0-9-]*$" | ||
>; | ||
|
||
/** | ||
* The Sku description for a namespace | ||
*/ | ||
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
sku: Sku; | ||
|
||
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
#suppress "@azure-tools/typespec-azure-core/no-private-usage" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
@doc("The resource-specific properties for this resource.") | ||
@Azure.ResourceManager.Private.armResourcePropertiesOptionality(true) | ||
properties?: NamespaceProperties; | ||
} | ||
|
||
@armResourceOperations | ||
interface NamespaceResources { | ||
/** | ||
* Returns the given namespace. | ||
*/ | ||
#suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
@operationId("Namespaces_Get") | ||
get is ArmResourceRead<NamespaceResource>; | ||
|
||
/** | ||
* Creates / Updates a Notification Hub namespace. This operation is idempotent. | ||
*/ | ||
#suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
@operationId("Namespaces_CreateOrUpdate") | ||
createOrUpdate is ArmResourceCreateOrReplaceAsync<NamespaceResource>; | ||
|
||
/** | ||
* Patches the existing namespace. | ||
*/ | ||
#suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
@patch(#{ implicitOptionality: false }) | ||
@operationId("Namespaces_Update") | ||
update is ArmCustomPatchSync< | ||
NamespaceResource, | ||
PatchModel = NamespacePatchParameters | ||
>; | ||
|
||
/** | ||
* Deletes an existing namespace. This operation also removes all associated notificationHubs under the namespace. | ||
*/ | ||
#suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
@operationId("Namespaces_Delete") | ||
delete is ArmResourceDeleteSync<NamespaceResource>; | ||
|
||
/** | ||
* Lists the available namespaces within a resource group. | ||
*/ | ||
#suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
@operationId("Namespaces_List") | ||
list is ArmResourceListByParent< | ||
NamespaceResource, | ||
Parameters = { | ||
/** | ||
* Skip token for subsequent requests. | ||
*/ | ||
@query("$skipToken") | ||
$skipToken?: string; | ||
|
||
/** | ||
* Maximum number of results to return. | ||
*/ | ||
@query("$top") | ||
$top?: int32 = 100; | ||
}, | ||
Response = NamespaceListResult | ||
>; | ||
|
||
/** | ||
* Lists all the available namespaces within the subscription. | ||
*/ | ||
#suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
@operationId("Namespaces_ListAll") | ||
listAll is ArmListBySubscription< | ||
NamespaceResource, | ||
Parameters = { | ||
/** | ||
* Skip token for subsequent requests. | ||
*/ | ||
@query("$skipToken") | ||
$skipToken?: string; | ||
|
||
/** | ||
* Maximum number of results to return. | ||
*/ | ||
@query("$top") | ||
$top?: int32 = 100; | ||
}, | ||
Response = NamespaceListResult | ||
>; | ||
|
||
/** | ||
* Checks the availability of the given notificationHub in a namespace. | ||
*/ | ||
#suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
@operationId("NotificationHubs_CheckNotificationHubAvailability") | ||
checkNotificationHubAvailability is ArmResourceActionSync< | ||
NamespaceResource, | ||
CheckAvailabilityParameters, | ||
ArmResponse<CheckAvailabilityResult> | ||
>; | ||
|
||
/** | ||
* Lists the PNS credentials associated with a namespace. | ||
*/ | ||
#suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
@action("pnsCredentials") | ||
@operationId("Namespaces_GetPnsCredentials") | ||
getPnsCredentials is ArmResourceActionSync< | ||
NamespaceResource, | ||
void, | ||
ArmResponse<PnsCredentialsResource> | ||
>; | ||
} | ||
|
||
@@maxLength(NamespaceResource.name, 50); | ||
@@minLength(NamespaceResource.name, 1); | ||
@@doc(NamespaceResource.name, "Namespace name"); | ||
@@doc(NamespaceResource.properties, "Represents namespace properties."); | ||
@@doc(NamespaceResources.createOrUpdate::parameters.resource, | ||
"Request content." | ||
); | ||
@@doc(NamespaceResources.update::parameters.properties, "Request content."); | ||
@@doc(NamespaceResources.checkNotificationHubAvailability::parameters.body, | ||
"Request content." | ||
); |
125 changes: 125 additions & 0 deletions
125
specification/notificationhubs/Notificationhubs.Management/NotificationHubResource.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,125 @@ | ||
import "@azure-tools/typespec-azure-core"; | ||
import "@azure-tools/typespec-azure-resource-manager"; | ||
import "@typespec/openapi"; | ||
import "@typespec/rest"; | ||
import "./models.tsp"; | ||
import "./NamespaceResource.tsp"; | ||
|
||
using TypeSpec.Rest; | ||
using Azure.ResourceManager; | ||
using TypeSpec.Http; | ||
using TypeSpec.OpenAPI; | ||
|
||
namespace Microsoft.NotificationHubs; | ||
/** | ||
* Notification Hub Resource. | ||
*/ | ||
@parentResource(NamespaceResource) | ||
model NotificationHubResource | ||
is Azure.ResourceManager.TrackedResource<NotificationHubProperties> { | ||
...ResourceNameParameter< | ||
Resource = NotificationHubResource, | ||
KeyName = "notificationHubName", | ||
SegmentName = "notificationHubs", | ||
NamePattern = "^[a-zA-Z][a-zA-Z0-9-./_]*$" | ||
>; | ||
|
||
/** | ||
* The Sku description for a namespace | ||
*/ | ||
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
sku?: Sku; | ||
} | ||
|
||
@armResourceOperations | ||
interface NotificationHubResources { | ||
/** | ||
* Gets the notification hub. | ||
*/ | ||
#suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
@operationId("NotificationHubs_Get") | ||
get is ArmResourceRead<NotificationHubResource>; | ||
|
||
/** | ||
* Creates/Update a NotificationHub in a namespace. | ||
*/ | ||
#suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
@operationId("NotificationHubs_CreateOrUpdate") | ||
createOrUpdate is ArmResourceCreateOrReplaceSync<NotificationHubResource>; | ||
|
||
/** | ||
* Patch a NotificationHub in a namespace. | ||
*/ | ||
#suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
@patch(#{ implicitOptionality: false }) | ||
@operationId("NotificationHubs_Update") | ||
update is ArmCustomPatchSync< | ||
NotificationHubResource, | ||
PatchModel = NotificationHubPatchParameters | ||
>; | ||
|
||
/** | ||
* Deletes a notification hub associated with a namespace. | ||
*/ | ||
#suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
@operationId("NotificationHubs_Delete") | ||
delete is ArmResourceDeleteSync<NotificationHubResource>; | ||
|
||
/** | ||
* Lists the notification hubs associated with a namespace. | ||
*/ | ||
#suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
@operationId("NotificationHubs_List") | ||
list is ArmResourceListByParent< | ||
NotificationHubResource, | ||
Parameters = { | ||
/** | ||
* Continuation token. | ||
*/ | ||
@query("$skipToken") | ||
$skipToken?: string; | ||
|
||
/** | ||
* Page size. | ||
*/ | ||
@query("$top") | ||
$top?: int32 = 100; | ||
}, | ||
Response = NotificationHubListResult | ||
>; | ||
|
||
/** | ||
* Test send a push notification. | ||
*/ | ||
#suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
@action("debugsend") | ||
@operationId("NotificationHubs_DebugSend") | ||
debugSend is ArmResourceActionSync< | ||
NotificationHubResource, | ||
void, | ||
ArmResponse<DebugSendResponse> | ||
>; | ||
|
||
/** | ||
* Lists the PNS Credentials associated with a notification hub. | ||
*/ | ||
#suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
@action("pnsCredentials") | ||
@operationId("NotificationHubs_GetPnsCredentials") | ||
getPnsCredentials is ArmResourceActionSync< | ||
NotificationHubResource, | ||
void, | ||
ArmResponse<PnsCredentialsResource> | ||
>; | ||
} | ||
|
||
@@maxLength(NotificationHubResource.name, 265); | ||
@@minLength(NotificationHubResource.name, 1); | ||
@@doc(NotificationHubResource.name, "Notification Hub name"); | ||
@@doc(NotificationHubResource.properties, "NotificationHub properties."); | ||
@@doc(NotificationHubResources.createOrUpdate::parameters.resource, | ||
"Request content." | ||
); | ||
@@doc(NotificationHubResources.update::parameters.properties, | ||
"Request content." | ||
); |
73 changes: 73 additions & 0 deletions
73
...cation/notificationhubs/Notificationhubs.Management/PrivateEndpointConnectionResource.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,73 @@ | ||
import "@azure-tools/typespec-azure-core"; | ||
import "@azure-tools/typespec-azure-resource-manager"; | ||
import "@typespec/openapi"; | ||
import "@typespec/rest"; | ||
import "./models.tsp"; | ||
import "./NamespaceResource.tsp"; | ||
|
||
using TypeSpec.Rest; | ||
using Azure.ResourceManager; | ||
using TypeSpec.Http; | ||
using TypeSpec.OpenAPI; | ||
|
||
namespace Microsoft.NotificationHubs; | ||
/** | ||
* Represents a Private Endpoint Connection ARM resource - a sub-resource of Notification Hubs namespace. | ||
*/ | ||
@parentResource(NamespaceResource) | ||
model PrivateEndpointConnectionResource | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, it's original name. |
||
is Azure.ResourceManager.ProxyResource<PrivateEndpointConnectionProperties> { | ||
...ResourceNameParameter< | ||
Resource = PrivateEndpointConnectionResource, | ||
KeyName = "privateEndpointConnectionName", | ||
SegmentName = "privateEndpointConnections", | ||
NamePattern = "^[a-zA-Z][a-zA-Z0-9-]*\\.[a-fA-F0-9\\-]+$" | ||
>; | ||
} | ||
|
||
@armResourceOperations | ||
interface PrivateEndpointConnectionResources { | ||
/** | ||
* Returns a Private Endpoint Connection with a given name. | ||
* This is a public API that can be called directly by Notification Hubs users. | ||
*/ | ||
#suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
@operationId("PrivateEndpointConnections_Get") | ||
get is ArmResourceRead<PrivateEndpointConnectionResource>; | ||
|
||
/** | ||
* Approves or rejects Private Endpoint Connection. | ||
* This is a public API that can be called directly by Notification Hubs users. | ||
*/ | ||
#suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
@operationId("PrivateEndpointConnections_Update") | ||
update is ArmResourceCreateOrReplaceAsync<PrivateEndpointConnectionResource>; | ||
|
||
/** | ||
* Deletes the Private Endpoint Connection. | ||
* This is a public API that can be called directly by Notification Hubs users. | ||
*/ | ||
#suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
@operationId("PrivateEndpointConnections_Delete") | ||
delete is ArmResourceDeleteWithoutOkAsync<PrivateEndpointConnectionResource>; | ||
|
||
/** | ||
* Returns all Private Endpoint Connections that belong to the given Notification Hubs namespace. | ||
* This is a public API that can be called directly by Notification Hubs users. | ||
*/ | ||
#suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" | ||
@operationId("PrivateEndpointConnections_List") | ||
list is ArmResourceListByParent<PrivateEndpointConnectionResource>; | ||
} | ||
|
||
@@maxLength(PrivateEndpointConnectionResource.name, 87); | ||
@@minLength(PrivateEndpointConnectionResource.name, 1); | ||
@@doc(PrivateEndpointConnectionResource.name, | ||
"Private Endpoint Connection Name" | ||
); | ||
@@doc(PrivateEndpointConnectionResource.properties, | ||
"Private Endpoint Connection properties." | ||
); | ||
@@doc(PrivateEndpointConnectionResources.update::parameters.resource, | ||
"Description of the Private Endpoint Connection resource." | ||
); |
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.
Same as Weidong, all the interface names now have a suffix "Resources." This change introduces many breaking changes: https://github.com/azure-sdk/azure-sdk-for-go/pull/14591/files. Should they remain consistent with the previous naming?