| | 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.Text.Json; |
| | 10 | | using System.Threading; |
| | 11 | | using System.Threading.Tasks; |
| | 12 | | using Azure; |
| | 13 | | using Azure.Core; |
| | 14 | | using Azure.Core.Pipeline; |
| | 15 | | using Azure.ResourceManager.Network.Models; |
| | 16 | |
|
| | 17 | | namespace Azure.ResourceManager.Network |
| | 18 | | { |
| | 19 | | internal partial class ServiceRestOperations |
| | 20 | | { |
| | 21 | | private string subscriptionId; |
| | 22 | | private Uri endpoint; |
| | 23 | | private ClientDiagnostics _clientDiagnostics; |
| | 24 | | private HttpPipeline _pipeline; |
| | 25 | |
|
| | 26 | | /// <summary> Initializes a new instance of ServiceRestOperations. </summary> |
| | 27 | | /// <param name="clientDiagnostics"> The handler for diagnostic messaging in the client. </param> |
| | 28 | | /// <param name="pipeline"> The HTTP pipeline for sending and receiving REST requests and responses. </param> |
| | 29 | | /// <param name="subscriptionId"> The subscription credentials which uniquely identify the Microsoft Azure subsc |
| | 30 | | /// <param name="endpoint"> server parameter. </param> |
| | 31 | | /// <exception cref="ArgumentNullException"> This occurs when one of the required arguments is null. </exception |
| 204 | 32 | | public ServiceRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, |
| | 33 | | { |
| 204 | 34 | | if (subscriptionId == null) |
| | 35 | | { |
| 0 | 36 | | throw new ArgumentNullException(nameof(subscriptionId)); |
| | 37 | | } |
| 204 | 38 | | endpoint ??= new Uri("https://management.azure.com"); |
| | 39 | |
|
| 204 | 40 | | this.subscriptionId = subscriptionId; |
| 204 | 41 | | this.endpoint = endpoint; |
| 204 | 42 | | _clientDiagnostics = clientDiagnostics; |
| 204 | 43 | | _pipeline = pipeline; |
| 204 | 44 | | } |
| | 45 | |
|
| | 46 | | internal HttpMessage CreatePutBastionShareableLinkRequest(string resourceGroupName, string bastionHostName, Bast |
| | 47 | | { |
| 0 | 48 | | var message = _pipeline.CreateMessage(); |
| 0 | 49 | | var request = message.Request; |
| 0 | 50 | | request.Method = RequestMethod.Post; |
| 0 | 51 | | var uri = new RawRequestUriBuilder(); |
| 0 | 52 | | uri.Reset(endpoint); |
| 0 | 53 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 54 | | uri.AppendPath(subscriptionId, true); |
| 0 | 55 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 56 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 57 | | uri.AppendPath("/providers/Microsoft.Network/bastionHosts/", false); |
| 0 | 58 | | uri.AppendPath(bastionHostName, true); |
| 0 | 59 | | uri.AppendPath("/createShareableLinks", false); |
| 0 | 60 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 61 | | request.Uri = uri; |
| 0 | 62 | | request.Headers.Add("Content-Type", "application/json"); |
| 0 | 63 | | var content = new Utf8JsonRequestContent(); |
| 0 | 64 | | content.JsonWriter.WriteObjectValue(bslRequest); |
| 0 | 65 | | request.Content = content; |
| 0 | 66 | | return message; |
| | 67 | | } |
| | 68 | |
|
| | 69 | | /// <summary> Creates a Bastion Shareable Links for all the VMs specified in the request. </summary> |
| | 70 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 71 | | /// <param name="bastionHostName"> The name of the Bastion Host. </param> |
| | 72 | | /// <param name="bslRequest"> Post request for all the Bastion Shareable Link endpoints. </param> |
| | 73 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 74 | | public async Task<Response> PutBastionShareableLinkAsync(string resourceGroupName, string bastionHostName, Basti |
| | 75 | | { |
| 0 | 76 | | if (resourceGroupName == null) |
| | 77 | | { |
| 0 | 78 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 79 | | } |
| 0 | 80 | | if (bastionHostName == null) |
| | 81 | | { |
| 0 | 82 | | throw new ArgumentNullException(nameof(bastionHostName)); |
| | 83 | | } |
| 0 | 84 | | if (bslRequest == null) |
| | 85 | | { |
| 0 | 86 | | throw new ArgumentNullException(nameof(bslRequest)); |
| | 87 | | } |
| | 88 | |
|
| 0 | 89 | | using var message = CreatePutBastionShareableLinkRequest(resourceGroupName, bastionHostName, bslRequest); |
| 0 | 90 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 91 | | switch (message.Response.Status) |
| | 92 | | { |
| | 93 | | case 200: |
| | 94 | | case 202: |
| 0 | 95 | | return message.Response; |
| | 96 | | default: |
| 0 | 97 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 98 | | } |
| 0 | 99 | | } |
| | 100 | |
|
| | 101 | | /// <summary> Creates a Bastion Shareable Links for all the VMs specified in the request. </summary> |
| | 102 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 103 | | /// <param name="bastionHostName"> The name of the Bastion Host. </param> |
| | 104 | | /// <param name="bslRequest"> Post request for all the Bastion Shareable Link endpoints. </param> |
| | 105 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 106 | | public Response PutBastionShareableLink(string resourceGroupName, string bastionHostName, BastionShareableLinkLi |
| | 107 | | { |
| 0 | 108 | | if (resourceGroupName == null) |
| | 109 | | { |
| 0 | 110 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 111 | | } |
| 0 | 112 | | if (bastionHostName == null) |
| | 113 | | { |
| 0 | 114 | | throw new ArgumentNullException(nameof(bastionHostName)); |
| | 115 | | } |
| 0 | 116 | | if (bslRequest == null) |
| | 117 | | { |
| 0 | 118 | | throw new ArgumentNullException(nameof(bslRequest)); |
| | 119 | | } |
| | 120 | |
|
| 0 | 121 | | using var message = CreatePutBastionShareableLinkRequest(resourceGroupName, bastionHostName, bslRequest); |
| 0 | 122 | | _pipeline.Send(message, cancellationToken); |
| 0 | 123 | | switch (message.Response.Status) |
| | 124 | | { |
| | 125 | | case 200: |
| | 126 | | case 202: |
| 0 | 127 | | return message.Response; |
| | 128 | | default: |
| 0 | 129 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 130 | | } |
| 0 | 131 | | } |
| | 132 | |
|
| | 133 | | internal HttpMessage CreateDeleteBastionShareableLinkRequest(string resourceGroupName, string bastionHostName, B |
| | 134 | | { |
| 0 | 135 | | var message = _pipeline.CreateMessage(); |
| 0 | 136 | | var request = message.Request; |
| 0 | 137 | | request.Method = RequestMethod.Post; |
| 0 | 138 | | var uri = new RawRequestUriBuilder(); |
| 0 | 139 | | uri.Reset(endpoint); |
| 0 | 140 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 141 | | uri.AppendPath(subscriptionId, true); |
| 0 | 142 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 143 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 144 | | uri.AppendPath("/providers/Microsoft.Network/bastionHosts/", false); |
| 0 | 145 | | uri.AppendPath(bastionHostName, true); |
| 0 | 146 | | uri.AppendPath("/deleteShareableLinks", false); |
| 0 | 147 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 148 | | request.Uri = uri; |
| 0 | 149 | | request.Headers.Add("Content-Type", "application/json"); |
| 0 | 150 | | var content = new Utf8JsonRequestContent(); |
| 0 | 151 | | content.JsonWriter.WriteObjectValue(bslRequest); |
| 0 | 152 | | request.Content = content; |
| 0 | 153 | | return message; |
| | 154 | | } |
| | 155 | |
|
| | 156 | | /// <summary> Deletes the Bastion Shareable Links for all the VMs specified in the request. </summary> |
| | 157 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 158 | | /// <param name="bastionHostName"> The name of the Bastion Host. </param> |
| | 159 | | /// <param name="bslRequest"> Post request for all the Bastion Shareable Link endpoints. </param> |
| | 160 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 161 | | public async Task<Response> DeleteBastionShareableLinkAsync(string resourceGroupName, string bastionHostName, Ba |
| | 162 | | { |
| 0 | 163 | | if (resourceGroupName == null) |
| | 164 | | { |
| 0 | 165 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 166 | | } |
| 0 | 167 | | if (bastionHostName == null) |
| | 168 | | { |
| 0 | 169 | | throw new ArgumentNullException(nameof(bastionHostName)); |
| | 170 | | } |
| 0 | 171 | | if (bslRequest == null) |
| | 172 | | { |
| 0 | 173 | | throw new ArgumentNullException(nameof(bslRequest)); |
| | 174 | | } |
| | 175 | |
|
| 0 | 176 | | using var message = CreateDeleteBastionShareableLinkRequest(resourceGroupName, bastionHostName, bslRequest); |
| 0 | 177 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 178 | | switch (message.Response.Status) |
| | 179 | | { |
| | 180 | | case 200: |
| | 181 | | case 202: |
| 0 | 182 | | return message.Response; |
| | 183 | | default: |
| 0 | 184 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 185 | | } |
| 0 | 186 | | } |
| | 187 | |
|
| | 188 | | /// <summary> Deletes the Bastion Shareable Links for all the VMs specified in the request. </summary> |
| | 189 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 190 | | /// <param name="bastionHostName"> The name of the Bastion Host. </param> |
| | 191 | | /// <param name="bslRequest"> Post request for all the Bastion Shareable Link endpoints. </param> |
| | 192 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 193 | | public Response DeleteBastionShareableLink(string resourceGroupName, string bastionHostName, BastionShareableLin |
| | 194 | | { |
| 0 | 195 | | if (resourceGroupName == null) |
| | 196 | | { |
| 0 | 197 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 198 | | } |
| 0 | 199 | | if (bastionHostName == null) |
| | 200 | | { |
| 0 | 201 | | throw new ArgumentNullException(nameof(bastionHostName)); |
| | 202 | | } |
| 0 | 203 | | if (bslRequest == null) |
| | 204 | | { |
| 0 | 205 | | throw new ArgumentNullException(nameof(bslRequest)); |
| | 206 | | } |
| | 207 | |
|
| 0 | 208 | | using var message = CreateDeleteBastionShareableLinkRequest(resourceGroupName, bastionHostName, bslRequest); |
| 0 | 209 | | _pipeline.Send(message, cancellationToken); |
| 0 | 210 | | switch (message.Response.Status) |
| | 211 | | { |
| | 212 | | case 200: |
| | 213 | | case 202: |
| 0 | 214 | | return message.Response; |
| | 215 | | default: |
| 0 | 216 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 217 | | } |
| 0 | 218 | | } |
| | 219 | |
|
| | 220 | | internal HttpMessage CreateGetBastionShareableLinkRequest(string resourceGroupName, string bastionHostName, Bast |
| | 221 | | { |
| 0 | 222 | | var message = _pipeline.CreateMessage(); |
| 0 | 223 | | var request = message.Request; |
| 0 | 224 | | request.Method = RequestMethod.Post; |
| 0 | 225 | | var uri = new RawRequestUriBuilder(); |
| 0 | 226 | | uri.Reset(endpoint); |
| 0 | 227 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 228 | | uri.AppendPath(subscriptionId, true); |
| 0 | 229 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 230 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 231 | | uri.AppendPath("/providers/Microsoft.Network/bastionHosts/", false); |
| 0 | 232 | | uri.AppendPath(bastionHostName, true); |
| 0 | 233 | | uri.AppendPath("/getShareableLinks", false); |
| 0 | 234 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 235 | | request.Uri = uri; |
| 0 | 236 | | request.Headers.Add("Content-Type", "application/json"); |
| 0 | 237 | | var content = new Utf8JsonRequestContent(); |
| 0 | 238 | | content.JsonWriter.WriteObjectValue(bslRequest); |
| 0 | 239 | | request.Content = content; |
| 0 | 240 | | return message; |
| | 241 | | } |
| | 242 | |
|
| | 243 | | /// <summary> Return the Bastion Shareable Links for all the VMs specified in the request. </summary> |
| | 244 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 245 | | /// <param name="bastionHostName"> The name of the Bastion Host. </param> |
| | 246 | | /// <param name="bslRequest"> Post request for all the Bastion Shareable Link endpoints. </param> |
| | 247 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 248 | | public async Task<Response<BastionShareableLinkListResult>> GetBastionShareableLinkAsync(string resourceGroupNam |
| | 249 | | { |
| 0 | 250 | | if (resourceGroupName == null) |
| | 251 | | { |
| 0 | 252 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 253 | | } |
| 0 | 254 | | if (bastionHostName == null) |
| | 255 | | { |
| 0 | 256 | | throw new ArgumentNullException(nameof(bastionHostName)); |
| | 257 | | } |
| 0 | 258 | | if (bslRequest == null) |
| | 259 | | { |
| 0 | 260 | | throw new ArgumentNullException(nameof(bslRequest)); |
| | 261 | | } |
| | 262 | |
|
| 0 | 263 | | using var message = CreateGetBastionShareableLinkRequest(resourceGroupName, bastionHostName, bslRequest); |
| 0 | 264 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 265 | | switch (message.Response.Status) |
| | 266 | | { |
| | 267 | | case 200: |
| | 268 | | { |
| 0 | 269 | | BastionShareableLinkListResult value = default; |
| 0 | 270 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 271 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 272 | | { |
| 0 | 273 | | value = null; |
| | 274 | | } |
| | 275 | | else |
| | 276 | | { |
| 0 | 277 | | value = BastionShareableLinkListResult.DeserializeBastionShareableLinkListResult(document.Ro |
| | 278 | | } |
| 0 | 279 | | return Response.FromValue(value, message.Response); |
| | 280 | | } |
| | 281 | | default: |
| 0 | 282 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 283 | | } |
| 0 | 284 | | } |
| | 285 | |
|
| | 286 | | /// <summary> Return the Bastion Shareable Links for all the VMs specified in the request. </summary> |
| | 287 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 288 | | /// <param name="bastionHostName"> The name of the Bastion Host. </param> |
| | 289 | | /// <param name="bslRequest"> Post request for all the Bastion Shareable Link endpoints. </param> |
| | 290 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 291 | | public Response<BastionShareableLinkListResult> GetBastionShareableLink(string resourceGroupName, string bastion |
| | 292 | | { |
| 0 | 293 | | if (resourceGroupName == null) |
| | 294 | | { |
| 0 | 295 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 296 | | } |
| 0 | 297 | | if (bastionHostName == null) |
| | 298 | | { |
| 0 | 299 | | throw new ArgumentNullException(nameof(bastionHostName)); |
| | 300 | | } |
| 0 | 301 | | if (bslRequest == null) |
| | 302 | | { |
| 0 | 303 | | throw new ArgumentNullException(nameof(bslRequest)); |
| | 304 | | } |
| | 305 | |
|
| 0 | 306 | | using var message = CreateGetBastionShareableLinkRequest(resourceGroupName, bastionHostName, bslRequest); |
| 0 | 307 | | _pipeline.Send(message, cancellationToken); |
| 0 | 308 | | switch (message.Response.Status) |
| | 309 | | { |
| | 310 | | case 200: |
| | 311 | | { |
| 0 | 312 | | BastionShareableLinkListResult value = default; |
| 0 | 313 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 314 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 315 | | { |
| 0 | 316 | | value = null; |
| | 317 | | } |
| | 318 | | else |
| | 319 | | { |
| 0 | 320 | | value = BastionShareableLinkListResult.DeserializeBastionShareableLinkListResult(document.Ro |
| | 321 | | } |
| 0 | 322 | | return Response.FromValue(value, message.Response); |
| | 323 | | } |
| | 324 | | default: |
| 0 | 325 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 326 | | } |
| 0 | 327 | | } |
| | 328 | |
|
| | 329 | | internal HttpMessage CreateGetActiveSessionsRequest(string resourceGroupName, string bastionHostName) |
| | 330 | | { |
| 0 | 331 | | var message = _pipeline.CreateMessage(); |
| 0 | 332 | | var request = message.Request; |
| 0 | 333 | | request.Method = RequestMethod.Post; |
| 0 | 334 | | var uri = new RawRequestUriBuilder(); |
| 0 | 335 | | uri.Reset(endpoint); |
| 0 | 336 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 337 | | uri.AppendPath(subscriptionId, true); |
| 0 | 338 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 339 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 340 | | uri.AppendPath("/providers/Microsoft.Network/bastionHosts/", false); |
| 0 | 341 | | uri.AppendPath(bastionHostName, true); |
| 0 | 342 | | uri.AppendPath("/getActiveSessions", false); |
| 0 | 343 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 344 | | request.Uri = uri; |
| 0 | 345 | | return message; |
| | 346 | | } |
| | 347 | |
|
| | 348 | | /// <summary> Returns the list of currently active sessions on the Bastion. </summary> |
| | 349 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 350 | | /// <param name="bastionHostName"> The name of the Bastion Host. </param> |
| | 351 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 352 | | public async Task<Response> GetActiveSessionsAsync(string resourceGroupName, string bastionHostName, Cancellatio |
| | 353 | | { |
| 0 | 354 | | if (resourceGroupName == null) |
| | 355 | | { |
| 0 | 356 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 357 | | } |
| 0 | 358 | | if (bastionHostName == null) |
| | 359 | | { |
| 0 | 360 | | throw new ArgumentNullException(nameof(bastionHostName)); |
| | 361 | | } |
| | 362 | |
|
| 0 | 363 | | using var message = CreateGetActiveSessionsRequest(resourceGroupName, bastionHostName); |
| 0 | 364 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 365 | | switch (message.Response.Status) |
| | 366 | | { |
| | 367 | | case 200: |
| | 368 | | case 202: |
| 0 | 369 | | return message.Response; |
| | 370 | | default: |
| 0 | 371 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 372 | | } |
| 0 | 373 | | } |
| | 374 | |
|
| | 375 | | /// <summary> Returns the list of currently active sessions on the Bastion. </summary> |
| | 376 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 377 | | /// <param name="bastionHostName"> The name of the Bastion Host. </param> |
| | 378 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 379 | | public Response GetActiveSessions(string resourceGroupName, string bastionHostName, CancellationToken cancellati |
| | 380 | | { |
| 0 | 381 | | if (resourceGroupName == null) |
| | 382 | | { |
| 0 | 383 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 384 | | } |
| 0 | 385 | | if (bastionHostName == null) |
| | 386 | | { |
| 0 | 387 | | throw new ArgumentNullException(nameof(bastionHostName)); |
| | 388 | | } |
| | 389 | |
|
| 0 | 390 | | using var message = CreateGetActiveSessionsRequest(resourceGroupName, bastionHostName); |
| 0 | 391 | | _pipeline.Send(message, cancellationToken); |
| 0 | 392 | | switch (message.Response.Status) |
| | 393 | | { |
| | 394 | | case 200: |
| | 395 | | case 202: |
| 0 | 396 | | return message.Response; |
| | 397 | | default: |
| 0 | 398 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 399 | | } |
| 0 | 400 | | } |
| | 401 | |
|
| | 402 | | internal HttpMessage CreateDisconnectActiveSessionsRequest(string resourceGroupName, string bastionHostName, Ses |
| | 403 | | { |
| 0 | 404 | | var message = _pipeline.CreateMessage(); |
| 0 | 405 | | var request = message.Request; |
| 0 | 406 | | request.Method = RequestMethod.Post; |
| 0 | 407 | | var uri = new RawRequestUriBuilder(); |
| 0 | 408 | | uri.Reset(endpoint); |
| 0 | 409 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 410 | | uri.AppendPath(subscriptionId, true); |
| 0 | 411 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 412 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 413 | | uri.AppendPath("/providers/Microsoft.Network/bastionHosts/", false); |
| 0 | 414 | | uri.AppendPath(bastionHostName, true); |
| 0 | 415 | | uri.AppendPath("/disconnectActiveSessions", false); |
| 0 | 416 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 417 | | request.Uri = uri; |
| 0 | 418 | | request.Headers.Add("Content-Type", "application/json"); |
| 0 | 419 | | var content = new Utf8JsonRequestContent(); |
| 0 | 420 | | content.JsonWriter.WriteObjectValue(sessionIds); |
| 0 | 421 | | request.Content = content; |
| 0 | 422 | | return message; |
| | 423 | | } |
| | 424 | |
|
| | 425 | | /// <summary> Returns the list of currently active sessions on the Bastion. </summary> |
| | 426 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 427 | | /// <param name="bastionHostName"> The name of the Bastion Host. </param> |
| | 428 | | /// <param name="sessionIds"> The list of sessionids to disconnect. </param> |
| | 429 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 430 | | public async Task<Response<BastionSessionDeleteResult>> DisconnectActiveSessionsAsync(string resourceGroupName, |
| | 431 | | { |
| 0 | 432 | | if (resourceGroupName == null) |
| | 433 | | { |
| 0 | 434 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 435 | | } |
| 0 | 436 | | if (bastionHostName == null) |
| | 437 | | { |
| 0 | 438 | | throw new ArgumentNullException(nameof(bastionHostName)); |
| | 439 | | } |
| 0 | 440 | | if (sessionIds == null) |
| | 441 | | { |
| 0 | 442 | | throw new ArgumentNullException(nameof(sessionIds)); |
| | 443 | | } |
| | 444 | |
|
| 0 | 445 | | using var message = CreateDisconnectActiveSessionsRequest(resourceGroupName, bastionHostName, sessionIds); |
| 0 | 446 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 447 | | switch (message.Response.Status) |
| | 448 | | { |
| | 449 | | case 200: |
| | 450 | | { |
| 0 | 451 | | BastionSessionDeleteResult value = default; |
| 0 | 452 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 453 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 454 | | { |
| 0 | 455 | | value = null; |
| | 456 | | } |
| | 457 | | else |
| | 458 | | { |
| 0 | 459 | | value = BastionSessionDeleteResult.DeserializeBastionSessionDeleteResult(document.RootElemen |
| | 460 | | } |
| 0 | 461 | | return Response.FromValue(value, message.Response); |
| | 462 | | } |
| | 463 | | default: |
| 0 | 464 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 465 | | } |
| 0 | 466 | | } |
| | 467 | |
|
| | 468 | | /// <summary> Returns the list of currently active sessions on the Bastion. </summary> |
| | 469 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 470 | | /// <param name="bastionHostName"> The name of the Bastion Host. </param> |
| | 471 | | /// <param name="sessionIds"> The list of sessionids to disconnect. </param> |
| | 472 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 473 | | public Response<BastionSessionDeleteResult> DisconnectActiveSessions(string resourceGroupName, string bastionHos |
| | 474 | | { |
| 0 | 475 | | if (resourceGroupName == null) |
| | 476 | | { |
| 0 | 477 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 478 | | } |
| 0 | 479 | | if (bastionHostName == null) |
| | 480 | | { |
| 0 | 481 | | throw new ArgumentNullException(nameof(bastionHostName)); |
| | 482 | | } |
| 0 | 483 | | if (sessionIds == null) |
| | 484 | | { |
| 0 | 485 | | throw new ArgumentNullException(nameof(sessionIds)); |
| | 486 | | } |
| | 487 | |
|
| 0 | 488 | | using var message = CreateDisconnectActiveSessionsRequest(resourceGroupName, bastionHostName, sessionIds); |
| 0 | 489 | | _pipeline.Send(message, cancellationToken); |
| 0 | 490 | | switch (message.Response.Status) |
| | 491 | | { |
| | 492 | | case 200: |
| | 493 | | { |
| 0 | 494 | | BastionSessionDeleteResult value = default; |
| 0 | 495 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 496 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 497 | | { |
| 0 | 498 | | value = null; |
| | 499 | | } |
| | 500 | | else |
| | 501 | | { |
| 0 | 502 | | value = BastionSessionDeleteResult.DeserializeBastionSessionDeleteResult(document.RootElemen |
| | 503 | | } |
| 0 | 504 | | return Response.FromValue(value, message.Response); |
| | 505 | | } |
| | 506 | | default: |
| 0 | 507 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 508 | | } |
| 0 | 509 | | } |
| | 510 | |
|
| | 511 | | internal HttpMessage CreateCheckDnsNameAvailabilityRequest(string location, string domainNameLabel) |
| | 512 | | { |
| 4 | 513 | | var message = _pipeline.CreateMessage(); |
| 4 | 514 | | var request = message.Request; |
| 4 | 515 | | request.Method = RequestMethod.Get; |
| 4 | 516 | | var uri = new RawRequestUriBuilder(); |
| 4 | 517 | | uri.Reset(endpoint); |
| 4 | 518 | | uri.AppendPath("/subscriptions/", false); |
| 4 | 519 | | uri.AppendPath(subscriptionId, true); |
| 4 | 520 | | uri.AppendPath("/providers/Microsoft.Network/locations/", false); |
| 4 | 521 | | uri.AppendPath(location, true); |
| 4 | 522 | | uri.AppendPath("/CheckDnsNameAvailability", false); |
| 4 | 523 | | uri.AppendQuery("domainNameLabel", domainNameLabel, true); |
| 4 | 524 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 4 | 525 | | request.Uri = uri; |
| 4 | 526 | | return message; |
| | 527 | | } |
| | 528 | |
|
| | 529 | | /// <summary> Checks whether a domain name in the cloudapp.azure.com zone is available for use. </summary> |
| | 530 | | /// <param name="location"> The location of the domain name. </param> |
| | 531 | | /// <param name="domainNameLabel"> The domain name to be verified. It must conform to the following regular expr |
| | 532 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 533 | | public async Task<Response<DnsNameAvailabilityResult>> CheckDnsNameAvailabilityAsync(string location, string dom |
| | 534 | | { |
| 2 | 535 | | if (location == null) |
| | 536 | | { |
| 0 | 537 | | throw new ArgumentNullException(nameof(location)); |
| | 538 | | } |
| 2 | 539 | | if (domainNameLabel == null) |
| | 540 | | { |
| 0 | 541 | | throw new ArgumentNullException(nameof(domainNameLabel)); |
| | 542 | | } |
| | 543 | |
|
| 2 | 544 | | using var message = CreateCheckDnsNameAvailabilityRequest(location, domainNameLabel); |
| 2 | 545 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 2 | 546 | | switch (message.Response.Status) |
| | 547 | | { |
| | 548 | | case 200: |
| | 549 | | { |
| 2 | 550 | | DnsNameAvailabilityResult value = default; |
| 2 | 551 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 2 | 552 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 553 | | { |
| 0 | 554 | | value = null; |
| | 555 | | } |
| | 556 | | else |
| | 557 | | { |
| 2 | 558 | | value = DnsNameAvailabilityResult.DeserializeDnsNameAvailabilityResult(document.RootElement) |
| | 559 | | } |
| 2 | 560 | | return Response.FromValue(value, message.Response); |
| | 561 | | } |
| | 562 | | default: |
| 0 | 563 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 564 | | } |
| 2 | 565 | | } |
| | 566 | |
|
| | 567 | | /// <summary> Checks whether a domain name in the cloudapp.azure.com zone is available for use. </summary> |
| | 568 | | /// <param name="location"> The location of the domain name. </param> |
| | 569 | | /// <param name="domainNameLabel"> The domain name to be verified. It must conform to the following regular expr |
| | 570 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 571 | | public Response<DnsNameAvailabilityResult> CheckDnsNameAvailability(string location, string domainNameLabel, Can |
| | 572 | | { |
| 2 | 573 | | if (location == null) |
| | 574 | | { |
| 0 | 575 | | throw new ArgumentNullException(nameof(location)); |
| | 576 | | } |
| 2 | 577 | | if (domainNameLabel == null) |
| | 578 | | { |
| 0 | 579 | | throw new ArgumentNullException(nameof(domainNameLabel)); |
| | 580 | | } |
| | 581 | |
|
| 2 | 582 | | using var message = CreateCheckDnsNameAvailabilityRequest(location, domainNameLabel); |
| 2 | 583 | | _pipeline.Send(message, cancellationToken); |
| 2 | 584 | | switch (message.Response.Status) |
| | 585 | | { |
| | 586 | | case 200: |
| | 587 | | { |
| 2 | 588 | | DnsNameAvailabilityResult value = default; |
| 2 | 589 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 2 | 590 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 591 | | { |
| 0 | 592 | | value = null; |
| | 593 | | } |
| | 594 | | else |
| | 595 | | { |
| 2 | 596 | | value = DnsNameAvailabilityResult.DeserializeDnsNameAvailabilityResult(document.RootElement) |
| | 597 | | } |
| 2 | 598 | | return Response.FromValue(value, message.Response); |
| | 599 | | } |
| | 600 | | default: |
| 0 | 601 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 602 | | } |
| 2 | 603 | | } |
| | 604 | |
|
| | 605 | | internal HttpMessage CreateSupportedSecurityProvidersRequest(string resourceGroupName, string virtualWANName) |
| | 606 | | { |
| 0 | 607 | | var message = _pipeline.CreateMessage(); |
| 0 | 608 | | var request = message.Request; |
| 0 | 609 | | request.Method = RequestMethod.Get; |
| 0 | 610 | | var uri = new RawRequestUriBuilder(); |
| 0 | 611 | | uri.Reset(endpoint); |
| 0 | 612 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 613 | | uri.AppendPath(subscriptionId, true); |
| 0 | 614 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 615 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 616 | | uri.AppendPath("/providers/Microsoft.Network/virtualWans/", false); |
| 0 | 617 | | uri.AppendPath(virtualWANName, true); |
| 0 | 618 | | uri.AppendPath("/supportedSecurityProviders", false); |
| 0 | 619 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 620 | | request.Uri = uri; |
| 0 | 621 | | return message; |
| | 622 | | } |
| | 623 | |
|
| | 624 | | /// <summary> Gives the supported security providers for the virtual wan. </summary> |
| | 625 | | /// <param name="resourceGroupName"> The resource group name. </param> |
| | 626 | | /// <param name="virtualWANName"> The name of the VirtualWAN for which supported security providers are needed. |
| | 627 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 628 | | public async Task<Response<VirtualWanSecurityProviders>> SupportedSecurityProvidersAsync(string resourceGroupNam |
| | 629 | | { |
| 0 | 630 | | if (resourceGroupName == null) |
| | 631 | | { |
| 0 | 632 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 633 | | } |
| 0 | 634 | | if (virtualWANName == null) |
| | 635 | | { |
| 0 | 636 | | throw new ArgumentNullException(nameof(virtualWANName)); |
| | 637 | | } |
| | 638 | |
|
| 0 | 639 | | using var message = CreateSupportedSecurityProvidersRequest(resourceGroupName, virtualWANName); |
| 0 | 640 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 641 | | switch (message.Response.Status) |
| | 642 | | { |
| | 643 | | case 200: |
| | 644 | | { |
| 0 | 645 | | VirtualWanSecurityProviders value = default; |
| 0 | 646 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 647 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 648 | | { |
| 0 | 649 | | value = null; |
| | 650 | | } |
| | 651 | | else |
| | 652 | | { |
| 0 | 653 | | value = VirtualWanSecurityProviders.DeserializeVirtualWanSecurityProviders(document.RootElem |
| | 654 | | } |
| 0 | 655 | | return Response.FromValue(value, message.Response); |
| | 656 | | } |
| | 657 | | default: |
| 0 | 658 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 659 | | } |
| 0 | 660 | | } |
| | 661 | |
|
| | 662 | | /// <summary> Gives the supported security providers for the virtual wan. </summary> |
| | 663 | | /// <param name="resourceGroupName"> The resource group name. </param> |
| | 664 | | /// <param name="virtualWANName"> The name of the VirtualWAN for which supported security providers are needed. |
| | 665 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 666 | | public Response<VirtualWanSecurityProviders> SupportedSecurityProviders(string resourceGroupName, string virtual |
| | 667 | | { |
| 0 | 668 | | if (resourceGroupName == null) |
| | 669 | | { |
| 0 | 670 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 671 | | } |
| 0 | 672 | | if (virtualWANName == null) |
| | 673 | | { |
| 0 | 674 | | throw new ArgumentNullException(nameof(virtualWANName)); |
| | 675 | | } |
| | 676 | |
|
| 0 | 677 | | using var message = CreateSupportedSecurityProvidersRequest(resourceGroupName, virtualWANName); |
| 0 | 678 | | _pipeline.Send(message, cancellationToken); |
| 0 | 679 | | switch (message.Response.Status) |
| | 680 | | { |
| | 681 | | case 200: |
| | 682 | | { |
| 0 | 683 | | VirtualWanSecurityProviders value = default; |
| 0 | 684 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 685 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 686 | | { |
| 0 | 687 | | value = null; |
| | 688 | | } |
| | 689 | | else |
| | 690 | | { |
| 0 | 691 | | value = VirtualWanSecurityProviders.DeserializeVirtualWanSecurityProviders(document.RootElem |
| | 692 | | } |
| 0 | 693 | | return Response.FromValue(value, message.Response); |
| | 694 | | } |
| | 695 | | default: |
| 0 | 696 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 697 | | } |
| 0 | 698 | | } |
| | 699 | |
|
| | 700 | | internal HttpMessage CreateGeneratevirtualwanvpnserverconfigurationvpnprofileRequest(string resourceGroupName, s |
| | 701 | | { |
| 0 | 702 | | var message = _pipeline.CreateMessage(); |
| 0 | 703 | | var request = message.Request; |
| 0 | 704 | | request.Method = RequestMethod.Post; |
| 0 | 705 | | var uri = new RawRequestUriBuilder(); |
| 0 | 706 | | uri.Reset(endpoint); |
| 0 | 707 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 708 | | uri.AppendPath(subscriptionId, true); |
| 0 | 709 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 710 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 711 | | uri.AppendPath("/providers/Microsoft.Network/virtualWans/", false); |
| 0 | 712 | | uri.AppendPath(virtualWANName, true); |
| 0 | 713 | | uri.AppendPath("/GenerateVpnProfile", false); |
| 0 | 714 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 715 | | request.Uri = uri; |
| 0 | 716 | | request.Headers.Add("Content-Type", "application/json"); |
| 0 | 717 | | var content = new Utf8JsonRequestContent(); |
| 0 | 718 | | content.JsonWriter.WriteObjectValue(vpnClientParams); |
| 0 | 719 | | request.Content = content; |
| 0 | 720 | | return message; |
| | 721 | | } |
| | 722 | |
|
| | 723 | | /// <summary> Generates a unique VPN profile for P2S clients for VirtualWan and associated VpnServerConfiguratio |
| | 724 | | /// <param name="resourceGroupName"> The resource group name. </param> |
| | 725 | | /// <param name="virtualWANName"> The name of the VirtualWAN whose associated VpnServerConfigurations is needed. |
| | 726 | | /// <param name="vpnClientParams"> Parameters supplied to the generate VirtualWan VPN profile generation operati |
| | 727 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 728 | | public async Task<Response> GeneratevirtualwanvpnserverconfigurationvpnprofileAsync(string resourceGroupName, st |
| | 729 | | { |
| 0 | 730 | | if (resourceGroupName == null) |
| | 731 | | { |
| 0 | 732 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 733 | | } |
| 0 | 734 | | if (virtualWANName == null) |
| | 735 | | { |
| 0 | 736 | | throw new ArgumentNullException(nameof(virtualWANName)); |
| | 737 | | } |
| 0 | 738 | | if (vpnClientParams == null) |
| | 739 | | { |
| 0 | 740 | | throw new ArgumentNullException(nameof(vpnClientParams)); |
| | 741 | | } |
| | 742 | |
|
| 0 | 743 | | using var message = CreateGeneratevirtualwanvpnserverconfigurationvpnprofileRequest(resourceGroupName, virtu |
| 0 | 744 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 745 | | switch (message.Response.Status) |
| | 746 | | { |
| | 747 | | case 200: |
| | 748 | | case 202: |
| 0 | 749 | | return message.Response; |
| | 750 | | default: |
| 0 | 751 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 752 | | } |
| 0 | 753 | | } |
| | 754 | |
|
| | 755 | | /// <summary> Generates a unique VPN profile for P2S clients for VirtualWan and associated VpnServerConfiguratio |
| | 756 | | /// <param name="resourceGroupName"> The resource group name. </param> |
| | 757 | | /// <param name="virtualWANName"> The name of the VirtualWAN whose associated VpnServerConfigurations is needed. |
| | 758 | | /// <param name="vpnClientParams"> Parameters supplied to the generate VirtualWan VPN profile generation operati |
| | 759 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 760 | | public Response Generatevirtualwanvpnserverconfigurationvpnprofile(string resourceGroupName, string virtualWANNa |
| | 761 | | { |
| 0 | 762 | | if (resourceGroupName == null) |
| | 763 | | { |
| 0 | 764 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 765 | | } |
| 0 | 766 | | if (virtualWANName == null) |
| | 767 | | { |
| 0 | 768 | | throw new ArgumentNullException(nameof(virtualWANName)); |
| | 769 | | } |
| 0 | 770 | | if (vpnClientParams == null) |
| | 771 | | { |
| 0 | 772 | | throw new ArgumentNullException(nameof(vpnClientParams)); |
| | 773 | | } |
| | 774 | |
|
| 0 | 775 | | using var message = CreateGeneratevirtualwanvpnserverconfigurationvpnprofileRequest(resourceGroupName, virtu |
| 0 | 776 | | _pipeline.Send(message, cancellationToken); |
| 0 | 777 | | switch (message.Response.Status) |
| | 778 | | { |
| | 779 | | case 200: |
| | 780 | | case 202: |
| 0 | 781 | | return message.Response; |
| | 782 | | default: |
| 0 | 783 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 784 | | } |
| 0 | 785 | | } |
| | 786 | |
|
| | 787 | | internal HttpMessage CreatePutBastionShareableLinkNextPageRequest(string nextLink, string resourceGroupName, str |
| | 788 | | { |
| 0 | 789 | | var message = _pipeline.CreateMessage(); |
| 0 | 790 | | var request = message.Request; |
| 0 | 791 | | request.Method = RequestMethod.Get; |
| 0 | 792 | | var uri = new RawRequestUriBuilder(); |
| 0 | 793 | | uri.Reset(endpoint); |
| 0 | 794 | | uri.AppendRawNextLink(nextLink, false); |
| 0 | 795 | | request.Uri = uri; |
| 0 | 796 | | request.Headers.Add("Content-Type", "application/json"); |
| 0 | 797 | | return message; |
| | 798 | | } |
| | 799 | |
|
| | 800 | | /// <summary> Creates a Bastion Shareable Links for all the VMs specified in the request. </summary> |
| | 801 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 802 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 803 | | /// <param name="bastionHostName"> The name of the Bastion Host. </param> |
| | 804 | | /// <param name="bslRequest"> Post request for all the Bastion Shareable Link endpoints. </param> |
| | 805 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 806 | | public async Task<Response> PutBastionShareableLinkNextPageAsync(string nextLink, string resourceGroupName, stri |
| | 807 | | { |
| 0 | 808 | | if (nextLink == null) |
| | 809 | | { |
| 0 | 810 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 811 | | } |
| 0 | 812 | | if (resourceGroupName == null) |
| | 813 | | { |
| 0 | 814 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 815 | | } |
| 0 | 816 | | if (bastionHostName == null) |
| | 817 | | { |
| 0 | 818 | | throw new ArgumentNullException(nameof(bastionHostName)); |
| | 819 | | } |
| 0 | 820 | | if (bslRequest == null) |
| | 821 | | { |
| 0 | 822 | | throw new ArgumentNullException(nameof(bslRequest)); |
| | 823 | | } |
| | 824 | |
|
| 0 | 825 | | using var message = CreatePutBastionShareableLinkNextPageRequest(nextLink, resourceGroupName, bastionHostNam |
| 0 | 826 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 827 | | switch (message.Response.Status) |
| | 828 | | { |
| | 829 | | case 200: |
| 0 | 830 | | return message.Response; |
| | 831 | | default: |
| 0 | 832 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 833 | | } |
| 0 | 834 | | } |
| | 835 | |
|
| | 836 | | /// <summary> Creates a Bastion Shareable Links for all the VMs specified in the request. </summary> |
| | 837 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 838 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 839 | | /// <param name="bastionHostName"> The name of the Bastion Host. </param> |
| | 840 | | /// <param name="bslRequest"> Post request for all the Bastion Shareable Link endpoints. </param> |
| | 841 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 842 | | public Response PutBastionShareableLinkNextPage(string nextLink, string resourceGroupName, string bastionHostNam |
| | 843 | | { |
| 0 | 844 | | if (nextLink == null) |
| | 845 | | { |
| 0 | 846 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 847 | | } |
| 0 | 848 | | if (resourceGroupName == null) |
| | 849 | | { |
| 0 | 850 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 851 | | } |
| 0 | 852 | | if (bastionHostName == null) |
| | 853 | | { |
| 0 | 854 | | throw new ArgumentNullException(nameof(bastionHostName)); |
| | 855 | | } |
| 0 | 856 | | if (bslRequest == null) |
| | 857 | | { |
| 0 | 858 | | throw new ArgumentNullException(nameof(bslRequest)); |
| | 859 | | } |
| | 860 | |
|
| 0 | 861 | | using var message = CreatePutBastionShareableLinkNextPageRequest(nextLink, resourceGroupName, bastionHostNam |
| 0 | 862 | | _pipeline.Send(message, cancellationToken); |
| 0 | 863 | | switch (message.Response.Status) |
| | 864 | | { |
| | 865 | | case 200: |
| 0 | 866 | | return message.Response; |
| | 867 | | default: |
| 0 | 868 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 869 | | } |
| 0 | 870 | | } |
| | 871 | |
|
| | 872 | | internal HttpMessage CreateGetBastionShareableLinkNextPageRequest(string nextLink, string resourceGroupName, str |
| | 873 | | { |
| 0 | 874 | | var message = _pipeline.CreateMessage(); |
| 0 | 875 | | var request = message.Request; |
| 0 | 876 | | request.Method = RequestMethod.Get; |
| 0 | 877 | | var uri = new RawRequestUriBuilder(); |
| 0 | 878 | | uri.Reset(endpoint); |
| 0 | 879 | | uri.AppendRawNextLink(nextLink, false); |
| 0 | 880 | | request.Uri = uri; |
| 0 | 881 | | request.Headers.Add("Content-Type", "application/json"); |
| 0 | 882 | | return message; |
| | 883 | | } |
| | 884 | |
|
| | 885 | | /// <summary> Return the Bastion Shareable Links for all the VMs specified in the request. </summary> |
| | 886 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 887 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 888 | | /// <param name="bastionHostName"> The name of the Bastion Host. </param> |
| | 889 | | /// <param name="bslRequest"> Post request for all the Bastion Shareable Link endpoints. </param> |
| | 890 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 891 | | public async Task<Response<BastionShareableLinkListResult>> GetBastionShareableLinkNextPageAsync(string nextLink |
| | 892 | | { |
| 0 | 893 | | if (nextLink == null) |
| | 894 | | { |
| 0 | 895 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 896 | | } |
| 0 | 897 | | if (resourceGroupName == null) |
| | 898 | | { |
| 0 | 899 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 900 | | } |
| 0 | 901 | | if (bastionHostName == null) |
| | 902 | | { |
| 0 | 903 | | throw new ArgumentNullException(nameof(bastionHostName)); |
| | 904 | | } |
| 0 | 905 | | if (bslRequest == null) |
| | 906 | | { |
| 0 | 907 | | throw new ArgumentNullException(nameof(bslRequest)); |
| | 908 | | } |
| | 909 | |
|
| 0 | 910 | | using var message = CreateGetBastionShareableLinkNextPageRequest(nextLink, resourceGroupName, bastionHostNam |
| 0 | 911 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 912 | | switch (message.Response.Status) |
| | 913 | | { |
| | 914 | | case 200: |
| | 915 | | { |
| 0 | 916 | | BastionShareableLinkListResult value = default; |
| 0 | 917 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 918 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 919 | | { |
| 0 | 920 | | value = null; |
| | 921 | | } |
| | 922 | | else |
| | 923 | | { |
| 0 | 924 | | value = BastionShareableLinkListResult.DeserializeBastionShareableLinkListResult(document.Ro |
| | 925 | | } |
| 0 | 926 | | return Response.FromValue(value, message.Response); |
| | 927 | | } |
| | 928 | | default: |
| 0 | 929 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 930 | | } |
| 0 | 931 | | } |
| | 932 | |
|
| | 933 | | /// <summary> Return the Bastion Shareable Links for all the VMs specified in the request. </summary> |
| | 934 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 935 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 936 | | /// <param name="bastionHostName"> The name of the Bastion Host. </param> |
| | 937 | | /// <param name="bslRequest"> Post request for all the Bastion Shareable Link endpoints. </param> |
| | 938 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 939 | | public Response<BastionShareableLinkListResult> GetBastionShareableLinkNextPage(string nextLink, string resource |
| | 940 | | { |
| 0 | 941 | | if (nextLink == null) |
| | 942 | | { |
| 0 | 943 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 944 | | } |
| 0 | 945 | | if (resourceGroupName == null) |
| | 946 | | { |
| 0 | 947 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 948 | | } |
| 0 | 949 | | if (bastionHostName == null) |
| | 950 | | { |
| 0 | 951 | | throw new ArgumentNullException(nameof(bastionHostName)); |
| | 952 | | } |
| 0 | 953 | | if (bslRequest == null) |
| | 954 | | { |
| 0 | 955 | | throw new ArgumentNullException(nameof(bslRequest)); |
| | 956 | | } |
| | 957 | |
|
| 0 | 958 | | using var message = CreateGetBastionShareableLinkNextPageRequest(nextLink, resourceGroupName, bastionHostNam |
| 0 | 959 | | _pipeline.Send(message, cancellationToken); |
| 0 | 960 | | switch (message.Response.Status) |
| | 961 | | { |
| | 962 | | case 200: |
| | 963 | | { |
| 0 | 964 | | BastionShareableLinkListResult value = default; |
| 0 | 965 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 966 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 967 | | { |
| 0 | 968 | | value = null; |
| | 969 | | } |
| | 970 | | else |
| | 971 | | { |
| 0 | 972 | | value = BastionShareableLinkListResult.DeserializeBastionShareableLinkListResult(document.Ro |
| | 973 | | } |
| 0 | 974 | | return Response.FromValue(value, message.Response); |
| | 975 | | } |
| | 976 | | default: |
| 0 | 977 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 978 | | } |
| 0 | 979 | | } |
| | 980 | |
|
| | 981 | | internal HttpMessage CreateGetActiveSessionsNextPageRequest(string nextLink, string resourceGroupName, string ba |
| | 982 | | { |
| 0 | 983 | | var message = _pipeline.CreateMessage(); |
| 0 | 984 | | var request = message.Request; |
| 0 | 985 | | request.Method = RequestMethod.Get; |
| 0 | 986 | | var uri = new RawRequestUriBuilder(); |
| 0 | 987 | | uri.Reset(endpoint); |
| 0 | 988 | | uri.AppendRawNextLink(nextLink, false); |
| 0 | 989 | | request.Uri = uri; |
| 0 | 990 | | return message; |
| | 991 | | } |
| | 992 | |
|
| | 993 | | /// <summary> Returns the list of currently active sessions on the Bastion. </summary> |
| | 994 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 995 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 996 | | /// <param name="bastionHostName"> The name of the Bastion Host. </param> |
| | 997 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 998 | | public async Task<Response> GetActiveSessionsNextPageAsync(string nextLink, string resourceGroupName, string bas |
| | 999 | | { |
| 0 | 1000 | | if (nextLink == null) |
| | 1001 | | { |
| 0 | 1002 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 1003 | | } |
| 0 | 1004 | | if (resourceGroupName == null) |
| | 1005 | | { |
| 0 | 1006 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1007 | | } |
| 0 | 1008 | | if (bastionHostName == null) |
| | 1009 | | { |
| 0 | 1010 | | throw new ArgumentNullException(nameof(bastionHostName)); |
| | 1011 | | } |
| | 1012 | |
|
| 0 | 1013 | | using var message = CreateGetActiveSessionsNextPageRequest(nextLink, resourceGroupName, bastionHostName); |
| 0 | 1014 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 1015 | | switch (message.Response.Status) |
| | 1016 | | { |
| | 1017 | | case 200: |
| 0 | 1018 | | return message.Response; |
| | 1019 | | default: |
| 0 | 1020 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 1021 | | } |
| 0 | 1022 | | } |
| | 1023 | |
|
| | 1024 | | /// <summary> Returns the list of currently active sessions on the Bastion. </summary> |
| | 1025 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 1026 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 1027 | | /// <param name="bastionHostName"> The name of the Bastion Host. </param> |
| | 1028 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1029 | | public Response GetActiveSessionsNextPage(string nextLink, string resourceGroupName, string bastionHostName, Can |
| | 1030 | | { |
| 0 | 1031 | | if (nextLink == null) |
| | 1032 | | { |
| 0 | 1033 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 1034 | | } |
| 0 | 1035 | | if (resourceGroupName == null) |
| | 1036 | | { |
| 0 | 1037 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1038 | | } |
| 0 | 1039 | | if (bastionHostName == null) |
| | 1040 | | { |
| 0 | 1041 | | throw new ArgumentNullException(nameof(bastionHostName)); |
| | 1042 | | } |
| | 1043 | |
|
| 0 | 1044 | | using var message = CreateGetActiveSessionsNextPageRequest(nextLink, resourceGroupName, bastionHostName); |
| 0 | 1045 | | _pipeline.Send(message, cancellationToken); |
| 0 | 1046 | | switch (message.Response.Status) |
| | 1047 | | { |
| | 1048 | | case 200: |
| 0 | 1049 | | return message.Response; |
| | 1050 | | default: |
| 0 | 1051 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 1052 | | } |
| 0 | 1053 | | } |
| | 1054 | |
|
| | 1055 | | internal HttpMessage CreateDisconnectActiveSessionsNextPageRequest(string nextLink, string resourceGroupName, st |
| | 1056 | | { |
| 0 | 1057 | | var message = _pipeline.CreateMessage(); |
| 0 | 1058 | | var request = message.Request; |
| 0 | 1059 | | request.Method = RequestMethod.Get; |
| 0 | 1060 | | var uri = new RawRequestUriBuilder(); |
| 0 | 1061 | | uri.Reset(endpoint); |
| 0 | 1062 | | uri.AppendRawNextLink(nextLink, false); |
| 0 | 1063 | | request.Uri = uri; |
| 0 | 1064 | | request.Headers.Add("Content-Type", "application/json"); |
| 0 | 1065 | | return message; |
| | 1066 | | } |
| | 1067 | |
|
| | 1068 | | /// <summary> Returns the list of currently active sessions on the Bastion. </summary> |
| | 1069 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 1070 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 1071 | | /// <param name="bastionHostName"> The name of the Bastion Host. </param> |
| | 1072 | | /// <param name="sessionIds"> The list of sessionids to disconnect. </param> |
| | 1073 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1074 | | public async Task<Response<BastionSessionDeleteResult>> DisconnectActiveSessionsNextPageAsync(string nextLink, s |
| | 1075 | | { |
| 0 | 1076 | | if (nextLink == null) |
| | 1077 | | { |
| 0 | 1078 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 1079 | | } |
| 0 | 1080 | | if (resourceGroupName == null) |
| | 1081 | | { |
| 0 | 1082 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1083 | | } |
| 0 | 1084 | | if (bastionHostName == null) |
| | 1085 | | { |
| 0 | 1086 | | throw new ArgumentNullException(nameof(bastionHostName)); |
| | 1087 | | } |
| 0 | 1088 | | if (sessionIds == null) |
| | 1089 | | { |
| 0 | 1090 | | throw new ArgumentNullException(nameof(sessionIds)); |
| | 1091 | | } |
| | 1092 | |
|
| 0 | 1093 | | using var message = CreateDisconnectActiveSessionsNextPageRequest(nextLink, resourceGroupName, bastionHostNa |
| 0 | 1094 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 1095 | | switch (message.Response.Status) |
| | 1096 | | { |
| | 1097 | | case 200: |
| | 1098 | | { |
| 0 | 1099 | | BastionSessionDeleteResult value = default; |
| 0 | 1100 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 1101 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 1102 | | { |
| 0 | 1103 | | value = null; |
| | 1104 | | } |
| | 1105 | | else |
| | 1106 | | { |
| 0 | 1107 | | value = BastionSessionDeleteResult.DeserializeBastionSessionDeleteResult(document.RootElemen |
| | 1108 | | } |
| 0 | 1109 | | return Response.FromValue(value, message.Response); |
| | 1110 | | } |
| | 1111 | | default: |
| 0 | 1112 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 1113 | | } |
| 0 | 1114 | | } |
| | 1115 | |
|
| | 1116 | | /// <summary> Returns the list of currently active sessions on the Bastion. </summary> |
| | 1117 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 1118 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 1119 | | /// <param name="bastionHostName"> The name of the Bastion Host. </param> |
| | 1120 | | /// <param name="sessionIds"> The list of sessionids to disconnect. </param> |
| | 1121 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1122 | | public Response<BastionSessionDeleteResult> DisconnectActiveSessionsNextPage(string nextLink, string resourceGro |
| | 1123 | | { |
| 0 | 1124 | | if (nextLink == null) |
| | 1125 | | { |
| 0 | 1126 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 1127 | | } |
| 0 | 1128 | | if (resourceGroupName == null) |
| | 1129 | | { |
| 0 | 1130 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1131 | | } |
| 0 | 1132 | | if (bastionHostName == null) |
| | 1133 | | { |
| 0 | 1134 | | throw new ArgumentNullException(nameof(bastionHostName)); |
| | 1135 | | } |
| 0 | 1136 | | if (sessionIds == null) |
| | 1137 | | { |
| 0 | 1138 | | throw new ArgumentNullException(nameof(sessionIds)); |
| | 1139 | | } |
| | 1140 | |
|
| 0 | 1141 | | using var message = CreateDisconnectActiveSessionsNextPageRequest(nextLink, resourceGroupName, bastionHostNa |
| 0 | 1142 | | _pipeline.Send(message, cancellationToken); |
| 0 | 1143 | | switch (message.Response.Status) |
| | 1144 | | { |
| | 1145 | | case 200: |
| | 1146 | | { |
| 0 | 1147 | | BastionSessionDeleteResult value = default; |
| 0 | 1148 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 1149 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 1150 | | { |
| 0 | 1151 | | value = null; |
| | 1152 | | } |
| | 1153 | | else |
| | 1154 | | { |
| 0 | 1155 | | value = BastionSessionDeleteResult.DeserializeBastionSessionDeleteResult(document.RootElemen |
| | 1156 | | } |
| 0 | 1157 | | return Response.FromValue(value, message.Response); |
| | 1158 | | } |
| | 1159 | | default: |
| 0 | 1160 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 1161 | | } |
| 0 | 1162 | | } |
| | 1163 | | } |
| | 1164 | | } |