| | 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.DigitalTwins.Models; |
| | 15 | |
|
| | 16 | | namespace Azure.ResourceManager.DigitalTwins |
| | 17 | | { |
| | 18 | | /// <summary> The DigitalTwinsEndpoint service client. </summary> |
| | 19 | | public partial class DigitalTwinsEndpointOperations |
| | 20 | | { |
| | 21 | | private readonly ClientDiagnostics _clientDiagnostics; |
| | 22 | | private readonly HttpPipeline _pipeline; |
| 0 | 23 | | internal DigitalTwinsEndpointRestOperations RestClient { get; } |
| | 24 | | /// <summary> Initializes a new instance of DigitalTwinsEndpointOperations for mocking. </summary> |
| 0 | 25 | | protected DigitalTwinsEndpointOperations() |
| | 26 | | { |
| 0 | 27 | | } |
| | 28 | | /// <summary> Initializes a new instance of DigitalTwinsEndpointOperations. </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 identifier. </param> |
| | 32 | | /// <param name="endpoint"> server parameter. </param> |
| | 33 | | /// <param name="apiVersion"> Api Version. </param> |
| 0 | 34 | | internal DigitalTwinsEndpointOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subsc |
| | 35 | | { |
| 0 | 36 | | RestClient = new DigitalTwinsEndpointRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint, a |
| 0 | 37 | | _clientDiagnostics = clientDiagnostics; |
| 0 | 38 | | _pipeline = pipeline; |
| 0 | 39 | | } |
| | 40 | |
|
| | 41 | | /// <summary> Get DigitalTwinsInstances Endpoint. </summary> |
| | 42 | | /// <param name="resourceGroupName"> The name of the resource group that contains the DigitalTwinsInstance. </pa |
| | 43 | | /// <param name="resourceName"> The name of the DigitalTwinsInstance. </param> |
| | 44 | | /// <param name="endpointName"> Name of Endpoint Resource. </param> |
| | 45 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 46 | | public virtual async Task<Response<DigitalTwinsEndpointResource>> GetAsync(string resourceGroupName, string reso |
| | 47 | | { |
| 0 | 48 | | using var scope = _clientDiagnostics.CreateScope("DigitalTwinsEndpointOperations.Get"); |
| 0 | 49 | | scope.Start(); |
| | 50 | | try |
| | 51 | | { |
| 0 | 52 | | return await RestClient.GetAsync(resourceGroupName, resourceName, endpointName, cancellationToken).Confi |
| | 53 | | } |
| 0 | 54 | | catch (Exception e) |
| | 55 | | { |
| 0 | 56 | | scope.Failed(e); |
| 0 | 57 | | throw; |
| | 58 | | } |
| 0 | 59 | | } |
| | 60 | |
|
| | 61 | | /// <summary> Get DigitalTwinsInstances Endpoint. </summary> |
| | 62 | | /// <param name="resourceGroupName"> The name of the resource group that contains the DigitalTwinsInstance. </pa |
| | 63 | | /// <param name="resourceName"> The name of the DigitalTwinsInstance. </param> |
| | 64 | | /// <param name="endpointName"> Name of Endpoint Resource. </param> |
| | 65 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 66 | | public virtual Response<DigitalTwinsEndpointResource> Get(string resourceGroupName, string resourceName, string |
| | 67 | | { |
| 0 | 68 | | using var scope = _clientDiagnostics.CreateScope("DigitalTwinsEndpointOperations.Get"); |
| 0 | 69 | | scope.Start(); |
| | 70 | | try |
| | 71 | | { |
| 0 | 72 | | return RestClient.Get(resourceGroupName, resourceName, endpointName, cancellationToken); |
| | 73 | | } |
| 0 | 74 | | catch (Exception e) |
| | 75 | | { |
| 0 | 76 | | scope.Failed(e); |
| 0 | 77 | | throw; |
| | 78 | | } |
| 0 | 79 | | } |
| | 80 | |
|
| | 81 | | /// <summary> Get DigitalTwinsInstance Endpoints. </summary> |
| | 82 | | /// <param name="resourceGroupName"> The name of the resource group that contains the DigitalTwinsInstance. </pa |
| | 83 | | /// <param name="resourceName"> The name of the DigitalTwinsInstance. </param> |
| | 84 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 85 | | /// <exception cref="ArgumentNullException"> <paramref name="resourceGroupName"/> or <paramref name="resourceNam |
| | 86 | | public virtual AsyncPageable<DigitalTwinsEndpointResource> ListAsync(string resourceGroupName, string resourceNa |
| | 87 | | { |
| 0 | 88 | | if (resourceGroupName == null) |
| | 89 | | { |
| 0 | 90 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 91 | | } |
| 0 | 92 | | if (resourceName == null) |
| | 93 | | { |
| 0 | 94 | | throw new ArgumentNullException(nameof(resourceName)); |
| | 95 | | } |
| | 96 | |
|
| | 97 | | async Task<Page<DigitalTwinsEndpointResource>> FirstPageFunc(int? pageSizeHint) |
| | 98 | | { |
| 0 | 99 | | using var scope = _clientDiagnostics.CreateScope("DigitalTwinsEndpointOperations.List"); |
| 0 | 100 | | scope.Start(); |
| | 101 | | try |
| | 102 | | { |
| 0 | 103 | | var response = await RestClient.ListAsync(resourceGroupName, resourceName, cancellationToken).Config |
| 0 | 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 | | } |
| 0 | 111 | | } |
| | 112 | | async Task<Page<DigitalTwinsEndpointResource>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 113 | | { |
| 0 | 114 | | using var scope = _clientDiagnostics.CreateScope("DigitalTwinsEndpointOperations.List"); |
| 0 | 115 | | scope.Start(); |
| | 116 | | try |
| | 117 | | { |
| 0 | 118 | | var response = await RestClient.ListNextPageAsync(nextLink, resourceGroupName, resourceName, cancell |
| 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 | | } |
| 0 | 127 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); |
| | 128 | | } |
| | 129 | |
|
| | 130 | | /// <summary> Get DigitalTwinsInstance Endpoints. </summary> |
| | 131 | | /// <param name="resourceGroupName"> The name of the resource group that contains the DigitalTwinsInstance. </pa |
| | 132 | | /// <param name="resourceName"> The name of the DigitalTwinsInstance. </param> |
| | 133 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 134 | | /// <exception cref="ArgumentNullException"> <paramref name="resourceGroupName"/> or <paramref name="resourceNam |
| | 135 | | public virtual Pageable<DigitalTwinsEndpointResource> List(string resourceGroupName, string resourceName, Cancel |
| | 136 | | { |
| 0 | 137 | | if (resourceGroupName == null) |
| | 138 | | { |
| 0 | 139 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 140 | | } |
| 0 | 141 | | if (resourceName == null) |
| | 142 | | { |
| 0 | 143 | | throw new ArgumentNullException(nameof(resourceName)); |
| | 144 | | } |
| | 145 | |
|
| | 146 | | Page<DigitalTwinsEndpointResource> FirstPageFunc(int? pageSizeHint) |
| | 147 | | { |
| 0 | 148 | | using var scope = _clientDiagnostics.CreateScope("DigitalTwinsEndpointOperations.List"); |
| 0 | 149 | | scope.Start(); |
| | 150 | | try |
| | 151 | | { |
| 0 | 152 | | var response = RestClient.List(resourceGroupName, resourceName, cancellationToken); |
| 0 | 153 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 154 | | } |
| 0 | 155 | | catch (Exception e) |
| | 156 | | { |
| 0 | 157 | | scope.Failed(e); |
| 0 | 158 | | throw; |
| | 159 | | } |
| 0 | 160 | | } |
| | 161 | | Page<DigitalTwinsEndpointResource> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 162 | | { |
| 0 | 163 | | using var scope = _clientDiagnostics.CreateScope("DigitalTwinsEndpointOperations.List"); |
| 0 | 164 | | scope.Start(); |
| | 165 | | try |
| | 166 | | { |
| 0 | 167 | | var response = RestClient.ListNextPage(nextLink, resourceGroupName, resourceName, cancellationToken) |
| 0 | 168 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 169 | | } |
| 0 | 170 | | catch (Exception e) |
| | 171 | | { |
| 0 | 172 | | scope.Failed(e); |
| 0 | 173 | | throw; |
| | 174 | | } |
| 0 | 175 | | } |
| 0 | 176 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); |
| | 177 | | } |
| | 178 | |
|
| | 179 | | /// <summary> Create or update DigitalTwinsInstance endpoint. </summary> |
| | 180 | | /// <param name="resourceGroupName"> The name of the resource group that contains the DigitalTwinsInstance. </pa |
| | 181 | | /// <param name="resourceName"> The name of the DigitalTwinsInstance. </param> |
| | 182 | | /// <param name="endpointName"> Name of Endpoint Resource. </param> |
| | 183 | | /// <param name="properties"> DigitalTwinsInstance endpoint resource properties. </param> |
| | 184 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 185 | | /// <exception cref="ArgumentNullException"> <paramref name="resourceGroupName"/>, <paramref name="resourceName" |
| | 186 | | public virtual async Task<DigitalTwinsEndpointCreateOrUpdateOperation> StartCreateOrUpdateAsync(string resourceG |
| | 187 | | { |
| 0 | 188 | | if (resourceGroupName == null) |
| | 189 | | { |
| 0 | 190 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 191 | | } |
| 0 | 192 | | if (resourceName == null) |
| | 193 | | { |
| 0 | 194 | | throw new ArgumentNullException(nameof(resourceName)); |
| | 195 | | } |
| 0 | 196 | | if (endpointName == null) |
| | 197 | | { |
| 0 | 198 | | throw new ArgumentNullException(nameof(endpointName)); |
| | 199 | | } |
| | 200 | |
|
| 0 | 201 | | using var scope = _clientDiagnostics.CreateScope("DigitalTwinsEndpointOperations.StartCreateOrUpdate"); |
| 0 | 202 | | scope.Start(); |
| | 203 | | try |
| | 204 | | { |
| 0 | 205 | | var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, resourceName, endpointNam |
| 0 | 206 | | return new DigitalTwinsEndpointCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateC |
| | 207 | | } |
| 0 | 208 | | catch (Exception e) |
| | 209 | | { |
| 0 | 210 | | scope.Failed(e); |
| 0 | 211 | | throw; |
| | 212 | | } |
| 0 | 213 | | } |
| | 214 | |
|
| | 215 | | /// <summary> Create or update DigitalTwinsInstance endpoint. </summary> |
| | 216 | | /// <param name="resourceGroupName"> The name of the resource group that contains the DigitalTwinsInstance. </pa |
| | 217 | | /// <param name="resourceName"> The name of the DigitalTwinsInstance. </param> |
| | 218 | | /// <param name="endpointName"> Name of Endpoint Resource. </param> |
| | 219 | | /// <param name="properties"> DigitalTwinsInstance endpoint resource properties. </param> |
| | 220 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 221 | | /// <exception cref="ArgumentNullException"> <paramref name="resourceGroupName"/>, <paramref name="resourceName" |
| | 222 | | public virtual DigitalTwinsEndpointCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string |
| | 223 | | { |
| 0 | 224 | | if (resourceGroupName == null) |
| | 225 | | { |
| 0 | 226 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 227 | | } |
| 0 | 228 | | if (resourceName == null) |
| | 229 | | { |
| 0 | 230 | | throw new ArgumentNullException(nameof(resourceName)); |
| | 231 | | } |
| 0 | 232 | | if (endpointName == null) |
| | 233 | | { |
| 0 | 234 | | throw new ArgumentNullException(nameof(endpointName)); |
| | 235 | | } |
| | 236 | |
|
| 0 | 237 | | using var scope = _clientDiagnostics.CreateScope("DigitalTwinsEndpointOperations.StartCreateOrUpdate"); |
| 0 | 238 | | scope.Start(); |
| | 239 | | try |
| | 240 | | { |
| 0 | 241 | | var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, resourceName, endpointName, properti |
| 0 | 242 | | return new DigitalTwinsEndpointCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateC |
| | 243 | | } |
| 0 | 244 | | catch (Exception e) |
| | 245 | | { |
| 0 | 246 | | scope.Failed(e); |
| 0 | 247 | | throw; |
| | 248 | | } |
| 0 | 249 | | } |
| | 250 | |
|
| | 251 | | /// <summary> Delete a DigitalTwinsInstance endpoint. </summary> |
| | 252 | | /// <param name="resourceGroupName"> The name of the resource group that contains the DigitalTwinsInstance. </pa |
| | 253 | | /// <param name="resourceName"> The name of the DigitalTwinsInstance. </param> |
| | 254 | | /// <param name="endpointName"> Name of Endpoint Resource. </param> |
| | 255 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 256 | | /// <exception cref="ArgumentNullException"> <paramref name="resourceGroupName"/>, <paramref name="resourceName" |
| | 257 | | public virtual async Task<DigitalTwinsEndpointDeleteOperation> StartDeleteAsync(string resourceGroupName, string |
| | 258 | | { |
| 0 | 259 | | if (resourceGroupName == null) |
| | 260 | | { |
| 0 | 261 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 262 | | } |
| 0 | 263 | | if (resourceName == null) |
| | 264 | | { |
| 0 | 265 | | throw new ArgumentNullException(nameof(resourceName)); |
| | 266 | | } |
| 0 | 267 | | if (endpointName == null) |
| | 268 | | { |
| 0 | 269 | | throw new ArgumentNullException(nameof(endpointName)); |
| | 270 | | } |
| | 271 | |
|
| 0 | 272 | | using var scope = _clientDiagnostics.CreateScope("DigitalTwinsEndpointOperations.StartDelete"); |
| 0 | 273 | | scope.Start(); |
| | 274 | | try |
| | 275 | | { |
| 0 | 276 | | var originalResponse = await RestClient.DeleteAsync(resourceGroupName, resourceName, endpointName, cance |
| 0 | 277 | | return new DigitalTwinsEndpointDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteReq |
| | 278 | | } |
| 0 | 279 | | catch (Exception e) |
| | 280 | | { |
| 0 | 281 | | scope.Failed(e); |
| 0 | 282 | | throw; |
| | 283 | | } |
| 0 | 284 | | } |
| | 285 | |
|
| | 286 | | /// <summary> Delete a DigitalTwinsInstance endpoint. </summary> |
| | 287 | | /// <param name="resourceGroupName"> The name of the resource group that contains the DigitalTwinsInstance. </pa |
| | 288 | | /// <param name="resourceName"> The name of the DigitalTwinsInstance. </param> |
| | 289 | | /// <param name="endpointName"> Name of Endpoint Resource. </param> |
| | 290 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 291 | | /// <exception cref="ArgumentNullException"> <paramref name="resourceGroupName"/>, <paramref name="resourceName" |
| | 292 | | public virtual DigitalTwinsEndpointDeleteOperation StartDelete(string resourceGroupName, string resourceName, st |
| | 293 | | { |
| 0 | 294 | | if (resourceGroupName == null) |
| | 295 | | { |
| 0 | 296 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 297 | | } |
| 0 | 298 | | if (resourceName == null) |
| | 299 | | { |
| 0 | 300 | | throw new ArgumentNullException(nameof(resourceName)); |
| | 301 | | } |
| 0 | 302 | | if (endpointName == null) |
| | 303 | | { |
| 0 | 304 | | throw new ArgumentNullException(nameof(endpointName)); |
| | 305 | | } |
| | 306 | |
|
| 0 | 307 | | using var scope = _clientDiagnostics.CreateScope("DigitalTwinsEndpointOperations.StartDelete"); |
| 0 | 308 | | scope.Start(); |
| | 309 | | try |
| | 310 | | { |
| 0 | 311 | | var originalResponse = RestClient.Delete(resourceGroupName, resourceName, endpointName, cancellationToke |
| 0 | 312 | | return new DigitalTwinsEndpointDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteReq |
| | 313 | | } |
| 0 | 314 | | catch (Exception e) |
| | 315 | | { |
| 0 | 316 | | scope.Failed(e); |
| 0 | 317 | | throw; |
| | 318 | | } |
| 0 | 319 | | } |
| | 320 | | } |
| | 321 | | } |