1
1
// Copyright (c) Microsoft Corporation. All rights reserved.
2
2
// Licensed under the MIT License.
3
3
4
- package com .azure .messaging .servicebus ;
4
+ package com .azure .messaging .servicebus . administration ;
5
5
6
6
import com .azure .core .annotation .ReturnType ;
7
7
import com .azure .core .annotation .ServiceClient ;
22
22
import com .azure .core .util .Context ;
23
23
import com .azure .core .util .IterableStream ;
24
24
import com .azure .core .util .logging .ClientLogger ;
25
+ import com .azure .messaging .servicebus .administration .models .CreateQueueOptions ;
26
+ import com .azure .messaging .servicebus .administration .models .CreateSubscriptionOptions ;
27
+ import com .azure .messaging .servicebus .administration .models .CreateTopicOptions ;
28
+ import com .azure .messaging .servicebus .administration .models .NamespaceProperties ;
29
+ import com .azure .messaging .servicebus .administration .models .QueueProperties ;
30
+ import com .azure .messaging .servicebus .administration .models .QueueRuntimeInfo ;
31
+ import com .azure .messaging .servicebus .administration .models .SubscriptionProperties ;
32
+ import com .azure .messaging .servicebus .administration .models .SubscriptionRuntimeInfo ;
33
+ import com .azure .messaging .servicebus .administration .models .TopicProperties ;
34
+ import com .azure .messaging .servicebus .administration .models .TopicRuntimeInfo ;
25
35
import com .azure .messaging .servicebus .implementation .EntitiesImpl ;
26
36
import com .azure .messaging .servicebus .implementation .EntityHelper ;
27
37
import com .azure .messaging .servicebus .implementation .ServiceBusManagementClientImpl ;
45
55
import com .azure .messaging .servicebus .implementation .models .TopicDescription ;
46
56
import com .azure .messaging .servicebus .implementation .models .TopicDescriptionEntry ;
47
57
import com .azure .messaging .servicebus .implementation .models .TopicDescriptionFeed ;
48
- import com .azure .messaging .servicebus .models .CreateQueueOptions ;
49
- import com .azure .messaging .servicebus .models .CreateSubscriptionOptions ;
50
- import com .azure .messaging .servicebus .models .CreateTopicOptions ;
51
- import com .azure .messaging .servicebus .models .NamespaceProperties ;
52
- import com .azure .messaging .servicebus .models .QueueProperties ;
53
- import com .azure .messaging .servicebus .models .QueueRuntimeInfo ;
54
- import com .azure .messaging .servicebus .models .SubscriptionProperties ;
55
- import com .azure .messaging .servicebus .models .SubscriptionRuntimeInfo ;
56
- import com .azure .messaging .servicebus .models .TopicProperties ;
57
- import com .azure .messaging .servicebus .models .TopicRuntimeInfo ;
58
58
import reactor .core .publisher .Flux ;
59
59
import reactor .core .publisher .Mono ;
60
60
83
83
/**
84
84
* An <b>asynchronous</b> client for managing a Service Bus namespace.
85
85
*
86
- * @see ServiceBusManagementClient ServiceBusManagementClient for a synchronous client.
86
+ * @see ServiceBusAdministrationClient ServiceBusManagementClient for a synchronous client.
87
87
*/
88
- @ ServiceClient (builder = ServiceBusManagementClientBuilder .class , isAsync = true )
89
- public final class ServiceBusManagementAsyncClient {
88
+ @ ServiceClient (builder = ServiceBusAdministrationClientBuilder .class , isAsync = true )
89
+ public final class ServiceBusAdministrationAsyncClient {
90
90
// See https://docs.microsoft.com/azure/azure-resource-manager/management/azure-services-resource-providers
91
91
// for more information on Azure resource provider namespaces.
92
92
private static final String SERVICE_BUS_TRACING_NAMESPACE_VALUE = "Microsoft.ServiceBus" ;
@@ -100,7 +100,7 @@ public final class ServiceBusManagementAsyncClient {
100
100
101
101
private final ServiceBusManagementClientImpl managementClient ;
102
102
private final EntitiesImpl entityClient ;
103
- private final ClientLogger logger = new ClientLogger (ServiceBusManagementAsyncClient .class );
103
+ private final ClientLogger logger = new ClientLogger (ServiceBusAdministrationAsyncClient .class );
104
104
private final ServiceBusManagementSerializer serializer ;
105
105
106
106
/**
@@ -109,7 +109,7 @@ public final class ServiceBusManagementAsyncClient {
109
109
* @param managementClient Client to make management calls.
110
110
* @param serializer Serializer to deserialize ATOM XML responses.
111
111
*/
112
- ServiceBusManagementAsyncClient (ServiceBusManagementClientImpl managementClient ,
112
+ ServiceBusAdministrationAsyncClient (ServiceBusManagementClientImpl managementClient ,
113
113
ServiceBusManagementSerializer serializer ) {
114
114
this .managementClient = Objects .requireNonNull (managementClient , "'managementClient' cannot be null." );
115
115
this .entityClient = managementClient .getEntities ();
@@ -1127,7 +1127,7 @@ Mono<Response<QueueProperties>> createQueueWithResponse(String queueName, Create
1127
1127
1128
1128
try {
1129
1129
return entityClient .putWithResponseAsync (queueName , createEntity , null , withTracing )
1130
- .onErrorMap (ServiceBusManagementAsyncClient ::mapException )
1130
+ .onErrorMap (ServiceBusAdministrationAsyncClient ::mapException )
1131
1131
.map (this ::deserializeQueue );
1132
1132
} catch (RuntimeException ex ) {
1133
1133
return monoError (logger , ex );
@@ -1172,7 +1172,7 @@ Mono<Response<SubscriptionProperties>> createSubscriptionWithResponse(String top
1172
1172
try {
1173
1173
return managementClient .getSubscriptions ().putWithResponseAsync (topicName , subscriptionName , createEntity ,
1174
1174
null , withTracing )
1175
- .onErrorMap (ServiceBusManagementAsyncClient ::mapException )
1175
+ .onErrorMap (ServiceBusAdministrationAsyncClient ::mapException )
1176
1176
.map (response -> deserializeSubscription (topicName , response ));
1177
1177
} catch (RuntimeException ex ) {
1178
1178
return monoError (logger , ex );
@@ -1212,7 +1212,7 @@ Mono<Response<TopicProperties>> createTopicWithResponse(String topicName, Create
1212
1212
1213
1213
try {
1214
1214
return entityClient .putWithResponseAsync (topicName , createEntity , null , withTracing )
1215
- .onErrorMap (ServiceBusManagementAsyncClient ::mapException )
1215
+ .onErrorMap (ServiceBusAdministrationAsyncClient ::mapException )
1216
1216
.map (this ::deserializeTopic );
1217
1217
} catch (RuntimeException ex ) {
1218
1218
return monoError (logger , ex );
@@ -1240,7 +1240,7 @@ Mono<Response<Void>> deleteQueueWithResponse(String queueName, Context context)
1240
1240
1241
1241
try {
1242
1242
return entityClient .deleteWithResponseAsync (queueName , withTracing )
1243
- .onErrorMap (ServiceBusManagementAsyncClient ::mapException )
1243
+ .onErrorMap (ServiceBusAdministrationAsyncClient ::mapException )
1244
1244
.map (response -> {
1245
1245
return new SimpleResponse <>(response .getRequest (), response .getStatusCode (),
1246
1246
response .getHeaders (), null );
@@ -1277,7 +1277,7 @@ Mono<Response<Void>> deleteSubscriptionWithResponse(String topicName, String sub
1277
1277
try {
1278
1278
return managementClient .getSubscriptions ().deleteWithResponseAsync (topicName , subscriptionName ,
1279
1279
withTracing )
1280
- .onErrorMap (ServiceBusManagementAsyncClient ::mapException )
1280
+ .onErrorMap (ServiceBusAdministrationAsyncClient ::mapException )
1281
1281
.map (response -> new SimpleResponse <>(response .getRequest (), response .getStatusCode (),
1282
1282
response .getHeaders (), null ));
1283
1283
} catch (RuntimeException ex ) {
@@ -1306,7 +1306,7 @@ Mono<Response<Void>> deleteTopicWithResponse(String topicName, Context context)
1306
1306
1307
1307
try {
1308
1308
return entityClient .deleteWithResponseAsync (topicName , withTracing )
1309
- .onErrorMap (ServiceBusManagementAsyncClient ::mapException )
1309
+ .onErrorMap (ServiceBusAdministrationAsyncClient ::mapException )
1310
1310
.map (response -> new SimpleResponse <>(response .getRequest (), response .getStatusCode (),
1311
1311
response .getHeaders (), null ));
1312
1312
} catch (RuntimeException ex ) {
@@ -1361,7 +1361,7 @@ <T> Mono<Response<T>> getQueueWithResponse(String queueName, Context context,
1361
1361
1362
1362
try {
1363
1363
return entityClient .getWithResponseAsync (queueName , true , withTracing )
1364
- .onErrorMap (ServiceBusManagementAsyncClient ::mapException )
1364
+ .onErrorMap (ServiceBusAdministrationAsyncClient ::mapException )
1365
1365
.handle ((response , sink ) -> {
1366
1366
final Response <QueueProperties > deserialize = deserializeQueue (response );
1367
1367
@@ -1409,7 +1409,7 @@ <T> Mono<Response<T>> getSubscriptionWithResponse(String topicName, String subsc
1409
1409
try {
1410
1410
return managementClient .getSubscriptions ().getWithResponseAsync (topicName , subscriptionName , true ,
1411
1411
withTracing )
1412
- .onErrorMap (ServiceBusManagementAsyncClient ::mapException )
1412
+ .onErrorMap (ServiceBusAdministrationAsyncClient ::mapException )
1413
1413
.handle ((response , sink ) -> {
1414
1414
final Response <SubscriptionProperties > deserialize = deserializeSubscription (topicName , response );
1415
1415
@@ -1476,7 +1476,7 @@ <T> Mono<Response<T>> getTopicWithResponse(String topicName, Context context,
1476
1476
1477
1477
try {
1478
1478
return entityClient .getWithResponseAsync (topicName , true , withTracing )
1479
- .onErrorMap (ServiceBusManagementAsyncClient ::mapException )
1479
+ .onErrorMap (ServiceBusAdministrationAsyncClient ::mapException )
1480
1480
.handle ((response , sink ) -> {
1481
1481
final Response <TopicProperties > deserialize = deserializeTopic (response );
1482
1482
@@ -1644,7 +1644,7 @@ Mono<Response<QueueProperties>> updateQueueWithResponse(QueueProperties queue, C
1644
1644
try {
1645
1645
// If-Match == "*" to unconditionally update. This is in line with the existing client library behaviour.
1646
1646
return entityClient .putWithResponseAsync (queue .getName (), createEntity , "*" , withTracing )
1647
- .onErrorMap (ServiceBusManagementAsyncClient ::mapException )
1647
+ .onErrorMap (ServiceBusAdministrationAsyncClient ::mapException )
1648
1648
.map (response -> deserializeQueue (response ));
1649
1649
} catch (RuntimeException ex ) {
1650
1650
return monoError (logger , ex );
@@ -1682,7 +1682,7 @@ Mono<Response<SubscriptionProperties>> updateSubscriptionWithResponse(Subscripti
1682
1682
// If-Match == "*" to unconditionally update. This is in line with the existing client library behaviour.
1683
1683
return managementClient .getSubscriptions ().putWithResponseAsync (topicName , subscriptionName , createEntity ,
1684
1684
"*" , withTracing )
1685
- .onErrorMap (ServiceBusManagementAsyncClient ::mapException )
1685
+ .onErrorMap (ServiceBusAdministrationAsyncClient ::mapException )
1686
1686
.map (response -> deserializeSubscription (topicName , response ));
1687
1687
} catch (RuntimeException ex ) {
1688
1688
return monoError (logger , ex );
@@ -1716,7 +1716,7 @@ Mono<Response<TopicProperties>> updateTopicWithResponse(TopicProperties topic, C
1716
1716
try {
1717
1717
// If-Match == "*" to unconditionally update. This is in line with the existing client library behaviour.
1718
1718
return entityClient .putWithResponseAsync (topic .getName (), createEntity , "*" , withTracing )
1719
- .onErrorMap (ServiceBusManagementAsyncClient ::mapException )
1719
+ .onErrorMap (ServiceBusAdministrationAsyncClient ::mapException )
1720
1720
.map (response -> deserializeTopic (response ));
1721
1721
} catch (RuntimeException ex ) {
1722
1722
return monoError (logger , ex );
@@ -1886,7 +1886,7 @@ private <TResult, TFeed> FeedPage<TResult> extractPage(Response<TFeed> response,
1886
1886
*/
1887
1887
private Mono <PagedResponse <QueueProperties >> listQueues (int skip , Context context ) {
1888
1888
return managementClient .listEntitiesWithResponseAsync (QUEUES_ENTITY_TYPE , skip , NUMBER_OF_ELEMENTS , context )
1889
- .onErrorMap (ServiceBusManagementAsyncClient ::mapException )
1889
+ .onErrorMap (ServiceBusAdministrationAsyncClient ::mapException )
1890
1890
.flatMap (response -> {
1891
1891
final Response <QueueDescriptionFeed > feedResponse = deserialize (response , QueueDescriptionFeed .class );
1892
1892
final QueueDescriptionFeed feed = feedResponse .getValue ();
@@ -1928,7 +1928,7 @@ private Mono<PagedResponse<QueueProperties>> listQueues(int skip, Context contex
1928
1928
private Mono <PagedResponse <SubscriptionProperties >> listSubscriptions (String topicName , int skip ,
1929
1929
Context context ) {
1930
1930
return managementClient .listSubscriptionsWithResponseAsync (topicName , skip , NUMBER_OF_ELEMENTS , context )
1931
- .onErrorMap (ServiceBusManagementAsyncClient ::mapException )
1931
+ .onErrorMap (ServiceBusAdministrationAsyncClient ::mapException )
1932
1932
.flatMap (response -> {
1933
1933
final Response <SubscriptionDescriptionFeed > feedResponse = deserialize (response ,
1934
1934
SubscriptionDescriptionFeed .class );
@@ -1972,7 +1972,7 @@ private Mono<PagedResponse<SubscriptionProperties>> listSubscriptions(String top
1972
1972
*/
1973
1973
private Mono <PagedResponse <TopicProperties >> listTopics (int skip , Context context ) {
1974
1974
return managementClient .listEntitiesWithResponseAsync (TOPICS_ENTITY_TYPE , skip , NUMBER_OF_ELEMENTS , context )
1975
- .onErrorMap (ServiceBusManagementAsyncClient ::mapException )
1975
+ .onErrorMap (ServiceBusAdministrationAsyncClient ::mapException )
1976
1976
.flatMap (response -> {
1977
1977
final Response <TopicDescriptionFeed > feedResponse = deserialize (response , TopicDescriptionFeed .class );
1978
1978
final TopicDescriptionFeed feed = feedResponse .getValue ();
0 commit comments