| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | // <auto-generated/> |
| | 5 | |
|
| | 6 | | #nullable disable |
| | 7 | |
|
| | 8 | | using System; |
| | 9 | | using System.Threading; |
| | 10 | | using System.Threading.Tasks; |
| | 11 | | using Azure; |
| | 12 | | using Azure.Core; |
| | 13 | | using Azure.Core.Pipeline; |
| | 14 | | using Azure.ResourceManager.EventHubs.Models; |
| | 15 | |
|
| | 16 | | namespace Azure.ResourceManager.EventHubs |
| | 17 | | { |
| | 18 | | /// <summary> The DisasterRecoveryConfigs service client. </summary> |
| | 19 | | public partial class DisasterRecoveryConfigsOperations |
| | 20 | | { |
| | 21 | | private readonly ClientDiagnostics _clientDiagnostics; |
| | 22 | | private readonly HttpPipeline _pipeline; |
| 6124 | 23 | | internal DisasterRecoveryConfigsRestOperations RestClient { get; } |
| | 24 | | /// <summary> Initializes a new instance of DisasterRecoveryConfigsOperations for mocking. </summary> |
| 48 | 25 | | protected DisasterRecoveryConfigsOperations() |
| | 26 | | { |
| 48 | 27 | | } |
| | 28 | | /// <summary> Initializes a new instance of DisasterRecoveryConfigsOperations. </summary> |
| | 29 | | /// <param name="clientDiagnostics"> The handler for diagnostic messaging in the client. </param> |
| | 30 | | /// <param name="pipeline"> The HTTP pipeline for sending and receiving REST requests and responses. </param> |
| | 31 | | /// <param name="subscriptionId"> Subscription credentials that uniquely identify a Microsoft Azure subscription |
| | 32 | | /// <param name="endpoint"> server parameter. </param> |
| 48 | 33 | | internal DisasterRecoveryConfigsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string su |
| | 34 | | { |
| 48 | 35 | | RestClient = new DisasterRecoveryConfigsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint |
| 48 | 36 | | _clientDiagnostics = clientDiagnostics; |
| 48 | 37 | | _pipeline = pipeline; |
| 48 | 38 | | } |
| | 39 | |
|
| | 40 | | /// <summary> Gets an AuthorizationRule for a Namespace by rule name. </summary> |
| | 41 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 42 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 43 | | /// <param name="alias"> The Disaster Recovery configuration name. </param> |
| | 44 | | /// <param name="authorizationRuleName"> The authorization rule name. </param> |
| | 45 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 46 | | public virtual async Task<Response<AuthorizationRule>> GetAuthorizationRuleAsync(string resourceGroupName, strin |
| | 47 | | { |
| 4 | 48 | | using var scope = _clientDiagnostics.CreateScope("DisasterRecoveryConfigsOperations.GetAuthorizationRule"); |
| 4 | 49 | | scope.Start(); |
| | 50 | | try |
| | 51 | | { |
| 4 | 52 | | return await RestClient.GetAuthorizationRuleAsync(resourceGroupName, namespaceName, @alias, authorizatio |
| | 53 | | } |
| 0 | 54 | | catch (Exception e) |
| | 55 | | { |
| 0 | 56 | | scope.Failed(e); |
| 0 | 57 | | throw; |
| | 58 | | } |
| 4 | 59 | | } |
| | 60 | |
|
| | 61 | | /// <summary> Gets an AuthorizationRule for a Namespace by rule name. </summary> |
| | 62 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 63 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 64 | | /// <param name="alias"> The Disaster Recovery configuration name. </param> |
| | 65 | | /// <param name="authorizationRuleName"> The authorization rule name. </param> |
| | 66 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 67 | | public virtual Response<AuthorizationRule> GetAuthorizationRule(string resourceGroupName, string namespaceName, |
| | 68 | | { |
| 4 | 69 | | using var scope = _clientDiagnostics.CreateScope("DisasterRecoveryConfigsOperations.GetAuthorizationRule"); |
| 4 | 70 | | scope.Start(); |
| | 71 | | try |
| | 72 | | { |
| 4 | 73 | | return RestClient.GetAuthorizationRule(resourceGroupName, namespaceName, @alias, authorizationRuleName, |
| | 74 | | } |
| 0 | 75 | | catch (Exception e) |
| | 76 | | { |
| 0 | 77 | | scope.Failed(e); |
| 0 | 78 | | throw; |
| | 79 | | } |
| 4 | 80 | | } |
| | 81 | |
|
| | 82 | | /// <summary> Gets the primary and secondary connection strings for the Namespace. </summary> |
| | 83 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 84 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 85 | | /// <param name="alias"> The Disaster Recovery configuration name. </param> |
| | 86 | | /// <param name="authorizationRuleName"> The authorization rule name. </param> |
| | 87 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 88 | | public virtual async Task<Response<AccessKeys>> ListKeysAsync(string resourceGroupName, string namespaceName, st |
| | 89 | | { |
| 4 | 90 | | using var scope = _clientDiagnostics.CreateScope("DisasterRecoveryConfigsOperations.ListKeys"); |
| 4 | 91 | | scope.Start(); |
| | 92 | | try |
| | 93 | | { |
| 4 | 94 | | return await RestClient.ListKeysAsync(resourceGroupName, namespaceName, @alias, authorizationRuleName, c |
| | 95 | | } |
| 0 | 96 | | catch (Exception e) |
| | 97 | | { |
| 0 | 98 | | scope.Failed(e); |
| 0 | 99 | | throw; |
| | 100 | | } |
| 4 | 101 | | } |
| | 102 | |
|
| | 103 | | /// <summary> Gets the primary and secondary connection strings for the Namespace. </summary> |
| | 104 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 105 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 106 | | /// <param name="alias"> The Disaster Recovery configuration name. </param> |
| | 107 | | /// <param name="authorizationRuleName"> The authorization rule name. </param> |
| | 108 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 109 | | public virtual Response<AccessKeys> ListKeys(string resourceGroupName, string namespaceName, string @alias, stri |
| | 110 | | { |
| 4 | 111 | | using var scope = _clientDiagnostics.CreateScope("DisasterRecoveryConfigsOperations.ListKeys"); |
| 4 | 112 | | scope.Start(); |
| | 113 | | try |
| | 114 | | { |
| 4 | 115 | | return RestClient.ListKeys(resourceGroupName, namespaceName, @alias, authorizationRuleName, cancellation |
| | 116 | | } |
| 0 | 117 | | catch (Exception e) |
| | 118 | | { |
| 0 | 119 | | scope.Failed(e); |
| 0 | 120 | | throw; |
| | 121 | | } |
| 4 | 122 | | } |
| | 123 | |
|
| | 124 | | /// <summary> Check the give Namespace name availability. </summary> |
| | 125 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 126 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 127 | | /// <param name="parameters"> Parameters to check availability of the given Alias name. </param> |
| | 128 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 129 | | public virtual async Task<Response<CheckNameAvailabilityResult>> CheckNameAvailabilityAsync(string resourceGroup |
| | 130 | | { |
| 6 | 131 | | using var scope = _clientDiagnostics.CreateScope("DisasterRecoveryConfigsOperations.CheckNameAvailability"); |
| 6 | 132 | | scope.Start(); |
| | 133 | | try |
| | 134 | | { |
| 6 | 135 | | return await RestClient.CheckNameAvailabilityAsync(resourceGroupName, namespaceName, parameters, cancell |
| | 136 | | } |
| 0 | 137 | | catch (Exception e) |
| | 138 | | { |
| 0 | 139 | | scope.Failed(e); |
| 0 | 140 | | throw; |
| | 141 | | } |
| 6 | 142 | | } |
| | 143 | |
|
| | 144 | | /// <summary> Check the give Namespace name availability. </summary> |
| | 145 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 146 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 147 | | /// <param name="parameters"> Parameters to check availability of the given Alias name. </param> |
| | 148 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 149 | | public virtual Response<CheckNameAvailabilityResult> CheckNameAvailability(string resourceGroupName, string name |
| | 150 | | { |
| 6 | 151 | | using var scope = _clientDiagnostics.CreateScope("DisasterRecoveryConfigsOperations.CheckNameAvailability"); |
| 6 | 152 | | scope.Start(); |
| | 153 | | try |
| | 154 | | { |
| 6 | 155 | | return RestClient.CheckNameAvailability(resourceGroupName, namespaceName, parameters, cancellationToken) |
| | 156 | | } |
| 0 | 157 | | catch (Exception e) |
| | 158 | | { |
| 0 | 159 | | scope.Failed(e); |
| 0 | 160 | | throw; |
| | 161 | | } |
| 6 | 162 | | } |
| | 163 | |
|
| | 164 | | /// <summary> Creates or updates a new Alias(Disaster Recovery configuration). </summary> |
| | 165 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 166 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 167 | | /// <param name="alias"> The Disaster Recovery configuration name. </param> |
| | 168 | | /// <param name="parameters"> Parameters required to create an Alias(Disaster Recovery configuration). </param> |
| | 169 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 170 | | public virtual async Task<Response<ArmDisasterRecovery>> CreateOrUpdateAsync(string resourceGroupName, string na |
| | 171 | | { |
| 8 | 172 | | using var scope = _clientDiagnostics.CreateScope("DisasterRecoveryConfigsOperations.CreateOrUpdate"); |
| 8 | 173 | | scope.Start(); |
| | 174 | | try |
| | 175 | | { |
| 8 | 176 | | return await RestClient.CreateOrUpdateAsync(resourceGroupName, namespaceName, @alias, parameters, cancel |
| | 177 | | } |
| 0 | 178 | | catch (Exception e) |
| | 179 | | { |
| 0 | 180 | | scope.Failed(e); |
| 0 | 181 | | throw; |
| | 182 | | } |
| 8 | 183 | | } |
| | 184 | |
|
| | 185 | | /// <summary> Creates or updates a new Alias(Disaster Recovery configuration). </summary> |
| | 186 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 187 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 188 | | /// <param name="alias"> The Disaster Recovery configuration name. </param> |
| | 189 | | /// <param name="parameters"> Parameters required to create an Alias(Disaster Recovery configuration). </param> |
| | 190 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 191 | | public virtual Response<ArmDisasterRecovery> CreateOrUpdate(string resourceGroupName, string namespaceName, stri |
| | 192 | | { |
| 8 | 193 | | using var scope = _clientDiagnostics.CreateScope("DisasterRecoveryConfigsOperations.CreateOrUpdate"); |
| 8 | 194 | | scope.Start(); |
| | 195 | | try |
| | 196 | | { |
| 8 | 197 | | return RestClient.CreateOrUpdate(resourceGroupName, namespaceName, @alias, parameters, cancellationToken |
| | 198 | | } |
| 0 | 199 | | catch (Exception e) |
| | 200 | | { |
| 0 | 201 | | scope.Failed(e); |
| 0 | 202 | | throw; |
| | 203 | | } |
| 8 | 204 | | } |
| | 205 | |
|
| | 206 | | /// <summary> Deletes an Alias(Disaster Recovery configuration). </summary> |
| | 207 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 208 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 209 | | /// <param name="alias"> The Disaster Recovery configuration name. </param> |
| | 210 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 211 | | public virtual async Task<Response> DeleteAsync(string resourceGroupName, string namespaceName, string @alias, C |
| | 212 | | { |
| 4 | 213 | | using var scope = _clientDiagnostics.CreateScope("DisasterRecoveryConfigsOperations.Delete"); |
| 4 | 214 | | scope.Start(); |
| | 215 | | try |
| | 216 | | { |
| 4 | 217 | | return await RestClient.DeleteAsync(resourceGroupName, namespaceName, @alias, cancellationToken).Configu |
| | 218 | | } |
| 0 | 219 | | catch (Exception e) |
| | 220 | | { |
| 0 | 221 | | scope.Failed(e); |
| 0 | 222 | | throw; |
| | 223 | | } |
| 4 | 224 | | } |
| | 225 | |
|
| | 226 | | /// <summary> Deletes an Alias(Disaster Recovery configuration). </summary> |
| | 227 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 228 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 229 | | /// <param name="alias"> The Disaster Recovery configuration name. </param> |
| | 230 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 231 | | public virtual Response Delete(string resourceGroupName, string namespaceName, string @alias, CancellationToken |
| | 232 | | { |
| 4 | 233 | | using var scope = _clientDiagnostics.CreateScope("DisasterRecoveryConfigsOperations.Delete"); |
| 4 | 234 | | scope.Start(); |
| | 235 | | try |
| | 236 | | { |
| 4 | 237 | | return RestClient.Delete(resourceGroupName, namespaceName, @alias, cancellationToken); |
| | 238 | | } |
| 0 | 239 | | catch (Exception e) |
| | 240 | | { |
| 0 | 241 | | scope.Failed(e); |
| 0 | 242 | | throw; |
| | 243 | | } |
| 4 | 244 | | } |
| | 245 | |
|
| | 246 | | /// <summary> Retrieves Alias(Disaster Recovery configuration) for primary or secondary namespace. </summary> |
| | 247 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 248 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 249 | | /// <param name="alias"> The Disaster Recovery configuration name. </param> |
| | 250 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 251 | | public virtual async Task<Response<ArmDisasterRecovery>> GetAsync(string resourceGroupName, string namespaceName |
| | 252 | | { |
| 3138 | 253 | | using var scope = _clientDiagnostics.CreateScope("DisasterRecoveryConfigsOperations.Get"); |
| 3138 | 254 | | scope.Start(); |
| | 255 | | try |
| | 256 | | { |
| 3138 | 257 | | return await RestClient.GetAsync(resourceGroupName, namespaceName, @alias, cancellationToken).ConfigureA |
| | 258 | | } |
| 0 | 259 | | catch (Exception e) |
| | 260 | | { |
| 0 | 261 | | scope.Failed(e); |
| 0 | 262 | | throw; |
| | 263 | | } |
| 3138 | 264 | | } |
| | 265 | |
|
| | 266 | | /// <summary> Retrieves Alias(Disaster Recovery configuration) for primary or secondary namespace. </summary> |
| | 267 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 268 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 269 | | /// <param name="alias"> The Disaster Recovery configuration name. </param> |
| | 270 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 271 | | public virtual Response<ArmDisasterRecovery> Get(string resourceGroupName, string namespaceName, string @alias, |
| | 272 | | { |
| 2918 | 273 | | using var scope = _clientDiagnostics.CreateScope("DisasterRecoveryConfigsOperations.Get"); |
| 2918 | 274 | | scope.Start(); |
| | 275 | | try |
| | 276 | | { |
| 2918 | 277 | | return RestClient.Get(resourceGroupName, namespaceName, @alias, cancellationToken); |
| | 278 | | } |
| 0 | 279 | | catch (Exception e) |
| | 280 | | { |
| 0 | 281 | | scope.Failed(e); |
| 0 | 282 | | throw; |
| | 283 | | } |
| 2918 | 284 | | } |
| | 285 | |
|
| | 286 | | /// <summary> This operation disables the Disaster Recovery and stops replicating changes from primary to second |
| | 287 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 288 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 289 | | /// <param name="alias"> The Disaster Recovery configuration name. </param> |
| | 290 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 291 | | public virtual async Task<Response> BreakPairingAsync(string resourceGroupName, string namespaceName, string @al |
| | 292 | | { |
| 4 | 293 | | using var scope = _clientDiagnostics.CreateScope("DisasterRecoveryConfigsOperations.BreakPairing"); |
| 4 | 294 | | scope.Start(); |
| | 295 | | try |
| | 296 | | { |
| 4 | 297 | | return await RestClient.BreakPairingAsync(resourceGroupName, namespaceName, @alias, cancellationToken).C |
| | 298 | | } |
| 0 | 299 | | catch (Exception e) |
| | 300 | | { |
| 0 | 301 | | scope.Failed(e); |
| 0 | 302 | | throw; |
| | 303 | | } |
| 4 | 304 | | } |
| | 305 | |
|
| | 306 | | /// <summary> This operation disables the Disaster Recovery and stops replicating changes from primary to second |
| | 307 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 308 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 309 | | /// <param name="alias"> The Disaster Recovery configuration name. </param> |
| | 310 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 311 | | public virtual Response BreakPairing(string resourceGroupName, string namespaceName, string @alias, Cancellation |
| | 312 | | { |
| 4 | 313 | | using var scope = _clientDiagnostics.CreateScope("DisasterRecoveryConfigsOperations.BreakPairing"); |
| 4 | 314 | | scope.Start(); |
| | 315 | | try |
| | 316 | | { |
| 4 | 317 | | return RestClient.BreakPairing(resourceGroupName, namespaceName, @alias, cancellationToken); |
| | 318 | | } |
| 0 | 319 | | catch (Exception e) |
| | 320 | | { |
| 0 | 321 | | scope.Failed(e); |
| 0 | 322 | | throw; |
| | 323 | | } |
| 4 | 324 | | } |
| | 325 | |
|
| | 326 | | /// <summary> Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace. </summary> |
| | 327 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 328 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 329 | | /// <param name="alias"> The Disaster Recovery configuration name. </param> |
| | 330 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 331 | | public virtual async Task<Response> FailOverAsync(string resourceGroupName, string namespaceName, string @alias, |
| | 332 | | { |
| 4 | 333 | | using var scope = _clientDiagnostics.CreateScope("DisasterRecoveryConfigsOperations.FailOver"); |
| 4 | 334 | | scope.Start(); |
| | 335 | | try |
| | 336 | | { |
| 4 | 337 | | return await RestClient.FailOverAsync(resourceGroupName, namespaceName, @alias, cancellationToken).Confi |
| | 338 | | } |
| 0 | 339 | | catch (Exception e) |
| | 340 | | { |
| 0 | 341 | | scope.Failed(e); |
| 0 | 342 | | throw; |
| | 343 | | } |
| 4 | 344 | | } |
| | 345 | |
|
| | 346 | | /// <summary> Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace. </summary> |
| | 347 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 348 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 349 | | /// <param name="alias"> The Disaster Recovery configuration name. </param> |
| | 350 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 351 | | public virtual Response FailOver(string resourceGroupName, string namespaceName, string @alias, CancellationToke |
| | 352 | | { |
| 4 | 353 | | using var scope = _clientDiagnostics.CreateScope("DisasterRecoveryConfigsOperations.FailOver"); |
| 4 | 354 | | scope.Start(); |
| | 355 | | try |
| | 356 | | { |
| 4 | 357 | | return RestClient.FailOver(resourceGroupName, namespaceName, @alias, cancellationToken); |
| | 358 | | } |
| 0 | 359 | | catch (Exception e) |
| | 360 | | { |
| 0 | 361 | | scope.Failed(e); |
| 0 | 362 | | throw; |
| | 363 | | } |
| 4 | 364 | | } |
| | 365 | |
|
| | 366 | | /// <summary> Gets a list of authorization rules for a Namespace. </summary> |
| | 367 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 368 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 369 | | /// <param name="alias"> The Disaster Recovery configuration name. </param> |
| | 370 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 371 | | public virtual AsyncPageable<AuthorizationRule> ListAuthorizationRulesAsync(string resourceGroupName, string nam |
| | 372 | | { |
| 0 | 373 | | if (resourceGroupName == null) |
| | 374 | | { |
| 0 | 375 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 376 | | } |
| 0 | 377 | | if (namespaceName == null) |
| | 378 | | { |
| 0 | 379 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 380 | | } |
| 0 | 381 | | if (@alias == null) |
| | 382 | | { |
| 0 | 383 | | throw new ArgumentNullException(nameof(@alias)); |
| | 384 | | } |
| | 385 | |
|
| | 386 | | async Task<Page<AuthorizationRule>> FirstPageFunc(int? pageSizeHint) |
| | 387 | | { |
| 0 | 388 | | using var scope = _clientDiagnostics.CreateScope("DisasterRecoveryConfigsOperations.ListAuthorizationRul |
| 0 | 389 | | scope.Start(); |
| | 390 | | try |
| | 391 | | { |
| 0 | 392 | | var response = await RestClient.ListAuthorizationRulesAsync(resourceGroupName, namespaceName, alias, |
| 0 | 393 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 394 | | } |
| 0 | 395 | | catch (Exception e) |
| | 396 | | { |
| 0 | 397 | | scope.Failed(e); |
| 0 | 398 | | throw; |
| | 399 | | } |
| 0 | 400 | | } |
| | 401 | | async Task<Page<AuthorizationRule>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 402 | | { |
| 0 | 403 | | using var scope = _clientDiagnostics.CreateScope("DisasterRecoveryConfigsOperations.ListAuthorizationRul |
| 0 | 404 | | scope.Start(); |
| | 405 | | try |
| | 406 | | { |
| 0 | 407 | | var response = await RestClient.ListAuthorizationRulesNextPageAsync(nextLink, resourceGroupName, nam |
| 0 | 408 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 409 | | } |
| 0 | 410 | | catch (Exception e) |
| | 411 | | { |
| 0 | 412 | | scope.Failed(e); |
| 0 | 413 | | throw; |
| | 414 | | } |
| 0 | 415 | | } |
| 0 | 416 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); |
| | 417 | | } |
| | 418 | |
|
| | 419 | | /// <summary> Gets a list of authorization rules for a Namespace. </summary> |
| | 420 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 421 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 422 | | /// <param name="alias"> The Disaster Recovery configuration name. </param> |
| | 423 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 424 | | public virtual Pageable<AuthorizationRule> ListAuthorizationRules(string resourceGroupName, string namespaceName |
| | 425 | | { |
| 0 | 426 | | if (resourceGroupName == null) |
| | 427 | | { |
| 0 | 428 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 429 | | } |
| 0 | 430 | | if (namespaceName == null) |
| | 431 | | { |
| 0 | 432 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 433 | | } |
| 0 | 434 | | if (@alias == null) |
| | 435 | | { |
| 0 | 436 | | throw new ArgumentNullException(nameof(@alias)); |
| | 437 | | } |
| | 438 | |
|
| | 439 | | Page<AuthorizationRule> FirstPageFunc(int? pageSizeHint) |
| | 440 | | { |
| 0 | 441 | | using var scope = _clientDiagnostics.CreateScope("DisasterRecoveryConfigsOperations.ListAuthorizationRul |
| 0 | 442 | | scope.Start(); |
| | 443 | | try |
| | 444 | | { |
| 0 | 445 | | var response = RestClient.ListAuthorizationRules(resourceGroupName, namespaceName, alias, cancellati |
| 0 | 446 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 447 | | } |
| 0 | 448 | | catch (Exception e) |
| | 449 | | { |
| 0 | 450 | | scope.Failed(e); |
| 0 | 451 | | throw; |
| | 452 | | } |
| 0 | 453 | | } |
| | 454 | | Page<AuthorizationRule> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 455 | | { |
| 0 | 456 | | using var scope = _clientDiagnostics.CreateScope("DisasterRecoveryConfigsOperations.ListAuthorizationRul |
| 0 | 457 | | scope.Start(); |
| | 458 | | try |
| | 459 | | { |
| 0 | 460 | | var response = RestClient.ListAuthorizationRulesNextPage(nextLink, resourceGroupName, namespaceName, |
| 0 | 461 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 462 | | } |
| 0 | 463 | | catch (Exception e) |
| | 464 | | { |
| 0 | 465 | | scope.Failed(e); |
| 0 | 466 | | throw; |
| | 467 | | } |
| 0 | 468 | | } |
| 0 | 469 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); |
| | 470 | | } |
| | 471 | |
|
| | 472 | | /// <summary> Gets all Alias(Disaster Recovery configurations). </summary> |
| | 473 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 474 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 475 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 476 | | public virtual AsyncPageable<ArmDisasterRecovery> ListAsync(string resourceGroupName, string namespaceName, Canc |
| | 477 | | { |
| 4 | 478 | | if (resourceGroupName == null) |
| | 479 | | { |
| 0 | 480 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 481 | | } |
| 4 | 482 | | if (namespaceName == null) |
| | 483 | | { |
| 0 | 484 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 485 | | } |
| | 486 | |
|
| | 487 | | async Task<Page<ArmDisasterRecovery>> FirstPageFunc(int? pageSizeHint) |
| | 488 | | { |
| 0 | 489 | | using var scope = _clientDiagnostics.CreateScope("DisasterRecoveryConfigsOperations.List"); |
| 0 | 490 | | scope.Start(); |
| | 491 | | try |
| | 492 | | { |
| 0 | 493 | | var response = await RestClient.ListAsync(resourceGroupName, namespaceName, cancellationToken).Confi |
| 0 | 494 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 495 | | } |
| 0 | 496 | | catch (Exception e) |
| | 497 | | { |
| 0 | 498 | | scope.Failed(e); |
| 0 | 499 | | throw; |
| | 500 | | } |
| 0 | 501 | | } |
| | 502 | | async Task<Page<ArmDisasterRecovery>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 503 | | { |
| 0 | 504 | | using var scope = _clientDiagnostics.CreateScope("DisasterRecoveryConfigsOperations.List"); |
| 0 | 505 | | scope.Start(); |
| | 506 | | try |
| | 507 | | { |
| 0 | 508 | | var response = await RestClient.ListNextPageAsync(nextLink, resourceGroupName, namespaceName, cancel |
| 0 | 509 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 510 | | } |
| 0 | 511 | | catch (Exception e) |
| | 512 | | { |
| 0 | 513 | | scope.Failed(e); |
| 0 | 514 | | throw; |
| | 515 | | } |
| 0 | 516 | | } |
| 4 | 517 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); |
| | 518 | | } |
| | 519 | |
|
| | 520 | | /// <summary> Gets all Alias(Disaster Recovery configurations). </summary> |
| | 521 | | /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param> |
| | 522 | | /// <param name="namespaceName"> The Namespace name. </param> |
| | 523 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 524 | | public virtual Pageable<ArmDisasterRecovery> List(string resourceGroupName, string namespaceName, CancellationTo |
| | 525 | | { |
| 4 | 526 | | if (resourceGroupName == null) |
| | 527 | | { |
| 0 | 528 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 529 | | } |
| 4 | 530 | | if (namespaceName == null) |
| | 531 | | { |
| 0 | 532 | | throw new ArgumentNullException(nameof(namespaceName)); |
| | 533 | | } |
| | 534 | |
|
| | 535 | | Page<ArmDisasterRecovery> FirstPageFunc(int? pageSizeHint) |
| | 536 | | { |
| 0 | 537 | | using var scope = _clientDiagnostics.CreateScope("DisasterRecoveryConfigsOperations.List"); |
| 0 | 538 | | scope.Start(); |
| | 539 | | try |
| | 540 | | { |
| 0 | 541 | | var response = RestClient.List(resourceGroupName, namespaceName, cancellationToken); |
| 0 | 542 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 543 | | } |
| 0 | 544 | | catch (Exception e) |
| | 545 | | { |
| 0 | 546 | | scope.Failed(e); |
| 0 | 547 | | throw; |
| | 548 | | } |
| 0 | 549 | | } |
| | 550 | | Page<ArmDisasterRecovery> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 551 | | { |
| 0 | 552 | | using var scope = _clientDiagnostics.CreateScope("DisasterRecoveryConfigsOperations.List"); |
| 0 | 553 | | scope.Start(); |
| | 554 | | try |
| | 555 | | { |
| 0 | 556 | | var response = RestClient.ListNextPage(nextLink, resourceGroupName, namespaceName, cancellationToken |
| 0 | 557 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 558 | | } |
| 0 | 559 | | catch (Exception e) |
| | 560 | | { |
| 0 | 561 | | scope.Failed(e); |
| 0 | 562 | | throw; |
| | 563 | | } |
| 0 | 564 | | } |
| 4 | 565 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); |
| | 566 | | } |
| | 567 | | } |
| | 568 | | } |