| | | 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.Network.Models; |
| | | 15 | | |
| | | 16 | | namespace Azure.ResourceManager.Network |
| | | 17 | | { |
| | | 18 | | /// <summary> The InboundNatRules service client. </summary> |
| | | 19 | | public partial class InboundNatRulesOperations |
| | | 20 | | { |
| | | 21 | | private readonly ClientDiagnostics _clientDiagnostics; |
| | | 22 | | private readonly HttpPipeline _pipeline; |
| | 24 | 23 | | internal InboundNatRulesRestOperations RestClient { get; } |
| | | 24 | | /// <summary> Initializes a new instance of InboundNatRulesOperations for mocking. </summary> |
| | 16 | 25 | | protected InboundNatRulesOperations() |
| | | 26 | | { |
| | 16 | 27 | | } |
| | | 28 | | /// <summary> Initializes a new instance of InboundNatRulesOperations. </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"> The subscription credentials which uniquely identify the Microsoft Azure subsc |
| | | 32 | | /// <param name="endpoint"> server parameter. </param> |
| | 16 | 33 | | internal InboundNatRulesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscripti |
| | | 34 | | { |
| | 16 | 35 | | RestClient = new InboundNatRulesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); |
| | 16 | 36 | | _clientDiagnostics = clientDiagnostics; |
| | 16 | 37 | | _pipeline = pipeline; |
| | 16 | 38 | | } |
| | | 39 | | |
| | | 40 | | /// <summary> Gets the specified load balancer inbound nat rule. </summary> |
| | | 41 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | | 42 | | /// <param name="loadBalancerName"> The name of the load balancer. </param> |
| | | 43 | | /// <param name="inboundNatRuleName"> The name of the inbound nat rule. </param> |
| | | 44 | | /// <param name="expand"> Expands referenced resources. </param> |
| | | 45 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 46 | | public virtual async Task<Response<InboundNatRule>> GetAsync(string resourceGroupName, string loadBalancerName, |
| | | 47 | | { |
| | 2 | 48 | | using var scope = _clientDiagnostics.CreateScope("InboundNatRulesOperations.Get"); |
| | 2 | 49 | | scope.Start(); |
| | | 50 | | try |
| | | 51 | | { |
| | 2 | 52 | | return await RestClient.GetAsync(resourceGroupName, loadBalancerName, inboundNatRuleName, expand, cancel |
| | | 53 | | } |
| | 0 | 54 | | catch (Exception e) |
| | | 55 | | { |
| | 0 | 56 | | scope.Failed(e); |
| | 0 | 57 | | throw; |
| | | 58 | | } |
| | 2 | 59 | | } |
| | | 60 | | |
| | | 61 | | /// <summary> Gets the specified load balancer inbound nat rule. </summary> |
| | | 62 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | | 63 | | /// <param name="loadBalancerName"> The name of the load balancer. </param> |
| | | 64 | | /// <param name="inboundNatRuleName"> The name of the inbound nat rule. </param> |
| | | 65 | | /// <param name="expand"> Expands referenced resources. </param> |
| | | 66 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 67 | | public virtual Response<InboundNatRule> Get(string resourceGroupName, string loadBalancerName, string inboundNat |
| | | 68 | | { |
| | 2 | 69 | | using var scope = _clientDiagnostics.CreateScope("InboundNatRulesOperations.Get"); |
| | 2 | 70 | | scope.Start(); |
| | | 71 | | try |
| | | 72 | | { |
| | 2 | 73 | | return RestClient.Get(resourceGroupName, loadBalancerName, inboundNatRuleName, expand, cancellationToken |
| | | 74 | | } |
| | 0 | 75 | | catch (Exception e) |
| | | 76 | | { |
| | 0 | 77 | | scope.Failed(e); |
| | 0 | 78 | | throw; |
| | | 79 | | } |
| | 2 | 80 | | } |
| | | 81 | | |
| | | 82 | | /// <summary> Gets all the inbound nat rules in a load balancer. </summary> |
| | | 83 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | | 84 | | /// <param name="loadBalancerName"> The name of the load balancer. </param> |
| | | 85 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 86 | | public virtual AsyncPageable<InboundNatRule> ListAsync(string resourceGroupName, string loadBalancerName, Cancel |
| | | 87 | | { |
| | 2 | 88 | | if (resourceGroupName == null) |
| | | 89 | | { |
| | 0 | 90 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | | 91 | | } |
| | 2 | 92 | | if (loadBalancerName == null) |
| | | 93 | | { |
| | 0 | 94 | | throw new ArgumentNullException(nameof(loadBalancerName)); |
| | | 95 | | } |
| | | 96 | | |
| | | 97 | | async Task<Page<InboundNatRule>> FirstPageFunc(int? pageSizeHint) |
| | | 98 | | { |
| | 2 | 99 | | using var scope = _clientDiagnostics.CreateScope("InboundNatRulesOperations.List"); |
| | 2 | 100 | | scope.Start(); |
| | | 101 | | try |
| | | 102 | | { |
| | 2 | 103 | | var response = await RestClient.ListAsync(resourceGroupName, loadBalancerName, cancellationToken).Co |
| | 2 | 104 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | | 105 | | } |
| | 0 | 106 | | catch (Exception e) |
| | | 107 | | { |
| | 0 | 108 | | scope.Failed(e); |
| | 0 | 109 | | throw; |
| | | 110 | | } |
| | 2 | 111 | | } |
| | | 112 | | async Task<Page<InboundNatRule>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | | 113 | | { |
| | 0 | 114 | | using var scope = _clientDiagnostics.CreateScope("InboundNatRulesOperations.List"); |
| | 0 | 115 | | scope.Start(); |
| | | 116 | | try |
| | | 117 | | { |
| | 0 | 118 | | var response = await RestClient.ListNextPageAsync(nextLink, resourceGroupName, loadBalancerName, can |
| | 0 | 119 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | | 120 | | } |
| | 0 | 121 | | catch (Exception e) |
| | | 122 | | { |
| | 0 | 123 | | scope.Failed(e); |
| | 0 | 124 | | throw; |
| | | 125 | | } |
| | 0 | 126 | | } |
| | 2 | 127 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); |
| | | 128 | | } |
| | | 129 | | |
| | | 130 | | /// <summary> Gets all the inbound nat rules in a load balancer. </summary> |
| | | 131 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | | 132 | | /// <param name="loadBalancerName"> The name of the load balancer. </param> |
| | | 133 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 134 | | public virtual Pageable<InboundNatRule> List(string resourceGroupName, string loadBalancerName, CancellationToke |
| | | 135 | | { |
| | 2 | 136 | | if (resourceGroupName == null) |
| | | 137 | | { |
| | 0 | 138 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | | 139 | | } |
| | 2 | 140 | | if (loadBalancerName == null) |
| | | 141 | | { |
| | 0 | 142 | | throw new ArgumentNullException(nameof(loadBalancerName)); |
| | | 143 | | } |
| | | 144 | | |
| | | 145 | | Page<InboundNatRule> FirstPageFunc(int? pageSizeHint) |
| | | 146 | | { |
| | 2 | 147 | | using var scope = _clientDiagnostics.CreateScope("InboundNatRulesOperations.List"); |
| | 2 | 148 | | scope.Start(); |
| | | 149 | | try |
| | | 150 | | { |
| | 2 | 151 | | var response = RestClient.List(resourceGroupName, loadBalancerName, cancellationToken); |
| | 2 | 152 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | | 153 | | } |
| | 0 | 154 | | catch (Exception e) |
| | | 155 | | { |
| | 0 | 156 | | scope.Failed(e); |
| | 0 | 157 | | throw; |
| | | 158 | | } |
| | 2 | 159 | | } |
| | | 160 | | Page<InboundNatRule> NextPageFunc(string nextLink, int? pageSizeHint) |
| | | 161 | | { |
| | 0 | 162 | | using var scope = _clientDiagnostics.CreateScope("InboundNatRulesOperations.List"); |
| | 0 | 163 | | scope.Start(); |
| | | 164 | | try |
| | | 165 | | { |
| | 0 | 166 | | var response = RestClient.ListNextPage(nextLink, resourceGroupName, loadBalancerName, cancellationTo |
| | 0 | 167 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | | 168 | | } |
| | 0 | 169 | | catch (Exception e) |
| | | 170 | | { |
| | 0 | 171 | | scope.Failed(e); |
| | 0 | 172 | | throw; |
| | | 173 | | } |
| | 0 | 174 | | } |
| | 2 | 175 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); |
| | | 176 | | } |
| | | 177 | | |
| | | 178 | | /// <summary> Deletes the specified load balancer inbound nat rule. </summary> |
| | | 179 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | | 180 | | /// <param name="loadBalancerName"> The name of the load balancer. </param> |
| | | 181 | | /// <param name="inboundNatRuleName"> The name of the inbound nat rule. </param> |
| | | 182 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 183 | | public virtual async Task<InboundNatRulesDeleteOperation> StartDeleteAsync(string resourceGroupName, string load |
| | | 184 | | { |
| | 2 | 185 | | if (resourceGroupName == null) |
| | | 186 | | { |
| | 0 | 187 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | | 188 | | } |
| | 2 | 189 | | if (loadBalancerName == null) |
| | | 190 | | { |
| | 0 | 191 | | throw new ArgumentNullException(nameof(loadBalancerName)); |
| | | 192 | | } |
| | 2 | 193 | | if (inboundNatRuleName == null) |
| | | 194 | | { |
| | 0 | 195 | | throw new ArgumentNullException(nameof(inboundNatRuleName)); |
| | | 196 | | } |
| | | 197 | | |
| | 2 | 198 | | using var scope = _clientDiagnostics.CreateScope("InboundNatRulesOperations.StartDelete"); |
| | 2 | 199 | | scope.Start(); |
| | | 200 | | try |
| | | 201 | | { |
| | 2 | 202 | | var originalResponse = await RestClient.DeleteAsync(resourceGroupName, loadBalancerName, inboundNatRuleN |
| | 2 | 203 | | return new InboundNatRulesDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest( |
| | | 204 | | } |
| | 0 | 205 | | catch (Exception e) |
| | | 206 | | { |
| | 0 | 207 | | scope.Failed(e); |
| | 0 | 208 | | throw; |
| | | 209 | | } |
| | 2 | 210 | | } |
| | | 211 | | |
| | | 212 | | /// <summary> Deletes the specified load balancer inbound nat rule. </summary> |
| | | 213 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | | 214 | | /// <param name="loadBalancerName"> The name of the load balancer. </param> |
| | | 215 | | /// <param name="inboundNatRuleName"> The name of the inbound nat rule. </param> |
| | | 216 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 217 | | public virtual InboundNatRulesDeleteOperation StartDelete(string resourceGroupName, string loadBalancerName, str |
| | | 218 | | { |
| | 2 | 219 | | if (resourceGroupName == null) |
| | | 220 | | { |
| | 0 | 221 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | | 222 | | } |
| | 2 | 223 | | if (loadBalancerName == null) |
| | | 224 | | { |
| | 0 | 225 | | throw new ArgumentNullException(nameof(loadBalancerName)); |
| | | 226 | | } |
| | 2 | 227 | | if (inboundNatRuleName == null) |
| | | 228 | | { |
| | 0 | 229 | | throw new ArgumentNullException(nameof(inboundNatRuleName)); |
| | | 230 | | } |
| | | 231 | | |
| | 2 | 232 | | using var scope = _clientDiagnostics.CreateScope("InboundNatRulesOperations.StartDelete"); |
| | 2 | 233 | | scope.Start(); |
| | | 234 | | try |
| | | 235 | | { |
| | 2 | 236 | | var originalResponse = RestClient.Delete(resourceGroupName, loadBalancerName, inboundNatRuleName, cancel |
| | 2 | 237 | | return new InboundNatRulesDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest( |
| | | 238 | | } |
| | 0 | 239 | | catch (Exception e) |
| | | 240 | | { |
| | 0 | 241 | | scope.Failed(e); |
| | 0 | 242 | | throw; |
| | | 243 | | } |
| | 2 | 244 | | } |
| | | 245 | | |
| | | 246 | | /// <summary> Creates or updates a load balancer inbound nat rule. </summary> |
| | | 247 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | | 248 | | /// <param name="loadBalancerName"> The name of the load balancer. </param> |
| | | 249 | | /// <param name="inboundNatRuleName"> The name of the inbound nat rule. </param> |
| | | 250 | | /// <param name="inboundNatRuleParameters"> Parameters supplied to the create or update inbound nat rule operati |
| | | 251 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 252 | | public virtual async Task<InboundNatRulesCreateOrUpdateOperation> StartCreateOrUpdateAsync(string resourceGroupN |
| | | 253 | | { |
| | 2 | 254 | | if (resourceGroupName == null) |
| | | 255 | | { |
| | 0 | 256 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | | 257 | | } |
| | 2 | 258 | | if (loadBalancerName == null) |
| | | 259 | | { |
| | 0 | 260 | | throw new ArgumentNullException(nameof(loadBalancerName)); |
| | | 261 | | } |
| | 2 | 262 | | if (inboundNatRuleName == null) |
| | | 263 | | { |
| | 0 | 264 | | throw new ArgumentNullException(nameof(inboundNatRuleName)); |
| | | 265 | | } |
| | 2 | 266 | | if (inboundNatRuleParameters == null) |
| | | 267 | | { |
| | 0 | 268 | | throw new ArgumentNullException(nameof(inboundNatRuleParameters)); |
| | | 269 | | } |
| | | 270 | | |
| | 2 | 271 | | using var scope = _clientDiagnostics.CreateScope("InboundNatRulesOperations.StartCreateOrUpdate"); |
| | 2 | 272 | | scope.Start(); |
| | | 273 | | try |
| | | 274 | | { |
| | 2 | 275 | | var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, loadBalancerName, inbound |
| | 2 | 276 | | return new InboundNatRulesCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreate |
| | | 277 | | } |
| | 0 | 278 | | catch (Exception e) |
| | | 279 | | { |
| | 0 | 280 | | scope.Failed(e); |
| | 0 | 281 | | throw; |
| | | 282 | | } |
| | 2 | 283 | | } |
| | | 284 | | |
| | | 285 | | /// <summary> Creates or updates a load balancer inbound nat rule. </summary> |
| | | 286 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | | 287 | | /// <param name="loadBalancerName"> The name of the load balancer. </param> |
| | | 288 | | /// <param name="inboundNatRuleName"> The name of the inbound nat rule. </param> |
| | | 289 | | /// <param name="inboundNatRuleParameters"> Parameters supplied to the create or update inbound nat rule operati |
| | | 290 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 291 | | public virtual InboundNatRulesCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string loadB |
| | | 292 | | { |
| | 2 | 293 | | if (resourceGroupName == null) |
| | | 294 | | { |
| | 0 | 295 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | | 296 | | } |
| | 2 | 297 | | if (loadBalancerName == null) |
| | | 298 | | { |
| | 0 | 299 | | throw new ArgumentNullException(nameof(loadBalancerName)); |
| | | 300 | | } |
| | 2 | 301 | | if (inboundNatRuleName == null) |
| | | 302 | | { |
| | 0 | 303 | | throw new ArgumentNullException(nameof(inboundNatRuleName)); |
| | | 304 | | } |
| | 2 | 305 | | if (inboundNatRuleParameters == null) |
| | | 306 | | { |
| | 0 | 307 | | throw new ArgumentNullException(nameof(inboundNatRuleParameters)); |
| | | 308 | | } |
| | | 309 | | |
| | 2 | 310 | | using var scope = _clientDiagnostics.CreateScope("InboundNatRulesOperations.StartCreateOrUpdate"); |
| | 2 | 311 | | scope.Start(); |
| | | 312 | | try |
| | | 313 | | { |
| | 2 | 314 | | var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, loadBalancerName, inboundNatRuleName |
| | 2 | 315 | | return new InboundNatRulesCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreate |
| | | 316 | | } |
| | 0 | 317 | | catch (Exception e) |
| | | 318 | | { |
| | 0 | 319 | | scope.Failed(e); |
| | 0 | 320 | | throw; |
| | | 321 | | } |
| | 2 | 322 | | } |
| | | 323 | | } |
| | | 324 | | } |