Skip to content

Commit

Permalink
[Service Bus] ATOM API - Update update methods with better param na…
Browse files Browse the repository at this point in the history
…mes/types and rephrased docs 👓 (Azure#12013)

### Issue Azure#11860

We expect users to pass the modified properties object to the updateQueue method. However, we don't return just the properties object anywhere, we always return the properties wrapped in a response.
#### The intention behind this PR is to 
- remove the users' confusion on what should be passed into the update methods 
- give us more flexibility to add eTags support in a non-breaking way if the service gives better support for eTags!
  • Loading branch information
HarshaNalluru authored Oct 28, 2020
1 parent c0f767b commit e64a3aa
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 20 deletions.
4 changes: 4 additions & 0 deletions sdk/servicebus/service-bus/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,12 @@
- The interface `AcceptSessionOptions` followed by options that are passed to `ServiceBusClient` `acceptSession` and `acceptNextSession` methods is renamed to `ServiceBusSessionReceiverOptions`.
- The property `maxAutoRenewLockDurationInMs` of interface `ServiceBusSessionReceiverOptions` is renamed to `maxAutoLockRenewalDurationInMs`.
- `ServiceBusSender.scheduleMessages` method signature updated: `scheduledEnqueueTimeUtc` and `messages` parameters are swapped.
- `NamespaceProperties` interface property "messageSku" type changed from "string" to string literal type "Basic" | "Premium" | "Standard". [PR 11810](https://github.com/Azure/azure-sdk-for-js/pull/11810)
- `NamespaceProperties` interface property "namespaceType" has been removed. [PR 11995](https://github.com/Azure/azure-sdk-for-js/pull/11995)
- Interfaces corresponding to the returned responses from the methods under the `ServiceBusAdministrationClient` such as `NamespacePropertiesResponse`, `QueueResponse`, `TopicRuntimePropertiesResponse` have been removed in favor of using generic type `WithResponse<T>` for a cleaner API surface.
[PR 10491](https://github.com/Azure/azure-sdk-for-js/pull/10491)
- Updated the `update{Entity}` methods under `ServiceBusAdministrationClient` with relevant param names and types, more docs.
[PR 12013](https://github.com/Azure/azure-sdk-for-js/pull/12013)
- The raw responses(`_response`) in the returned objects from any of the methods under the `ServiceBusAdministrationClient` have been updated to return only the `{request, status, headers}`, properties such as `parsedHeaders`, `parsedBody` have been removed.
[PR 12015](https://github.com/Azure/azure-sdk-for-js/pull/12015)
- `viaPartitionKey` property of interface `ServiceMessageBus` has been removed until we implement the [Transactions feature of Service Bus](https://docs.microsoft.com/azure/service-bus-messaging/service-bus-transactions).
Expand Down
8 changes: 4 additions & 4 deletions sdk/servicebus/service-bus/review/service-bus.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -308,10 +308,10 @@ export class ServiceBusAdministrationClient extends ServiceClient {
ruleExists(topicName: string, subscriptionName: string, ruleName: string, operationOptions?: OperationOptions): Promise<boolean>;
subscriptionExists(topicName: string, subscriptionName: string, operationOptions?: OperationOptions): Promise<boolean>;
topicExists(topicName: string, operationOptions?: OperationOptions): Promise<boolean>;
updateQueue(queue: QueueProperties, operationOptions?: OperationOptions): Promise<WithResponse<QueueProperties>>;
updateRule(topicName: string, subscriptionName: string, rule: RuleProperties, operationOptions?: OperationOptions): Promise<WithResponse<RuleProperties>>;
updateSubscription(subscription: SubscriptionProperties, operationOptions?: OperationOptions): Promise<WithResponse<SubscriptionProperties>>;
updateTopic(topic: TopicProperties, operationOptions?: OperationOptions): Promise<WithResponse<TopicProperties>>;
updateQueue(queue: WithResponse<QueueProperties>, operationOptions?: OperationOptions): Promise<WithResponse<QueueProperties>>;
updateRule(topicName: string, subscriptionName: string, rule: WithResponse<RuleProperties>, operationOptions?: OperationOptions): Promise<WithResponse<RuleProperties>>;
updateSubscription(subscription: WithResponse<SubscriptionProperties>, operationOptions?: OperationOptions): Promise<WithResponse<SubscriptionProperties>>;
updateTopic(topic: WithResponse<TopicProperties>, operationOptions?: OperationOptions): Promise<WithResponse<TopicProperties>>;
}

// @public
Expand Down
30 changes: 14 additions & 16 deletions sdk/servicebus/service-bus/src/serviceBusAtomManagementClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -610,11 +610,11 @@ export class ServiceBusAdministrationClient extends ServiceClient {
/**
* Updates the queue based on the queue properties provided.
* All queue properties must be set even though only a subset of them are actually updatable.
* Therefore, the suggested flow is to use `getQueue()` to get the complete set of queue properties,
* update as needed and then pass it to `updateQueue()`.
* Therefore, the suggested flow is to use the output from `getQueue()`, update the desired properties in it, and then pass the modified object to `updateQueue()`.
*
* See https://docs.microsoft.com/rest/api/servicebus/update-queue for more details.
*
* @param queue Object representing the properties of the queue.
* @param queue Object representing the properties of the queue and the raw response.
* `requiresSession`, `requiresDuplicateDetection`, `enablePartitioning`, and `name` can't be updated after creating the queue.
* @param operationOptions The options that can be used to abort, trace and control other configurations on the HTTP request.
*
Expand All @@ -628,7 +628,7 @@ export class ServiceBusAdministrationClient extends ServiceClient {
* @throws `RestError` with code and statusCode representing the standard set of REST API errors.
*/
async updateQueue(
queue: QueueProperties,
queue: WithResponse<QueueProperties>,
operationOptions?: OperationOptions
): Promise<WithResponse<QueueProperties>> {
const { span, updatedOperationOptions } = createSpan(
Expand Down Expand Up @@ -1104,11 +1104,11 @@ export class ServiceBusAdministrationClient extends ServiceClient {
/**
* Updates the topic based on the topic properties provided.
* All topic properties must be set even though only a subset of them are actually updatable.
* Therefore, the suggested flow is to use `getTopic()` to get the complete set of topic properties,
* update as needed and then pass it to `updateTopic()`.
* Therefore, the suggested flow is to use the output from `getTopic()`, update the desired properties in it, and then pass the modified object to `updateTopic()`.
*
* See https://docs.microsoft.com/rest/api/servicebus/update-topic for more details.
*
* @param topic Object representing the properties of the topic.
* @param topic Object representing the properties of the topic and the raw response.
* `requiresDuplicateDetection`, `enablePartitioning`, and `name` can't be updated after creating the topic.
* @param operationOptions The options that can be used to abort, trace and control other configurations on the HTTP request.
*
Expand All @@ -1122,7 +1122,7 @@ export class ServiceBusAdministrationClient extends ServiceClient {
* @throws `RestError` with code and statusCode representing the standard set of REST API errors.
*/
async updateTopic(
topic: TopicProperties,
topic: WithResponse<TopicProperties>,
operationOptions?: OperationOptions
): Promise<WithResponse<TopicProperties>> {
const { span, updatedOperationOptions } = createSpan(
Expand Down Expand Up @@ -1634,10 +1634,9 @@ export class ServiceBusAdministrationClient extends ServiceClient {
/**
* Updates the subscription based on the subscription properties provided.
* All subscription properties must be set even though only a subset of them are actually updatable.
* Therefore, the suggested flow is to use `getSubscription()` to get the complete set of subscription properties,
* update as needed and then pass it to `updateSubscription()`.
* Therefore, the suggested flow is to use the output from `getSubscription()`, update the desired properties in it, and then pass the modified object to `updateSubscription()`.
*
* @param subscription Object representing the properties of the subscription.
* @param subscription Object representing the properties of the subscription and the raw response.
* `subscriptionName`, `topicName`, and `requiresSession` can't be updated after creating the subscription.
* @param operationOptions The options that can be used to abort, trace and control other configurations on the HTTP request.
*
Expand All @@ -1651,7 +1650,7 @@ export class ServiceBusAdministrationClient extends ServiceClient {
* @throws `RestError` with code and statusCode representing the standard set of REST API errors.
*/
async updateSubscription(
subscription: SubscriptionProperties,
subscription: WithResponse<SubscriptionProperties>,
operationOptions?: OperationOptions
): Promise<WithResponse<SubscriptionProperties>> {
const { span, updatedOperationOptions } = createSpan(
Expand Down Expand Up @@ -2055,12 +2054,11 @@ export class ServiceBusAdministrationClient extends ServiceClient {
/**
* Updates properties on the Rule by the given name based on the given options.
* All rule properties must be set even if one of them is being updated.
* Therefore, the suggested flow is to use `getRule()` to get the complete set of rule properties,
* update as needed and then pass it to `updateRule()`.
* Therefore, the suggested flow is to use the output from `getRule()`, update the desired properties in it, and then pass the modified object to `updateRule()`.
*
* @param topicName
* @param subscriptionName
* @param rule Options to configure the Rule being updated.
* @param rule Options to configure the Rule being updated and the raw response.
* For example, you can configure the filter to apply on associated Topic/Subscription.
* @param operationOptions The options that can be used to abort, trace and control other configurations on the HTTP request.
*
Expand All @@ -2076,7 +2074,7 @@ export class ServiceBusAdministrationClient extends ServiceClient {
async updateRule(
topicName: string,
subscriptionName: string,
rule: RuleProperties,
rule: WithResponse<RuleProperties>,
operationOptions?: OperationOptions
): Promise<WithResponse<RuleProperties>> {
const { span, updatedOperationOptions } = createSpan(
Expand Down

0 comments on commit e64a3aa

Please sign in to comment.