| | 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.Compute.Models; |
| | 15 | |
|
| | 16 | | namespace Azure.ResourceManager.Compute |
| | 17 | | { |
| | 18 | | /// <summary> The ContainerServices service client. </summary> |
| | 19 | | public partial class ContainerServicesOperations |
| | 20 | | { |
| | 21 | | private readonly ClientDiagnostics _clientDiagnostics; |
| | 22 | | private readonly HttpPipeline _pipeline; |
| 0 | 23 | | internal ContainerServicesRestOperations RestClient { get; } |
| | 24 | | /// <summary> Initializes a new instance of ContainerServicesOperations for mocking. </summary> |
| 396 | 25 | | protected ContainerServicesOperations() |
| | 26 | | { |
| 396 | 27 | | } |
| | 28 | | /// <summary> Initializes a new instance of ContainerServicesOperations. </summary> |
| | 29 | | /// <param name="clientDiagnostics"> The handler for diagnostic messaging in the client. </param> |
| | 30 | | /// <param name="pipeline"> The HTTP pipeline for sending and receiving REST requests and responses. </param> |
| | 31 | | /// <param name="subscriptionId"> Subscription credentials which uniquely identify Microsoft Azure subscription. |
| | 32 | | /// <param name="endpoint"> server parameter. </param> |
| 396 | 33 | | internal ContainerServicesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscrip |
| | 34 | | { |
| 396 | 35 | | RestClient = new ContainerServicesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); |
| 396 | 36 | | _clientDiagnostics = clientDiagnostics; |
| 396 | 37 | | _pipeline = pipeline; |
| 396 | 38 | | } |
| | 39 | |
|
| | 40 | | /// <summary> Gets the properties of the specified container service in the specified subscription and resource |
| | 41 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 42 | | /// <param name="containerServiceName"> The name of the container service in the specified subscription and reso |
| | 43 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 44 | | public virtual async Task<Response<ContainerService>> GetAsync(string resourceGroupName, string containerService |
| | 45 | | { |
| 0 | 46 | | using var scope = _clientDiagnostics.CreateScope("ContainerServicesOperations.Get"); |
| 0 | 47 | | scope.Start(); |
| | 48 | | try |
| | 49 | | { |
| 0 | 50 | | return await RestClient.GetAsync(resourceGroupName, containerServiceName, cancellationToken).ConfigureAw |
| | 51 | | } |
| 0 | 52 | | catch (Exception e) |
| | 53 | | { |
| 0 | 54 | | scope.Failed(e); |
| 0 | 55 | | throw; |
| | 56 | | } |
| 0 | 57 | | } |
| | 58 | |
|
| | 59 | | /// <summary> Gets the properties of the specified container service in the specified subscription and resource |
| | 60 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 61 | | /// <param name="containerServiceName"> The name of the container service in the specified subscription and reso |
| | 62 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 63 | | public virtual Response<ContainerService> Get(string resourceGroupName, string containerServiceName, Cancellatio |
| | 64 | | { |
| 0 | 65 | | using var scope = _clientDiagnostics.CreateScope("ContainerServicesOperations.Get"); |
| 0 | 66 | | scope.Start(); |
| | 67 | | try |
| | 68 | | { |
| 0 | 69 | | return RestClient.Get(resourceGroupName, containerServiceName, cancellationToken); |
| | 70 | | } |
| 0 | 71 | | catch (Exception e) |
| | 72 | | { |
| 0 | 73 | | scope.Failed(e); |
| 0 | 74 | | throw; |
| | 75 | | } |
| 0 | 76 | | } |
| | 77 | |
|
| | 78 | | /// <summary> Gets a list of container services in the specified subscription. The operation returns properties |
| | 79 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 80 | | public virtual AsyncPageable<ContainerService> ListAsync(CancellationToken cancellationToken = default) |
| | 81 | | { |
| | 82 | | async Task<Page<ContainerService>> FirstPageFunc(int? pageSizeHint) |
| | 83 | | { |
| 0 | 84 | | using var scope = _clientDiagnostics.CreateScope("ContainerServicesOperations.List"); |
| 0 | 85 | | scope.Start(); |
| | 86 | | try |
| | 87 | | { |
| 0 | 88 | | var response = await RestClient.ListAsync(cancellationToken).ConfigureAwait(false); |
| 0 | 89 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 90 | | } |
| 0 | 91 | | catch (Exception e) |
| | 92 | | { |
| 0 | 93 | | scope.Failed(e); |
| 0 | 94 | | throw; |
| | 95 | | } |
| 0 | 96 | | } |
| | 97 | | async Task<Page<ContainerService>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 98 | | { |
| 0 | 99 | | using var scope = _clientDiagnostics.CreateScope("ContainerServicesOperations.List"); |
| 0 | 100 | | scope.Start(); |
| | 101 | | try |
| | 102 | | { |
| 0 | 103 | | var response = await RestClient.ListNextPageAsync(nextLink, cancellationToken).ConfigureAwait(false) |
| 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 | | } |
| 0 | 112 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); |
| | 113 | | } |
| | 114 | |
|
| | 115 | | /// <summary> Gets a list of container services in the specified subscription. The operation returns properties |
| | 116 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 117 | | public virtual Pageable<ContainerService> List(CancellationToken cancellationToken = default) |
| | 118 | | { |
| | 119 | | Page<ContainerService> FirstPageFunc(int? pageSizeHint) |
| | 120 | | { |
| 0 | 121 | | using var scope = _clientDiagnostics.CreateScope("ContainerServicesOperations.List"); |
| 0 | 122 | | scope.Start(); |
| | 123 | | try |
| | 124 | | { |
| 0 | 125 | | var response = RestClient.List(cancellationToken); |
| 0 | 126 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 127 | | } |
| 0 | 128 | | catch (Exception e) |
| | 129 | | { |
| 0 | 130 | | scope.Failed(e); |
| 0 | 131 | | throw; |
| | 132 | | } |
| 0 | 133 | | } |
| | 134 | | Page<ContainerService> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 135 | | { |
| 0 | 136 | | using var scope = _clientDiagnostics.CreateScope("ContainerServicesOperations.List"); |
| 0 | 137 | | scope.Start(); |
| | 138 | | try |
| | 139 | | { |
| 0 | 140 | | var response = RestClient.ListNextPage(nextLink, cancellationToken); |
| 0 | 141 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 142 | | } |
| 0 | 143 | | catch (Exception e) |
| | 144 | | { |
| 0 | 145 | | scope.Failed(e); |
| 0 | 146 | | throw; |
| | 147 | | } |
| 0 | 148 | | } |
| 0 | 149 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); |
| | 150 | | } |
| | 151 | |
|
| | 152 | | /// <summary> Gets a list of container services in the specified subscription and resource group. The operation |
| | 153 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 154 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 155 | | public virtual AsyncPageable<ContainerService> ListByResourceGroupAsync(string resourceGroupName, CancellationTo |
| | 156 | | { |
| 0 | 157 | | if (resourceGroupName == null) |
| | 158 | | { |
| 0 | 159 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 160 | | } |
| | 161 | |
|
| | 162 | | async Task<Page<ContainerService>> FirstPageFunc(int? pageSizeHint) |
| | 163 | | { |
| 0 | 164 | | using var scope = _clientDiagnostics.CreateScope("ContainerServicesOperations.ListByResourceGroup"); |
| 0 | 165 | | scope.Start(); |
| | 166 | | try |
| | 167 | | { |
| 0 | 168 | | var response = await RestClient.ListByResourceGroupAsync(resourceGroupName, cancellationToken).Confi |
| 0 | 169 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 170 | | } |
| 0 | 171 | | catch (Exception e) |
| | 172 | | { |
| 0 | 173 | | scope.Failed(e); |
| 0 | 174 | | throw; |
| | 175 | | } |
| 0 | 176 | | } |
| | 177 | | async Task<Page<ContainerService>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 178 | | { |
| 0 | 179 | | using var scope = _clientDiagnostics.CreateScope("ContainerServicesOperations.ListByResourceGroup"); |
| 0 | 180 | | scope.Start(); |
| | 181 | | try |
| | 182 | | { |
| 0 | 183 | | var response = await RestClient.ListByResourceGroupNextPageAsync(nextLink, resourceGroupName, cancel |
| 0 | 184 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 185 | | } |
| 0 | 186 | | catch (Exception e) |
| | 187 | | { |
| 0 | 188 | | scope.Failed(e); |
| 0 | 189 | | throw; |
| | 190 | | } |
| 0 | 191 | | } |
| 0 | 192 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); |
| | 193 | | } |
| | 194 | |
|
| | 195 | | /// <summary> Gets a list of container services in the specified subscription and resource group. The operation |
| | 196 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 197 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 198 | | public virtual Pageable<ContainerService> ListByResourceGroup(string resourceGroupName, CancellationToken cancel |
| | 199 | | { |
| 0 | 200 | | if (resourceGroupName == null) |
| | 201 | | { |
| 0 | 202 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 203 | | } |
| | 204 | |
|
| | 205 | | Page<ContainerService> FirstPageFunc(int? pageSizeHint) |
| | 206 | | { |
| 0 | 207 | | using var scope = _clientDiagnostics.CreateScope("ContainerServicesOperations.ListByResourceGroup"); |
| 0 | 208 | | scope.Start(); |
| | 209 | | try |
| | 210 | | { |
| 0 | 211 | | var response = RestClient.ListByResourceGroup(resourceGroupName, cancellationToken); |
| 0 | 212 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 213 | | } |
| 0 | 214 | | catch (Exception e) |
| | 215 | | { |
| 0 | 216 | | scope.Failed(e); |
| 0 | 217 | | throw; |
| | 218 | | } |
| 0 | 219 | | } |
| | 220 | | Page<ContainerService> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 221 | | { |
| 0 | 222 | | using var scope = _clientDiagnostics.CreateScope("ContainerServicesOperations.ListByResourceGroup"); |
| 0 | 223 | | scope.Start(); |
| | 224 | | try |
| | 225 | | { |
| 0 | 226 | | var response = RestClient.ListByResourceGroupNextPage(nextLink, resourceGroupName, cancellationToken |
| 0 | 227 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 228 | | } |
| 0 | 229 | | catch (Exception e) |
| | 230 | | { |
| 0 | 231 | | scope.Failed(e); |
| 0 | 232 | | throw; |
| | 233 | | } |
| 0 | 234 | | } |
| 0 | 235 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); |
| | 236 | | } |
| | 237 | |
|
| | 238 | | /// <summary> Creates or updates a container service with the specified configuration of orchestrator, masters, |
| | 239 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 240 | | /// <param name="containerServiceName"> The name of the container service in the specified subscription and reso |
| | 241 | | /// <param name="parameters"> Parameters supplied to the Create or Update a Container Service operation. </param |
| | 242 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 243 | | public virtual async Task<ContainerServicesCreateOrUpdateOperation> StartCreateOrUpdateAsync(string resourceGrou |
| | 244 | | { |
| 0 | 245 | | if (resourceGroupName == null) |
| | 246 | | { |
| 0 | 247 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 248 | | } |
| 0 | 249 | | if (containerServiceName == null) |
| | 250 | | { |
| 0 | 251 | | throw new ArgumentNullException(nameof(containerServiceName)); |
| | 252 | | } |
| 0 | 253 | | if (parameters == null) |
| | 254 | | { |
| 0 | 255 | | throw new ArgumentNullException(nameof(parameters)); |
| | 256 | | } |
| | 257 | |
|
| 0 | 258 | | using var scope = _clientDiagnostics.CreateScope("ContainerServicesOperations.StartCreateOrUpdate"); |
| 0 | 259 | | scope.Start(); |
| | 260 | | try |
| | 261 | | { |
| 0 | 262 | | var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, containerServiceName, par |
| 0 | 263 | | return new ContainerServicesCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCrea |
| | 264 | | } |
| 0 | 265 | | catch (Exception e) |
| | 266 | | { |
| 0 | 267 | | scope.Failed(e); |
| 0 | 268 | | throw; |
| | 269 | | } |
| 0 | 270 | | } |
| | 271 | |
|
| | 272 | | /// <summary> Creates or updates a container service with the specified configuration of orchestrator, masters, |
| | 273 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 274 | | /// <param name="containerServiceName"> The name of the container service in the specified subscription and reso |
| | 275 | | /// <param name="parameters"> Parameters supplied to the Create or Update a Container Service operation. </param |
| | 276 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 277 | | public virtual ContainerServicesCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string con |
| | 278 | | { |
| 0 | 279 | | if (resourceGroupName == null) |
| | 280 | | { |
| 0 | 281 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 282 | | } |
| 0 | 283 | | if (containerServiceName == null) |
| | 284 | | { |
| 0 | 285 | | throw new ArgumentNullException(nameof(containerServiceName)); |
| | 286 | | } |
| 0 | 287 | | if (parameters == null) |
| | 288 | | { |
| 0 | 289 | | throw new ArgumentNullException(nameof(parameters)); |
| | 290 | | } |
| | 291 | |
|
| 0 | 292 | | using var scope = _clientDiagnostics.CreateScope("ContainerServicesOperations.StartCreateOrUpdate"); |
| 0 | 293 | | scope.Start(); |
| | 294 | | try |
| | 295 | | { |
| 0 | 296 | | var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, containerServiceName, parameters, ca |
| 0 | 297 | | return new ContainerServicesCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCrea |
| | 298 | | } |
| 0 | 299 | | catch (Exception e) |
| | 300 | | { |
| 0 | 301 | | scope.Failed(e); |
| 0 | 302 | | throw; |
| | 303 | | } |
| 0 | 304 | | } |
| | 305 | |
|
| | 306 | | /// <summary> Deletes the specified container service in the specified subscription and resource group. The oper |
| | 307 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 308 | | /// <param name="containerServiceName"> The name of the container service in the specified subscription and reso |
| | 309 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 310 | | public virtual async Task<ContainerServicesDeleteOperation> StartDeleteAsync(string resourceGroupName, string co |
| | 311 | | { |
| 0 | 312 | | if (resourceGroupName == null) |
| | 313 | | { |
| 0 | 314 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 315 | | } |
| 0 | 316 | | if (containerServiceName == null) |
| | 317 | | { |
| 0 | 318 | | throw new ArgumentNullException(nameof(containerServiceName)); |
| | 319 | | } |
| | 320 | |
|
| 0 | 321 | | using var scope = _clientDiagnostics.CreateScope("ContainerServicesOperations.StartDelete"); |
| 0 | 322 | | scope.Start(); |
| | 323 | | try |
| | 324 | | { |
| 0 | 325 | | var originalResponse = await RestClient.DeleteAsync(resourceGroupName, containerServiceName, cancellatio |
| 0 | 326 | | return new ContainerServicesDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteReques |
| | 327 | | } |
| 0 | 328 | | catch (Exception e) |
| | 329 | | { |
| 0 | 330 | | scope.Failed(e); |
| 0 | 331 | | throw; |
| | 332 | | } |
| 0 | 333 | | } |
| | 334 | |
|
| | 335 | | /// <summary> Deletes the specified container service in the specified subscription and resource group. The oper |
| | 336 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 337 | | /// <param name="containerServiceName"> The name of the container service in the specified subscription and reso |
| | 338 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 339 | | public virtual ContainerServicesDeleteOperation StartDelete(string resourceGroupName, string containerServiceNam |
| | 340 | | { |
| 0 | 341 | | if (resourceGroupName == null) |
| | 342 | | { |
| 0 | 343 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 344 | | } |
| 0 | 345 | | if (containerServiceName == null) |
| | 346 | | { |
| 0 | 347 | | throw new ArgumentNullException(nameof(containerServiceName)); |
| | 348 | | } |
| | 349 | |
|
| 0 | 350 | | using var scope = _clientDiagnostics.CreateScope("ContainerServicesOperations.StartDelete"); |
| 0 | 351 | | scope.Start(); |
| | 352 | | try |
| | 353 | | { |
| 0 | 354 | | var originalResponse = RestClient.Delete(resourceGroupName, containerServiceName, cancellationToken); |
| 0 | 355 | | return new ContainerServicesDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteReques |
| | 356 | | } |
| 0 | 357 | | catch (Exception e) |
| | 358 | | { |
| 0 | 359 | | scope.Failed(e); |
| 0 | 360 | | throw; |
| | 361 | | } |
| 0 | 362 | | } |
| | 363 | | } |
| | 364 | | } |