forked from Azure/azure-sdk-for-js
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Service Bus] Adding the missing pieces for the ATOM API (Azure#9221)
* Update Queue APIs aper the .NET proposal * remove @internal @ignore tags wherever required and generate API report * more exports * more and more exports * Add token credential constructor overlaod * doesExist() for queue, topic and subscription * generate API report * api extractor and ts-config (TO BE REVERTED) * feedback from the service team * update index.ts * update API report * Update queue related imports in tests * revert api-extractor and tsconfig changes to allow compiling tests * fix build failures of ATOM API tests * changes to rule options and interfaces * fix test failures * changes to Topic APIs * fix build failures * generate API report * subscription APIs updated * fix build failures * generate API report * fix API report warnings * changes to rule APIs * fix build failures * generate API report * getNamespaceProperties API * namespace info improvement + API report * fix warnings in the API report * generatre API report * resolve merge conflicts and organize imports * fix the warnings from API report * API report * tests for getRuntimeInfo API for a single entity * remove messageCount from *Description APIs * remove unused helper * test for Get namespace properties * tests for entityExists * tests for getEntitiesRuntimeInfo * Add changelog * Changelog * fix subscription description tests * subscription description - fix second test * fix queue options tests * queueOptions - updateQueue test fix * subscriptionOptions - updateSubscription test fix * remove token credential overload * throwError for *Exists * update doc comments for get APIs * update docs as suggested by Ramya
- Loading branch information
1 parent
2d7750b
commit 1cfc819
Showing
10 changed files
with
1,115 additions
and
85 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
83 changes: 83 additions & 0 deletions
83
sdk/servicebus/service-bus/src/serializers/namespaceResourceSerializer.ts
This file contains 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,83 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
|
||
import { HttpOperationResponse } from "@azure/core-http"; | ||
import { | ||
AtomXmlSerializer, | ||
deserializeAtomXmlResponse, | ||
serializeToAtomXmlRequest | ||
} from "../util/atomXmlHelper"; | ||
import { getInteger, getString } from "../util/utils"; | ||
|
||
/** | ||
* Represents the metadata related to a service bus namespace. | ||
* | ||
* @export | ||
* @interface NamespaceProperties | ||
*/ | ||
export interface NamespaceProperties { | ||
/** | ||
* The time at which the namespace was created. | ||
*/ | ||
createdOn: string; | ||
/** | ||
* The SKU/tier of the namespace. | ||
* "Basic", "Standard" and "Premium" | ||
*/ | ||
messagingSku: string; | ||
/** | ||
* The last time at which the namespace was modified. | ||
*/ | ||
updatedOn: string; | ||
/** | ||
* Name of the namespace. | ||
*/ | ||
name: string; | ||
/** | ||
* Type of entities present in the namespace. | ||
*/ | ||
namespaceType: string; | ||
/** | ||
* Number of messaging units allocated for namespace. | ||
* Valid only for Premium namespaces. | ||
* messagingUnits would be set to `undefined` for Basic and Standard namespaces. | ||
*/ | ||
messagingUnits: number | undefined; | ||
} | ||
|
||
/** | ||
* @internal | ||
* @ignore | ||
* Builds the namespace object from the raw json object gotten after deserializing the | ||
* response from the service | ||
* @param rawNamespace | ||
*/ | ||
export function buildNamespace(rawNamespace: any): NamespaceProperties { | ||
const messagingSku = getString(rawNamespace["MessagingSKU"], "messagingSku"); | ||
return { | ||
createdOn: getString(rawNamespace["CreatedTime"], "createdOn"), | ||
messagingSku: messagingSku, | ||
updatedOn: getString(rawNamespace["ModifiedTime"], "updatedOn"), | ||
name: getString(rawNamespace["Name"], "name"), | ||
namespaceType: getString(rawNamespace["NamespaceType"], "namespaceType"), | ||
messagingUnits: | ||
messagingSku === "Premium" | ||
? getInteger(rawNamespace["MessagingUnits"], "messagingUnits") | ||
: undefined | ||
}; | ||
} | ||
|
||
/** | ||
* @internal | ||
* @ignore | ||
* Atom XML Serializer for Namespaces. | ||
*/ | ||
export class NamespaceResourceSerializer implements AtomXmlSerializer { | ||
serialize(): object { | ||
return serializeToAtomXmlRequest("NamespaceProperties", {}); | ||
} | ||
|
||
async deserialize(response: HttpOperationResponse): Promise<HttpOperationResponse> { | ||
return deserializeAtomXmlResponse(["name"], response); | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.