| | 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.DigitalTwins.Models; |
| | 16 | |
|
| | 17 | | namespace Azure.ResourceManager.DigitalTwins |
| | 18 | | { |
| | 19 | | internal partial class DigitalTwinsEndpointRestOperations |
| | 20 | | { |
| | 21 | | private string subscriptionId; |
| | 22 | | private Uri endpoint; |
| | 23 | | private string apiVersion; |
| | 24 | | private ClientDiagnostics _clientDiagnostics; |
| | 25 | | private HttpPipeline _pipeline; |
| | 26 | |
|
| | 27 | | /// <summary> Initializes a new instance of DigitalTwinsEndpointRestOperations. </summary> |
| | 28 | | /// <param name="clientDiagnostics"> The handler for diagnostic messaging in the client. </param> |
| | 29 | | /// <param name="pipeline"> The HTTP pipeline for sending and receiving REST requests and responses. </param> |
| | 30 | | /// <param name="subscriptionId"> The subscription identifier. </param> |
| | 31 | | /// <param name="endpoint"> server parameter. </param> |
| | 32 | | /// <param name="apiVersion"> Api Version. </param> |
| | 33 | | /// <exception cref="ArgumentNullException"> <paramref name="subscriptionId"/> or <paramref name="apiVersion"/> |
| 0 | 34 | | public DigitalTwinsEndpointRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string sub |
| | 35 | | { |
| 0 | 36 | | if (subscriptionId == null) |
| | 37 | | { |
| 0 | 38 | | throw new ArgumentNullException(nameof(subscriptionId)); |
| | 39 | | } |
| 0 | 40 | | endpoint ??= new Uri("https://management.azure.com"); |
| 0 | 41 | | if (apiVersion == null) |
| | 42 | | { |
| 0 | 43 | | throw new ArgumentNullException(nameof(apiVersion)); |
| | 44 | | } |
| | 45 | |
|
| 0 | 46 | | this.subscriptionId = subscriptionId; |
| 0 | 47 | | this.endpoint = endpoint; |
| 0 | 48 | | this.apiVersion = apiVersion; |
| 0 | 49 | | _clientDiagnostics = clientDiagnostics; |
| 0 | 50 | | _pipeline = pipeline; |
| 0 | 51 | | } |
| | 52 | |
|
| | 53 | | internal HttpMessage CreateListRequest(string resourceGroupName, string resourceName) |
| | 54 | | { |
| 0 | 55 | | var message = _pipeline.CreateMessage(); |
| 0 | 56 | | var request = message.Request; |
| 0 | 57 | | request.Method = RequestMethod.Get; |
| 0 | 58 | | var uri = new RawRequestUriBuilder(); |
| 0 | 59 | | uri.Reset(endpoint); |
| 0 | 60 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 61 | | uri.AppendPath(subscriptionId, true); |
| 0 | 62 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 63 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 64 | | uri.AppendPath("/providers/Microsoft.DigitalTwins/digitalTwinsInstances/", false); |
| 0 | 65 | | uri.AppendPath(resourceName, true); |
| 0 | 66 | | uri.AppendPath("/endpoints", false); |
| 0 | 67 | | uri.AppendQuery("api-version", apiVersion, true); |
| 0 | 68 | | request.Uri = uri; |
| 0 | 69 | | return message; |
| | 70 | | } |
| | 71 | |
|
| | 72 | | /// <summary> Get DigitalTwinsInstance Endpoints. </summary> |
| | 73 | | /// <param name="resourceGroupName"> The name of the resource group that contains the DigitalTwinsInstance. </pa |
| | 74 | | /// <param name="resourceName"> The name of the DigitalTwinsInstance. </param> |
| | 75 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 76 | | /// <exception cref="ArgumentNullException"> <paramref name="resourceGroupName"/> or <paramref name="resourceNam |
| | 77 | | public async Task<Response<DigitalTwinsEndpointResourceListResult>> ListAsync(string resourceGroupName, string r |
| | 78 | | { |
| 0 | 79 | | if (resourceGroupName == null) |
| | 80 | | { |
| 0 | 81 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 82 | | } |
| 0 | 83 | | if (resourceName == null) |
| | 84 | | { |
| 0 | 85 | | throw new ArgumentNullException(nameof(resourceName)); |
| | 86 | | } |
| | 87 | |
|
| 0 | 88 | | using var message = CreateListRequest(resourceGroupName, resourceName); |
| 0 | 89 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 90 | | switch (message.Response.Status) |
| | 91 | | { |
| | 92 | | case 200: |
| | 93 | | { |
| | 94 | | DigitalTwinsEndpointResourceListResult value = default; |
| 0 | 95 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 96 | | value = DigitalTwinsEndpointResourceListResult.DeserializeDigitalTwinsEndpointResourceListResult |
| 0 | 97 | | return Response.FromValue(value, message.Response); |
| | 98 | | } |
| | 99 | | default: |
| 0 | 100 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 101 | | } |
| 0 | 102 | | } |
| | 103 | |
|
| | 104 | | /// <summary> Get DigitalTwinsInstance Endpoints. </summary> |
| | 105 | | /// <param name="resourceGroupName"> The name of the resource group that contains the DigitalTwinsInstance. </pa |
| | 106 | | /// <param name="resourceName"> The name of the DigitalTwinsInstance. </param> |
| | 107 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 108 | | /// <exception cref="ArgumentNullException"> <paramref name="resourceGroupName"/> or <paramref name="resourceNam |
| | 109 | | public Response<DigitalTwinsEndpointResourceListResult> List(string resourceGroupName, string resourceName, Canc |
| | 110 | | { |
| 0 | 111 | | if (resourceGroupName == null) |
| | 112 | | { |
| 0 | 113 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 114 | | } |
| 0 | 115 | | if (resourceName == null) |
| | 116 | | { |
| 0 | 117 | | throw new ArgumentNullException(nameof(resourceName)); |
| | 118 | | } |
| | 119 | |
|
| 0 | 120 | | using var message = CreateListRequest(resourceGroupName, resourceName); |
| 0 | 121 | | _pipeline.Send(message, cancellationToken); |
| 0 | 122 | | switch (message.Response.Status) |
| | 123 | | { |
| | 124 | | case 200: |
| | 125 | | { |
| | 126 | | DigitalTwinsEndpointResourceListResult value = default; |
| 0 | 127 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 128 | | value = DigitalTwinsEndpointResourceListResult.DeserializeDigitalTwinsEndpointResourceListResult |
| 0 | 129 | | return Response.FromValue(value, message.Response); |
| | 130 | | } |
| | 131 | | default: |
| 0 | 132 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 133 | | } |
| 0 | 134 | | } |
| | 135 | |
|
| | 136 | | internal HttpMessage CreateGetRequest(string resourceGroupName, string resourceName, string endpointName) |
| | 137 | | { |
| 0 | 138 | | var message = _pipeline.CreateMessage(); |
| 0 | 139 | | var request = message.Request; |
| 0 | 140 | | request.Method = RequestMethod.Get; |
| 0 | 141 | | var uri = new RawRequestUriBuilder(); |
| 0 | 142 | | uri.Reset(endpoint); |
| 0 | 143 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 144 | | uri.AppendPath(subscriptionId, true); |
| 0 | 145 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 146 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 147 | | uri.AppendPath("/providers/Microsoft.DigitalTwins/digitalTwinsInstances/", false); |
| 0 | 148 | | uri.AppendPath(resourceName, true); |
| 0 | 149 | | uri.AppendPath("/endpoints/", false); |
| 0 | 150 | | uri.AppendPath(endpointName, true); |
| 0 | 151 | | uri.AppendQuery("api-version", apiVersion, true); |
| 0 | 152 | | request.Uri = uri; |
| 0 | 153 | | return message; |
| | 154 | | } |
| | 155 | |
|
| | 156 | | /// <summary> Get DigitalTwinsInstances Endpoint. </summary> |
| | 157 | | /// <param name="resourceGroupName"> The name of the resource group that contains the DigitalTwinsInstance. </pa |
| | 158 | | /// <param name="resourceName"> The name of the DigitalTwinsInstance. </param> |
| | 159 | | /// <param name="endpointName"> Name of Endpoint Resource. </param> |
| | 160 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 161 | | /// <exception cref="ArgumentNullException"> <paramref name="resourceGroupName"/>, <paramref name="resourceName" |
| | 162 | | public async Task<Response<DigitalTwinsEndpointResource>> GetAsync(string resourceGroupName, string resourceName |
| | 163 | | { |
| 0 | 164 | | if (resourceGroupName == null) |
| | 165 | | { |
| 0 | 166 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 167 | | } |
| 0 | 168 | | if (resourceName == null) |
| | 169 | | { |
| 0 | 170 | | throw new ArgumentNullException(nameof(resourceName)); |
| | 171 | | } |
| 0 | 172 | | if (endpointName == null) |
| | 173 | | { |
| 0 | 174 | | throw new ArgumentNullException(nameof(endpointName)); |
| | 175 | | } |
| | 176 | |
|
| 0 | 177 | | using var message = CreateGetRequest(resourceGroupName, resourceName, endpointName); |
| 0 | 178 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 179 | | switch (message.Response.Status) |
| | 180 | | { |
| | 181 | | case 200: |
| | 182 | | { |
| | 183 | | DigitalTwinsEndpointResource value = default; |
| 0 | 184 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 185 | | value = DigitalTwinsEndpointResource.DeserializeDigitalTwinsEndpointResource(document.RootElemen |
| 0 | 186 | | return Response.FromValue(value, message.Response); |
| | 187 | | } |
| | 188 | | default: |
| 0 | 189 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 190 | | } |
| 0 | 191 | | } |
| | 192 | |
|
| | 193 | | /// <summary> Get DigitalTwinsInstances Endpoint. </summary> |
| | 194 | | /// <param name="resourceGroupName"> The name of the resource group that contains the DigitalTwinsInstance. </pa |
| | 195 | | /// <param name="resourceName"> The name of the DigitalTwinsInstance. </param> |
| | 196 | | /// <param name="endpointName"> Name of Endpoint Resource. </param> |
| | 197 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 198 | | /// <exception cref="ArgumentNullException"> <paramref name="resourceGroupName"/>, <paramref name="resourceName" |
| | 199 | | public Response<DigitalTwinsEndpointResource> Get(string resourceGroupName, string resourceName, string endpoint |
| | 200 | | { |
| 0 | 201 | | if (resourceGroupName == null) |
| | 202 | | { |
| 0 | 203 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 204 | | } |
| 0 | 205 | | if (resourceName == null) |
| | 206 | | { |
| 0 | 207 | | throw new ArgumentNullException(nameof(resourceName)); |
| | 208 | | } |
| 0 | 209 | | if (endpointName == null) |
| | 210 | | { |
| 0 | 211 | | throw new ArgumentNullException(nameof(endpointName)); |
| | 212 | | } |
| | 213 | |
|
| 0 | 214 | | using var message = CreateGetRequest(resourceGroupName, resourceName, endpointName); |
| 0 | 215 | | _pipeline.Send(message, cancellationToken); |
| 0 | 216 | | switch (message.Response.Status) |
| | 217 | | { |
| | 218 | | case 200: |
| | 219 | | { |
| | 220 | | DigitalTwinsEndpointResource value = default; |
| 0 | 221 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 222 | | value = DigitalTwinsEndpointResource.DeserializeDigitalTwinsEndpointResource(document.RootElemen |
| 0 | 223 | | return Response.FromValue(value, message.Response); |
| | 224 | | } |
| | 225 | | default: |
| 0 | 226 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 227 | | } |
| 0 | 228 | | } |
| | 229 | |
|
| | 230 | | internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string resourceName, string endpointN |
| | 231 | | { |
| 0 | 232 | | var message = _pipeline.CreateMessage(); |
| 0 | 233 | | var request = message.Request; |
| 0 | 234 | | request.Method = RequestMethod.Put; |
| 0 | 235 | | var uri = new RawRequestUriBuilder(); |
| 0 | 236 | | uri.Reset(endpoint); |
| 0 | 237 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 238 | | uri.AppendPath(subscriptionId, true); |
| 0 | 239 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 240 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 241 | | uri.AppendPath("/providers/Microsoft.DigitalTwins/digitalTwinsInstances/", false); |
| 0 | 242 | | uri.AppendPath(resourceName, true); |
| 0 | 243 | | uri.AppendPath("/endpoints/", false); |
| 0 | 244 | | uri.AppendPath(endpointName, true); |
| 0 | 245 | | uri.AppendQuery("api-version", apiVersion, true); |
| 0 | 246 | | request.Uri = uri; |
| 0 | 247 | | request.Headers.Add("Content-Type", "application/json"); |
| 0 | 248 | | var model = new DigitalTwinsEndpointResource() |
| 0 | 249 | | { |
| 0 | 250 | | Properties = properties |
| 0 | 251 | | }; |
| 0 | 252 | | var content = new Utf8JsonRequestContent(); |
| 0 | 253 | | content.JsonWriter.WriteObjectValue(model); |
| 0 | 254 | | request.Content = content; |
| 0 | 255 | | return message; |
| | 256 | | } |
| | 257 | |
|
| | 258 | | /// <summary> Create or update DigitalTwinsInstance endpoint. </summary> |
| | 259 | | /// <param name="resourceGroupName"> The name of the resource group that contains the DigitalTwinsInstance. </pa |
| | 260 | | /// <param name="resourceName"> The name of the DigitalTwinsInstance. </param> |
| | 261 | | /// <param name="endpointName"> Name of Endpoint Resource. </param> |
| | 262 | | /// <param name="properties"> DigitalTwinsInstance endpoint resource properties. </param> |
| | 263 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 264 | | /// <exception cref="ArgumentNullException"> <paramref name="resourceGroupName"/>, <paramref name="resourceName" |
| | 265 | | public async Task<Response> CreateOrUpdateAsync(string resourceGroupName, string resourceName, string endpointNa |
| | 266 | | { |
| 0 | 267 | | if (resourceGroupName == null) |
| | 268 | | { |
| 0 | 269 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 270 | | } |
| 0 | 271 | | if (resourceName == null) |
| | 272 | | { |
| 0 | 273 | | throw new ArgumentNullException(nameof(resourceName)); |
| | 274 | | } |
| 0 | 275 | | if (endpointName == null) |
| | 276 | | { |
| 0 | 277 | | throw new ArgumentNullException(nameof(endpointName)); |
| | 278 | | } |
| | 279 | |
|
| 0 | 280 | | using var message = CreateCreateOrUpdateRequest(resourceGroupName, resourceName, endpointName, properties); |
| 0 | 281 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 282 | | switch (message.Response.Status) |
| | 283 | | { |
| | 284 | | case 200: |
| | 285 | | case 201: |
| 0 | 286 | | return message.Response; |
| | 287 | | default: |
| 0 | 288 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 289 | | } |
| 0 | 290 | | } |
| | 291 | |
|
| | 292 | | /// <summary> Create or update DigitalTwinsInstance endpoint. </summary> |
| | 293 | | /// <param name="resourceGroupName"> The name of the resource group that contains the DigitalTwinsInstance. </pa |
| | 294 | | /// <param name="resourceName"> The name of the DigitalTwinsInstance. </param> |
| | 295 | | /// <param name="endpointName"> Name of Endpoint Resource. </param> |
| | 296 | | /// <param name="properties"> DigitalTwinsInstance endpoint resource properties. </param> |
| | 297 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 298 | | /// <exception cref="ArgumentNullException"> <paramref name="resourceGroupName"/>, <paramref name="resourceName" |
| | 299 | | public Response CreateOrUpdate(string resourceGroupName, string resourceName, string endpointName, DigitalTwinsE |
| | 300 | | { |
| 0 | 301 | | if (resourceGroupName == null) |
| | 302 | | { |
| 0 | 303 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 304 | | } |
| 0 | 305 | | if (resourceName == null) |
| | 306 | | { |
| 0 | 307 | | throw new ArgumentNullException(nameof(resourceName)); |
| | 308 | | } |
| 0 | 309 | | if (endpointName == null) |
| | 310 | | { |
| 0 | 311 | | throw new ArgumentNullException(nameof(endpointName)); |
| | 312 | | } |
| | 313 | |
|
| 0 | 314 | | using var message = CreateCreateOrUpdateRequest(resourceGroupName, resourceName, endpointName, properties); |
| 0 | 315 | | _pipeline.Send(message, cancellationToken); |
| 0 | 316 | | switch (message.Response.Status) |
| | 317 | | { |
| | 318 | | case 200: |
| | 319 | | case 201: |
| 0 | 320 | | return message.Response; |
| | 321 | | default: |
| 0 | 322 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 323 | | } |
| 0 | 324 | | } |
| | 325 | |
|
| | 326 | | internal HttpMessage CreateDeleteRequest(string resourceGroupName, string resourceName, string endpointName) |
| | 327 | | { |
| 0 | 328 | | var message = _pipeline.CreateMessage(); |
| 0 | 329 | | var request = message.Request; |
| 0 | 330 | | request.Method = RequestMethod.Delete; |
| 0 | 331 | | var uri = new RawRequestUriBuilder(); |
| 0 | 332 | | uri.Reset(endpoint); |
| 0 | 333 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 334 | | uri.AppendPath(subscriptionId, true); |
| 0 | 335 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 336 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 337 | | uri.AppendPath("/providers/Microsoft.DigitalTwins/digitalTwinsInstances/", false); |
| 0 | 338 | | uri.AppendPath(resourceName, true); |
| 0 | 339 | | uri.AppendPath("/endpoints/", false); |
| 0 | 340 | | uri.AppendPath(endpointName, true); |
| 0 | 341 | | uri.AppendQuery("api-version", apiVersion, true); |
| 0 | 342 | | request.Uri = uri; |
| 0 | 343 | | return message; |
| | 344 | | } |
| | 345 | |
|
| | 346 | | /// <summary> Delete a DigitalTwinsInstance endpoint. </summary> |
| | 347 | | /// <param name="resourceGroupName"> The name of the resource group that contains the DigitalTwinsInstance. </pa |
| | 348 | | /// <param name="resourceName"> The name of the DigitalTwinsInstance. </param> |
| | 349 | | /// <param name="endpointName"> Name of Endpoint Resource. </param> |
| | 350 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 351 | | /// <exception cref="ArgumentNullException"> <paramref name="resourceGroupName"/>, <paramref name="resourceName" |
| | 352 | | public async Task<Response> DeleteAsync(string resourceGroupName, string resourceName, string endpointName, Canc |
| | 353 | | { |
| 0 | 354 | | if (resourceGroupName == null) |
| | 355 | | { |
| 0 | 356 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 357 | | } |
| 0 | 358 | | if (resourceName == null) |
| | 359 | | { |
| 0 | 360 | | throw new ArgumentNullException(nameof(resourceName)); |
| | 361 | | } |
| 0 | 362 | | if (endpointName == null) |
| | 363 | | { |
| 0 | 364 | | throw new ArgumentNullException(nameof(endpointName)); |
| | 365 | | } |
| | 366 | |
|
| 0 | 367 | | using var message = CreateDeleteRequest(resourceGroupName, resourceName, endpointName); |
| 0 | 368 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 369 | | switch (message.Response.Status) |
| | 370 | | { |
| | 371 | | case 200: |
| | 372 | | case 202: |
| | 373 | | case 204: |
| 0 | 374 | | return message.Response; |
| | 375 | | default: |
| 0 | 376 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 377 | | } |
| 0 | 378 | | } |
| | 379 | |
|
| | 380 | | /// <summary> Delete a DigitalTwinsInstance endpoint. </summary> |
| | 381 | | /// <param name="resourceGroupName"> The name of the resource group that contains the DigitalTwinsInstance. </pa |
| | 382 | | /// <param name="resourceName"> The name of the DigitalTwinsInstance. </param> |
| | 383 | | /// <param name="endpointName"> Name of Endpoint Resource. </param> |
| | 384 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 385 | | /// <exception cref="ArgumentNullException"> <paramref name="resourceGroupName"/>, <paramref name="resourceName" |
| | 386 | | public Response Delete(string resourceGroupName, string resourceName, string endpointName, CancellationToken can |
| | 387 | | { |
| 0 | 388 | | if (resourceGroupName == null) |
| | 389 | | { |
| 0 | 390 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 391 | | } |
| 0 | 392 | | if (resourceName == null) |
| | 393 | | { |
| 0 | 394 | | throw new ArgumentNullException(nameof(resourceName)); |
| | 395 | | } |
| 0 | 396 | | if (endpointName == null) |
| | 397 | | { |
| 0 | 398 | | throw new ArgumentNullException(nameof(endpointName)); |
| | 399 | | } |
| | 400 | |
|
| 0 | 401 | | using var message = CreateDeleteRequest(resourceGroupName, resourceName, endpointName); |
| 0 | 402 | | _pipeline.Send(message, cancellationToken); |
| 0 | 403 | | switch (message.Response.Status) |
| | 404 | | { |
| | 405 | | case 200: |
| | 406 | | case 202: |
| | 407 | | case 204: |
| 0 | 408 | | return message.Response; |
| | 409 | | default: |
| 0 | 410 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 411 | | } |
| 0 | 412 | | } |
| | 413 | |
|
| | 414 | | internal HttpMessage CreateListNextPageRequest(string nextLink, string resourceGroupName, string resourceName) |
| | 415 | | { |
| 0 | 416 | | var message = _pipeline.CreateMessage(); |
| 0 | 417 | | var request = message.Request; |
| 0 | 418 | | request.Method = RequestMethod.Get; |
| 0 | 419 | | var uri = new RawRequestUriBuilder(); |
| 0 | 420 | | uri.Reset(endpoint); |
| 0 | 421 | | uri.AppendRawNextLink(nextLink, false); |
| 0 | 422 | | request.Uri = uri; |
| 0 | 423 | | return message; |
| | 424 | | } |
| | 425 | |
|
| | 426 | | /// <summary> Get DigitalTwinsInstance Endpoints. </summary> |
| | 427 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 428 | | /// <param name="resourceGroupName"> The name of the resource group that contains the DigitalTwinsInstance. </pa |
| | 429 | | /// <param name="resourceName"> The name of the DigitalTwinsInstance. </param> |
| | 430 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 431 | | /// <exception cref="ArgumentNullException"> <paramref name="nextLink"/>, <paramref name="resourceGroupName"/>, |
| | 432 | | public async Task<Response<DigitalTwinsEndpointResourceListResult>> ListNextPageAsync(string nextLink, string re |
| | 433 | | { |
| 0 | 434 | | if (nextLink == null) |
| | 435 | | { |
| 0 | 436 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 437 | | } |
| 0 | 438 | | if (resourceGroupName == null) |
| | 439 | | { |
| 0 | 440 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 441 | | } |
| 0 | 442 | | if (resourceName == null) |
| | 443 | | { |
| 0 | 444 | | throw new ArgumentNullException(nameof(resourceName)); |
| | 445 | | } |
| | 446 | |
|
| 0 | 447 | | using var message = CreateListNextPageRequest(nextLink, resourceGroupName, resourceName); |
| 0 | 448 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 449 | | switch (message.Response.Status) |
| | 450 | | { |
| | 451 | | case 200: |
| | 452 | | { |
| | 453 | | DigitalTwinsEndpointResourceListResult value = default; |
| 0 | 454 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 455 | | value = DigitalTwinsEndpointResourceListResult.DeserializeDigitalTwinsEndpointResourceListResult |
| 0 | 456 | | return Response.FromValue(value, message.Response); |
| | 457 | | } |
| | 458 | | default: |
| 0 | 459 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 460 | | } |
| 0 | 461 | | } |
| | 462 | |
|
| | 463 | | /// <summary> Get DigitalTwinsInstance Endpoints. </summary> |
| | 464 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 465 | | /// <param name="resourceGroupName"> The name of the resource group that contains the DigitalTwinsInstance. </pa |
| | 466 | | /// <param name="resourceName"> The name of the DigitalTwinsInstance. </param> |
| | 467 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 468 | | /// <exception cref="ArgumentNullException"> <paramref name="nextLink"/>, <paramref name="resourceGroupName"/>, |
| | 469 | | public Response<DigitalTwinsEndpointResourceListResult> ListNextPage(string nextLink, string resourceGroupName, |
| | 470 | | { |
| 0 | 471 | | if (nextLink == null) |
| | 472 | | { |
| 0 | 473 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 474 | | } |
| 0 | 475 | | if (resourceGroupName == null) |
| | 476 | | { |
| 0 | 477 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 478 | | } |
| 0 | 479 | | if (resourceName == null) |
| | 480 | | { |
| 0 | 481 | | throw new ArgumentNullException(nameof(resourceName)); |
| | 482 | | } |
| | 483 | |
|
| 0 | 484 | | using var message = CreateListNextPageRequest(nextLink, resourceGroupName, resourceName); |
| 0 | 485 | | _pipeline.Send(message, cancellationToken); |
| 0 | 486 | | switch (message.Response.Status) |
| | 487 | | { |
| | 488 | | case 200: |
| | 489 | | { |
| | 490 | | DigitalTwinsEndpointResourceListResult value = default; |
| 0 | 491 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 492 | | value = DigitalTwinsEndpointResourceListResult.DeserializeDigitalTwinsEndpointResourceListResult |
| 0 | 493 | | return Response.FromValue(value, message.Response); |
| | 494 | | } |
| | 495 | | default: |
| 0 | 496 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 497 | | } |
| 0 | 498 | | } |
| | 499 | | } |
| | 500 | | } |