| | 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.AppConfiguration.Models; |
| | 16 | |
|
| | 17 | | namespace Azure.ResourceManager.AppConfiguration |
| | 18 | | { |
| | 19 | | internal partial class ConfigurationStoresRestOperations |
| | 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 ConfigurationStoresRestOperations. </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 Microsoft Azure subscription ID. </param> |
| | 31 | | /// <param name="endpoint"> server parameter. </param> |
| | 32 | | /// <param name="apiVersion"> Api Version. </param> |
| | 33 | | /// <exception cref="ArgumentNullException"> This occurs when one of the required arguments is null. </exception |
| 8 | 34 | | public ConfigurationStoresRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subs |
| | 35 | | { |
| 8 | 36 | | if (subscriptionId == null) |
| | 37 | | { |
| 0 | 38 | | throw new ArgumentNullException(nameof(subscriptionId)); |
| | 39 | | } |
| 8 | 40 | | endpoint ??= new Uri("https://management.azure.com"); |
| 8 | 41 | | if (apiVersion == null) |
| | 42 | | { |
| 0 | 43 | | throw new ArgumentNullException(nameof(apiVersion)); |
| | 44 | | } |
| | 45 | |
|
| 8 | 46 | | this.subscriptionId = subscriptionId; |
| 8 | 47 | | this.endpoint = endpoint; |
| 8 | 48 | | this.apiVersion = apiVersion; |
| 8 | 49 | | _clientDiagnostics = clientDiagnostics; |
| 8 | 50 | | _pipeline = pipeline; |
| 8 | 51 | | } |
| | 52 | |
|
| | 53 | | internal HttpMessage CreateListRequest(string skipToken) |
| | 54 | | { |
| 4 | 55 | | var message = _pipeline.CreateMessage(); |
| 4 | 56 | | var request = message.Request; |
| 4 | 57 | | request.Method = RequestMethod.Get; |
| 4 | 58 | | var uri = new RawRequestUriBuilder(); |
| 4 | 59 | | uri.Reset(endpoint); |
| 4 | 60 | | uri.AppendPath("/subscriptions/", false); |
| 4 | 61 | | uri.AppendPath(subscriptionId, true); |
| 4 | 62 | | uri.AppendPath("/providers/Microsoft.AppConfiguration/configurationStores", false); |
| 4 | 63 | | uri.AppendQuery("api-version", apiVersion, true); |
| 4 | 64 | | if (skipToken != null) |
| | 65 | | { |
| 4 | 66 | | uri.AppendQuery("$skipToken", skipToken, true); |
| | 67 | | } |
| 4 | 68 | | request.Uri = uri; |
| 4 | 69 | | return message; |
| | 70 | | } |
| | 71 | |
|
| | 72 | | /// <summary> Lists the configuration stores for a given subscription. </summary> |
| | 73 | | /// <param name="skipToken"> A skip token is used to continue retrieving items after an operation returns a part |
| | 74 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 75 | | public async Task<Response<ConfigurationStoreListResult>> ListAsync(string skipToken = null, CancellationToken c |
| | 76 | | { |
| 2 | 77 | | using var message = CreateListRequest(skipToken); |
| 2 | 78 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 2 | 79 | | switch (message.Response.Status) |
| | 80 | | { |
| | 81 | | case 200: |
| | 82 | | { |
| 2 | 83 | | ConfigurationStoreListResult value = default; |
| 2 | 84 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 2 | 85 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 86 | | { |
| 0 | 87 | | value = null; |
| | 88 | | } |
| | 89 | | else |
| | 90 | | { |
| 2 | 91 | | value = ConfigurationStoreListResult.DeserializeConfigurationStoreListResult(document.RootEl |
| | 92 | | } |
| 2 | 93 | | return Response.FromValue(value, message.Response); |
| | 94 | | } |
| | 95 | | default: |
| 0 | 96 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 97 | | } |
| 2 | 98 | | } |
| | 99 | |
|
| | 100 | | /// <summary> Lists the configuration stores for a given subscription. </summary> |
| | 101 | | /// <param name="skipToken"> A skip token is used to continue retrieving items after an operation returns a part |
| | 102 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 103 | | public Response<ConfigurationStoreListResult> List(string skipToken = null, CancellationToken cancellationToken |
| | 104 | | { |
| 2 | 105 | | using var message = CreateListRequest(skipToken); |
| 2 | 106 | | _pipeline.Send(message, cancellationToken); |
| 2 | 107 | | switch (message.Response.Status) |
| | 108 | | { |
| | 109 | | case 200: |
| | 110 | | { |
| 2 | 111 | | ConfigurationStoreListResult value = default; |
| 2 | 112 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 2 | 113 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 114 | | { |
| 0 | 115 | | value = null; |
| | 116 | | } |
| | 117 | | else |
| | 118 | | { |
| 2 | 119 | | value = ConfigurationStoreListResult.DeserializeConfigurationStoreListResult(document.RootEl |
| | 120 | | } |
| 2 | 121 | | return Response.FromValue(value, message.Response); |
| | 122 | | } |
| | 123 | | default: |
| 0 | 124 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 125 | | } |
| 2 | 126 | | } |
| | 127 | |
|
| | 128 | | internal HttpMessage CreateListByResourceGroupRequest(string resourceGroupName, string skipToken) |
| | 129 | | { |
| 4 | 130 | | var message = _pipeline.CreateMessage(); |
| 4 | 131 | | var request = message.Request; |
| 4 | 132 | | request.Method = RequestMethod.Get; |
| 4 | 133 | | var uri = new RawRequestUriBuilder(); |
| 4 | 134 | | uri.Reset(endpoint); |
| 4 | 135 | | uri.AppendPath("/subscriptions/", false); |
| 4 | 136 | | uri.AppendPath(subscriptionId, true); |
| 4 | 137 | | uri.AppendPath("/resourceGroups/", false); |
| 4 | 138 | | uri.AppendPath(resourceGroupName, true); |
| 4 | 139 | | uri.AppendPath("/providers/Microsoft.AppConfiguration/configurationStores", false); |
| 4 | 140 | | uri.AppendQuery("api-version", apiVersion, true); |
| 4 | 141 | | if (skipToken != null) |
| | 142 | | { |
| 0 | 143 | | uri.AppendQuery("$skipToken", skipToken, true); |
| | 144 | | } |
| 4 | 145 | | request.Uri = uri; |
| 4 | 146 | | return message; |
| | 147 | | } |
| | 148 | |
|
| | 149 | | /// <summary> Lists the configuration stores for a given resource group. </summary> |
| | 150 | | /// <param name="resourceGroupName"> The name of the resource group to which the container registry belongs. </p |
| | 151 | | /// <param name="skipToken"> A skip token is used to continue retrieving items after an operation returns a part |
| | 152 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 153 | | public async Task<Response<ConfigurationStoreListResult>> ListByResourceGroupAsync(string resourceGroupName, str |
| | 154 | | { |
| 2 | 155 | | if (resourceGroupName == null) |
| | 156 | | { |
| 0 | 157 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 158 | | } |
| | 159 | |
|
| 2 | 160 | | using var message = CreateListByResourceGroupRequest(resourceGroupName, skipToken); |
| 2 | 161 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 2 | 162 | | switch (message.Response.Status) |
| | 163 | | { |
| | 164 | | case 200: |
| | 165 | | { |
| 2 | 166 | | ConfigurationStoreListResult value = default; |
| 2 | 167 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 2 | 168 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 169 | | { |
| 0 | 170 | | value = null; |
| | 171 | | } |
| | 172 | | else |
| | 173 | | { |
| 2 | 174 | | value = ConfigurationStoreListResult.DeserializeConfigurationStoreListResult(document.RootEl |
| | 175 | | } |
| 2 | 176 | | return Response.FromValue(value, message.Response); |
| | 177 | | } |
| | 178 | | default: |
| 0 | 179 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 180 | | } |
| 2 | 181 | | } |
| | 182 | |
|
| | 183 | | /// <summary> Lists the configuration stores for a given resource group. </summary> |
| | 184 | | /// <param name="resourceGroupName"> The name of the resource group to which the container registry belongs. </p |
| | 185 | | /// <param name="skipToken"> A skip token is used to continue retrieving items after an operation returns a part |
| | 186 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 187 | | public Response<ConfigurationStoreListResult> ListByResourceGroup(string resourceGroupName, string skipToken = n |
| | 188 | | { |
| 2 | 189 | | if (resourceGroupName == null) |
| | 190 | | { |
| 0 | 191 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 192 | | } |
| | 193 | |
|
| 2 | 194 | | using var message = CreateListByResourceGroupRequest(resourceGroupName, skipToken); |
| 2 | 195 | | _pipeline.Send(message, cancellationToken); |
| 2 | 196 | | switch (message.Response.Status) |
| | 197 | | { |
| | 198 | | case 200: |
| | 199 | | { |
| 2 | 200 | | ConfigurationStoreListResult value = default; |
| 2 | 201 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 2 | 202 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 203 | | { |
| 0 | 204 | | value = null; |
| | 205 | | } |
| | 206 | | else |
| | 207 | | { |
| 2 | 208 | | value = ConfigurationStoreListResult.DeserializeConfigurationStoreListResult(document.RootEl |
| | 209 | | } |
| 2 | 210 | | return Response.FromValue(value, message.Response); |
| | 211 | | } |
| | 212 | | default: |
| 0 | 213 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 214 | | } |
| 2 | 215 | | } |
| | 216 | |
|
| | 217 | | internal HttpMessage CreateGetRequest(string resourceGroupName, string configStoreName) |
| | 218 | | { |
| 4 | 219 | | var message = _pipeline.CreateMessage(); |
| 4 | 220 | | var request = message.Request; |
| 4 | 221 | | request.Method = RequestMethod.Get; |
| 4 | 222 | | var uri = new RawRequestUriBuilder(); |
| 4 | 223 | | uri.Reset(endpoint); |
| 4 | 224 | | uri.AppendPath("/subscriptions/", false); |
| 4 | 225 | | uri.AppendPath(subscriptionId, true); |
| 4 | 226 | | uri.AppendPath("/resourceGroups/", false); |
| 4 | 227 | | uri.AppendPath(resourceGroupName, true); |
| 4 | 228 | | uri.AppendPath("/providers/Microsoft.AppConfiguration/configurationStores/", false); |
| 4 | 229 | | uri.AppendPath(configStoreName, true); |
| 4 | 230 | | uri.AppendQuery("api-version", apiVersion, true); |
| 4 | 231 | | request.Uri = uri; |
| 4 | 232 | | return message; |
| | 233 | | } |
| | 234 | |
|
| | 235 | | /// <summary> Gets the properties of the specified configuration store. </summary> |
| | 236 | | /// <param name="resourceGroupName"> The name of the resource group to which the container registry belongs. </p |
| | 237 | | /// <param name="configStoreName"> The name of the configuration store. </param> |
| | 238 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 239 | | public async Task<Response<ConfigurationStore>> GetAsync(string resourceGroupName, string configStoreName, Cance |
| | 240 | | { |
| 2 | 241 | | if (resourceGroupName == null) |
| | 242 | | { |
| 0 | 243 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 244 | | } |
| 2 | 245 | | if (configStoreName == null) |
| | 246 | | { |
| 0 | 247 | | throw new ArgumentNullException(nameof(configStoreName)); |
| | 248 | | } |
| | 249 | |
|
| 2 | 250 | | using var message = CreateGetRequest(resourceGroupName, configStoreName); |
| 2 | 251 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 2 | 252 | | switch (message.Response.Status) |
| | 253 | | { |
| | 254 | | case 200: |
| | 255 | | { |
| 2 | 256 | | ConfigurationStore value = default; |
| 2 | 257 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 2 | 258 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 259 | | { |
| 0 | 260 | | value = null; |
| | 261 | | } |
| | 262 | | else |
| | 263 | | { |
| 2 | 264 | | value = ConfigurationStore.DeserializeConfigurationStore(document.RootElement); |
| | 265 | | } |
| 2 | 266 | | return Response.FromValue(value, message.Response); |
| | 267 | | } |
| | 268 | | default: |
| 0 | 269 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 270 | | } |
| 2 | 271 | | } |
| | 272 | |
|
| | 273 | | /// <summary> Gets the properties of the specified configuration store. </summary> |
| | 274 | | /// <param name="resourceGroupName"> The name of the resource group to which the container registry belongs. </p |
| | 275 | | /// <param name="configStoreName"> The name of the configuration store. </param> |
| | 276 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 277 | | public Response<ConfigurationStore> Get(string resourceGroupName, string configStoreName, CancellationToken canc |
| | 278 | | { |
| 2 | 279 | | if (resourceGroupName == null) |
| | 280 | | { |
| 0 | 281 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 282 | | } |
| 2 | 283 | | if (configStoreName == null) |
| | 284 | | { |
| 0 | 285 | | throw new ArgumentNullException(nameof(configStoreName)); |
| | 286 | | } |
| | 287 | |
|
| 2 | 288 | | using var message = CreateGetRequest(resourceGroupName, configStoreName); |
| 2 | 289 | | _pipeline.Send(message, cancellationToken); |
| 2 | 290 | | switch (message.Response.Status) |
| | 291 | | { |
| | 292 | | case 200: |
| | 293 | | { |
| 2 | 294 | | ConfigurationStore value = default; |
| 2 | 295 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 2 | 296 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 297 | | { |
| 0 | 298 | | value = null; |
| | 299 | | } |
| | 300 | | else |
| | 301 | | { |
| 2 | 302 | | value = ConfigurationStore.DeserializeConfigurationStore(document.RootElement); |
| | 303 | | } |
| 2 | 304 | | return Response.FromValue(value, message.Response); |
| | 305 | | } |
| | 306 | | default: |
| 0 | 307 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 308 | | } |
| 2 | 309 | | } |
| | 310 | |
|
| | 311 | | internal HttpMessage CreateCreateRequest(string resourceGroupName, string configStoreName, ConfigurationStore co |
| | 312 | | { |
| 16 | 313 | | var message = _pipeline.CreateMessage(); |
| 16 | 314 | | var request = message.Request; |
| 16 | 315 | | request.Method = RequestMethod.Put; |
| 16 | 316 | | var uri = new RawRequestUriBuilder(); |
| 16 | 317 | | uri.Reset(endpoint); |
| 16 | 318 | | uri.AppendPath("/subscriptions/", false); |
| 16 | 319 | | uri.AppendPath(subscriptionId, true); |
| 16 | 320 | | uri.AppendPath("/resourceGroups/", false); |
| 16 | 321 | | uri.AppendPath(resourceGroupName, true); |
| 16 | 322 | | uri.AppendPath("/providers/Microsoft.AppConfiguration/configurationStores/", false); |
| 16 | 323 | | uri.AppendPath(configStoreName, true); |
| 16 | 324 | | uri.AppendQuery("api-version", apiVersion, true); |
| 16 | 325 | | request.Uri = uri; |
| 16 | 326 | | request.Headers.Add("Content-Type", "application/json"); |
| 16 | 327 | | var content = new Utf8JsonRequestContent(); |
| 16 | 328 | | content.JsonWriter.WriteObjectValue(configStoreCreationParameters); |
| 16 | 329 | | request.Content = content; |
| 16 | 330 | | return message; |
| | 331 | | } |
| | 332 | |
|
| | 333 | | /// <summary> Creates a configuration store with the specified parameters. </summary> |
| | 334 | | /// <param name="resourceGroupName"> The name of the resource group to which the container registry belongs. </p |
| | 335 | | /// <param name="configStoreName"> The name of the configuration store. </param> |
| | 336 | | /// <param name="configStoreCreationParameters"> The parameters for creating a configuration store. </param> |
| | 337 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 338 | | public async Task<Response> CreateAsync(string resourceGroupName, string configStoreName, ConfigurationStore con |
| | 339 | | { |
| 4 | 340 | | if (resourceGroupName == null) |
| | 341 | | { |
| 0 | 342 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 343 | | } |
| 4 | 344 | | if (configStoreName == null) |
| | 345 | | { |
| 0 | 346 | | throw new ArgumentNullException(nameof(configStoreName)); |
| | 347 | | } |
| 4 | 348 | | if (configStoreCreationParameters == null) |
| | 349 | | { |
| 0 | 350 | | throw new ArgumentNullException(nameof(configStoreCreationParameters)); |
| | 351 | | } |
| | 352 | |
|
| 4 | 353 | | using var message = CreateCreateRequest(resourceGroupName, configStoreName, configStoreCreationParameters); |
| 4 | 354 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 4 | 355 | | switch (message.Response.Status) |
| | 356 | | { |
| | 357 | | case 200: |
| | 358 | | case 201: |
| 4 | 359 | | return message.Response; |
| | 360 | | default: |
| 0 | 361 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 362 | | } |
| 4 | 363 | | } |
| | 364 | |
|
| | 365 | | /// <summary> Creates a configuration store with the specified parameters. </summary> |
| | 366 | | /// <param name="resourceGroupName"> The name of the resource group to which the container registry belongs. </p |
| | 367 | | /// <param name="configStoreName"> The name of the configuration store. </param> |
| | 368 | | /// <param name="configStoreCreationParameters"> The parameters for creating a configuration store. </param> |
| | 369 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 370 | | public Response Create(string resourceGroupName, string configStoreName, ConfigurationStore configStoreCreationP |
| | 371 | | { |
| 4 | 372 | | if (resourceGroupName == null) |
| | 373 | | { |
| 0 | 374 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 375 | | } |
| 4 | 376 | | if (configStoreName == null) |
| | 377 | | { |
| 0 | 378 | | throw new ArgumentNullException(nameof(configStoreName)); |
| | 379 | | } |
| 4 | 380 | | if (configStoreCreationParameters == null) |
| | 381 | | { |
| 0 | 382 | | throw new ArgumentNullException(nameof(configStoreCreationParameters)); |
| | 383 | | } |
| | 384 | |
|
| 4 | 385 | | using var message = CreateCreateRequest(resourceGroupName, configStoreName, configStoreCreationParameters); |
| 4 | 386 | | _pipeline.Send(message, cancellationToken); |
| 4 | 387 | | switch (message.Response.Status) |
| | 388 | | { |
| | 389 | | case 200: |
| | 390 | | case 201: |
| 4 | 391 | | return message.Response; |
| | 392 | | default: |
| 0 | 393 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 394 | | } |
| 4 | 395 | | } |
| | 396 | |
|
| | 397 | | internal HttpMessage CreateDeleteRequest(string resourceGroupName, string configStoreName) |
| | 398 | | { |
| 8 | 399 | | var message = _pipeline.CreateMessage(); |
| 8 | 400 | | var request = message.Request; |
| 8 | 401 | | request.Method = RequestMethod.Delete; |
| 8 | 402 | | var uri = new RawRequestUriBuilder(); |
| 8 | 403 | | uri.Reset(endpoint); |
| 8 | 404 | | uri.AppendPath("/subscriptions/", false); |
| 8 | 405 | | uri.AppendPath(subscriptionId, true); |
| 8 | 406 | | uri.AppendPath("/resourceGroups/", false); |
| 8 | 407 | | uri.AppendPath(resourceGroupName, true); |
| 8 | 408 | | uri.AppendPath("/providers/Microsoft.AppConfiguration/configurationStores/", false); |
| 8 | 409 | | uri.AppendPath(configStoreName, true); |
| 8 | 410 | | uri.AppendQuery("api-version", apiVersion, true); |
| 8 | 411 | | request.Uri = uri; |
| 8 | 412 | | return message; |
| | 413 | | } |
| | 414 | |
|
| | 415 | | /// <summary> Deletes a configuration store. </summary> |
| | 416 | | /// <param name="resourceGroupName"> The name of the resource group to which the container registry belongs. </p |
| | 417 | | /// <param name="configStoreName"> The name of the configuration store. </param> |
| | 418 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 419 | | public async Task<Response> DeleteAsync(string resourceGroupName, string configStoreName, CancellationToken canc |
| | 420 | | { |
| 2 | 421 | | if (resourceGroupName == null) |
| | 422 | | { |
| 0 | 423 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 424 | | } |
| 2 | 425 | | if (configStoreName == null) |
| | 426 | | { |
| 0 | 427 | | throw new ArgumentNullException(nameof(configStoreName)); |
| | 428 | | } |
| | 429 | |
|
| 2 | 430 | | using var message = CreateDeleteRequest(resourceGroupName, configStoreName); |
| 2 | 431 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 2 | 432 | | switch (message.Response.Status) |
| | 433 | | { |
| | 434 | | case 200: |
| | 435 | | case 202: |
| | 436 | | case 204: |
| 2 | 437 | | return message.Response; |
| | 438 | | default: |
| 0 | 439 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 440 | | } |
| 2 | 441 | | } |
| | 442 | |
|
| | 443 | | /// <summary> Deletes a configuration store. </summary> |
| | 444 | | /// <param name="resourceGroupName"> The name of the resource group to which the container registry belongs. </p |
| | 445 | | /// <param name="configStoreName"> The name of the configuration store. </param> |
| | 446 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 447 | | public Response Delete(string resourceGroupName, string configStoreName, CancellationToken cancellationToken = d |
| | 448 | | { |
| 2 | 449 | | if (resourceGroupName == null) |
| | 450 | | { |
| 0 | 451 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 452 | | } |
| 2 | 453 | | if (configStoreName == null) |
| | 454 | | { |
| 0 | 455 | | throw new ArgumentNullException(nameof(configStoreName)); |
| | 456 | | } |
| | 457 | |
|
| 2 | 458 | | using var message = CreateDeleteRequest(resourceGroupName, configStoreName); |
| 2 | 459 | | _pipeline.Send(message, cancellationToken); |
| 2 | 460 | | switch (message.Response.Status) |
| | 461 | | { |
| | 462 | | case 200: |
| | 463 | | case 202: |
| | 464 | | case 204: |
| 2 | 465 | | return message.Response; |
| | 466 | | default: |
| 0 | 467 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 468 | | } |
| 2 | 469 | | } |
| | 470 | |
|
| | 471 | | internal HttpMessage CreateUpdateRequest(string resourceGroupName, string configStoreName, ConfigurationStoreUpd |
| | 472 | | { |
| 8 | 473 | | var message = _pipeline.CreateMessage(); |
| 8 | 474 | | var request = message.Request; |
| 8 | 475 | | request.Method = RequestMethod.Patch; |
| 8 | 476 | | var uri = new RawRequestUriBuilder(); |
| 8 | 477 | | uri.Reset(endpoint); |
| 8 | 478 | | uri.AppendPath("/subscriptions/", false); |
| 8 | 479 | | uri.AppendPath(subscriptionId, true); |
| 8 | 480 | | uri.AppendPath("/resourceGroups/", false); |
| 8 | 481 | | uri.AppendPath(resourceGroupName, true); |
| 8 | 482 | | uri.AppendPath("/providers/Microsoft.AppConfiguration/configurationStores/", false); |
| 8 | 483 | | uri.AppendPath(configStoreName, true); |
| 8 | 484 | | uri.AppendQuery("api-version", apiVersion, true); |
| 8 | 485 | | request.Uri = uri; |
| 8 | 486 | | request.Headers.Add("Content-Type", "application/json"); |
| 8 | 487 | | var content = new Utf8JsonRequestContent(); |
| 8 | 488 | | content.JsonWriter.WriteObjectValue(configStoreUpdateParameters); |
| 8 | 489 | | request.Content = content; |
| 8 | 490 | | return message; |
| | 491 | | } |
| | 492 | |
|
| | 493 | | /// <summary> Updates a configuration store with the specified parameters. </summary> |
| | 494 | | /// <param name="resourceGroupName"> The name of the resource group to which the container registry belongs. </p |
| | 495 | | /// <param name="configStoreName"> The name of the configuration store. </param> |
| | 496 | | /// <param name="configStoreUpdateParameters"> The parameters for updating a configuration store. </param> |
| | 497 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 498 | | public async Task<Response> UpdateAsync(string resourceGroupName, string configStoreName, ConfigurationStoreUpda |
| | 499 | | { |
| 2 | 500 | | if (resourceGroupName == null) |
| | 501 | | { |
| 0 | 502 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 503 | | } |
| 2 | 504 | | if (configStoreName == null) |
| | 505 | | { |
| 0 | 506 | | throw new ArgumentNullException(nameof(configStoreName)); |
| | 507 | | } |
| 2 | 508 | | if (configStoreUpdateParameters == null) |
| | 509 | | { |
| 0 | 510 | | throw new ArgumentNullException(nameof(configStoreUpdateParameters)); |
| | 511 | | } |
| | 512 | |
|
| 2 | 513 | | using var message = CreateUpdateRequest(resourceGroupName, configStoreName, configStoreUpdateParameters); |
| 2 | 514 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 2 | 515 | | switch (message.Response.Status) |
| | 516 | | { |
| | 517 | | case 200: |
| | 518 | | case 201: |
| 2 | 519 | | return message.Response; |
| | 520 | | default: |
| 0 | 521 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 522 | | } |
| 2 | 523 | | } |
| | 524 | |
|
| | 525 | | /// <summary> Updates a configuration store with the specified parameters. </summary> |
| | 526 | | /// <param name="resourceGroupName"> The name of the resource group to which the container registry belongs. </p |
| | 527 | | /// <param name="configStoreName"> The name of the configuration store. </param> |
| | 528 | | /// <param name="configStoreUpdateParameters"> The parameters for updating a configuration store. </param> |
| | 529 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 530 | | public Response Update(string resourceGroupName, string configStoreName, ConfigurationStoreUpdateParameters conf |
| | 531 | | { |
| 2 | 532 | | if (resourceGroupName == null) |
| | 533 | | { |
| 0 | 534 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 535 | | } |
| 2 | 536 | | if (configStoreName == null) |
| | 537 | | { |
| 0 | 538 | | throw new ArgumentNullException(nameof(configStoreName)); |
| | 539 | | } |
| 2 | 540 | | if (configStoreUpdateParameters == null) |
| | 541 | | { |
| 0 | 542 | | throw new ArgumentNullException(nameof(configStoreUpdateParameters)); |
| | 543 | | } |
| | 544 | |
|
| 2 | 545 | | using var message = CreateUpdateRequest(resourceGroupName, configStoreName, configStoreUpdateParameters); |
| 2 | 546 | | _pipeline.Send(message, cancellationToken); |
| 2 | 547 | | switch (message.Response.Status) |
| | 548 | | { |
| | 549 | | case 200: |
| | 550 | | case 201: |
| 2 | 551 | | return message.Response; |
| | 552 | | default: |
| 0 | 553 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 554 | | } |
| 2 | 555 | | } |
| | 556 | |
|
| | 557 | | internal HttpMessage CreateListKeysRequest(string resourceGroupName, string configStoreName, string skipToken) |
| | 558 | | { |
| 4 | 559 | | var message = _pipeline.CreateMessage(); |
| 4 | 560 | | var request = message.Request; |
| 4 | 561 | | request.Method = RequestMethod.Post; |
| 4 | 562 | | var uri = new RawRequestUriBuilder(); |
| 4 | 563 | | uri.Reset(endpoint); |
| 4 | 564 | | uri.AppendPath("/subscriptions/", false); |
| 4 | 565 | | uri.AppendPath(subscriptionId, true); |
| 4 | 566 | | uri.AppendPath("/resourceGroups/", false); |
| 4 | 567 | | uri.AppendPath(resourceGroupName, true); |
| 4 | 568 | | uri.AppendPath("/providers/Microsoft.AppConfiguration/configurationStores/", false); |
| 4 | 569 | | uri.AppendPath(configStoreName, true); |
| 4 | 570 | | uri.AppendPath("/ListKeys", false); |
| 4 | 571 | | uri.AppendQuery("api-version", apiVersion, true); |
| 4 | 572 | | if (skipToken != null) |
| | 573 | | { |
| 0 | 574 | | uri.AppendQuery("$skipToken", skipToken, true); |
| | 575 | | } |
| 4 | 576 | | request.Uri = uri; |
| 4 | 577 | | return message; |
| | 578 | | } |
| | 579 | |
|
| | 580 | | /// <summary> Lists the access key for the specified configuration store. </summary> |
| | 581 | | /// <param name="resourceGroupName"> The name of the resource group to which the container registry belongs. </p |
| | 582 | | /// <param name="configStoreName"> The name of the configuration store. </param> |
| | 583 | | /// <param name="skipToken"> A skip token is used to continue retrieving items after an operation returns a part |
| | 584 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 585 | | public async Task<Response<ApiKeyListResult>> ListKeysAsync(string resourceGroupName, string configStoreName, st |
| | 586 | | { |
| 2 | 587 | | if (resourceGroupName == null) |
| | 588 | | { |
| 0 | 589 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 590 | | } |
| 2 | 591 | | if (configStoreName == null) |
| | 592 | | { |
| 0 | 593 | | throw new ArgumentNullException(nameof(configStoreName)); |
| | 594 | | } |
| | 595 | |
|
| 2 | 596 | | using var message = CreateListKeysRequest(resourceGroupName, configStoreName, skipToken); |
| 2 | 597 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 2 | 598 | | switch (message.Response.Status) |
| | 599 | | { |
| | 600 | | case 200: |
| | 601 | | { |
| 2 | 602 | | ApiKeyListResult value = default; |
| 2 | 603 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 2 | 604 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 605 | | { |
| 0 | 606 | | value = null; |
| | 607 | | } |
| | 608 | | else |
| | 609 | | { |
| 2 | 610 | | value = ApiKeyListResult.DeserializeApiKeyListResult(document.RootElement); |
| | 611 | | } |
| 2 | 612 | | return Response.FromValue(value, message.Response); |
| | 613 | | } |
| | 614 | | default: |
| 0 | 615 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 616 | | } |
| 2 | 617 | | } |
| | 618 | |
|
| | 619 | | /// <summary> Lists the access key for the specified configuration store. </summary> |
| | 620 | | /// <param name="resourceGroupName"> The name of the resource group to which the container registry belongs. </p |
| | 621 | | /// <param name="configStoreName"> The name of the configuration store. </param> |
| | 622 | | /// <param name="skipToken"> A skip token is used to continue retrieving items after an operation returns a part |
| | 623 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 624 | | public Response<ApiKeyListResult> ListKeys(string resourceGroupName, string configStoreName, string skipToken = |
| | 625 | | { |
| 2 | 626 | | if (resourceGroupName == null) |
| | 627 | | { |
| 0 | 628 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 629 | | } |
| 2 | 630 | | if (configStoreName == null) |
| | 631 | | { |
| 0 | 632 | | throw new ArgumentNullException(nameof(configStoreName)); |
| | 633 | | } |
| | 634 | |
|
| 2 | 635 | | using var message = CreateListKeysRequest(resourceGroupName, configStoreName, skipToken); |
| 2 | 636 | | _pipeline.Send(message, cancellationToken); |
| 2 | 637 | | switch (message.Response.Status) |
| | 638 | | { |
| | 639 | | case 200: |
| | 640 | | { |
| 2 | 641 | | ApiKeyListResult value = default; |
| 2 | 642 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 2 | 643 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 644 | | { |
| 0 | 645 | | value = null; |
| | 646 | | } |
| | 647 | | else |
| | 648 | | { |
| 2 | 649 | | value = ApiKeyListResult.DeserializeApiKeyListResult(document.RootElement); |
| | 650 | | } |
| 2 | 651 | | return Response.FromValue(value, message.Response); |
| | 652 | | } |
| | 653 | | default: |
| 0 | 654 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 655 | | } |
| 2 | 656 | | } |
| | 657 | |
|
| | 658 | | internal HttpMessage CreateRegenerateKeyRequest(string resourceGroupName, string configStoreName, RegenerateKeyP |
| | 659 | | { |
| 4 | 660 | | var message = _pipeline.CreateMessage(); |
| 4 | 661 | | var request = message.Request; |
| 4 | 662 | | request.Method = RequestMethod.Post; |
| 4 | 663 | | var uri = new RawRequestUriBuilder(); |
| 4 | 664 | | uri.Reset(endpoint); |
| 4 | 665 | | uri.AppendPath("/subscriptions/", false); |
| 4 | 666 | | uri.AppendPath(subscriptionId, true); |
| 4 | 667 | | uri.AppendPath("/resourceGroups/", false); |
| 4 | 668 | | uri.AppendPath(resourceGroupName, true); |
| 4 | 669 | | uri.AppendPath("/providers/Microsoft.AppConfiguration/configurationStores/", false); |
| 4 | 670 | | uri.AppendPath(configStoreName, true); |
| 4 | 671 | | uri.AppendPath("/RegenerateKey", false); |
| 4 | 672 | | uri.AppendQuery("api-version", apiVersion, true); |
| 4 | 673 | | request.Uri = uri; |
| 4 | 674 | | request.Headers.Add("Content-Type", "application/json"); |
| 4 | 675 | | var content = new Utf8JsonRequestContent(); |
| 4 | 676 | | content.JsonWriter.WriteObjectValue(regenerateKeyParameters); |
| 4 | 677 | | request.Content = content; |
| 4 | 678 | | return message; |
| | 679 | | } |
| | 680 | |
|
| | 681 | | /// <summary> Regenerates an access key for the specified configuration store. </summary> |
| | 682 | | /// <param name="resourceGroupName"> The name of the resource group to which the container registry belongs. </p |
| | 683 | | /// <param name="configStoreName"> The name of the configuration store. </param> |
| | 684 | | /// <param name="regenerateKeyParameters"> The parameters for regenerating an access key. </param> |
| | 685 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 686 | | public async Task<Response<ApiKey>> RegenerateKeyAsync(string resourceGroupName, string configStoreName, Regener |
| | 687 | | { |
| 2 | 688 | | if (resourceGroupName == null) |
| | 689 | | { |
| 0 | 690 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 691 | | } |
| 2 | 692 | | if (configStoreName == null) |
| | 693 | | { |
| 0 | 694 | | throw new ArgumentNullException(nameof(configStoreName)); |
| | 695 | | } |
| 2 | 696 | | if (regenerateKeyParameters == null) |
| | 697 | | { |
| 0 | 698 | | throw new ArgumentNullException(nameof(regenerateKeyParameters)); |
| | 699 | | } |
| | 700 | |
|
| 2 | 701 | | using var message = CreateRegenerateKeyRequest(resourceGroupName, configStoreName, regenerateKeyParameters); |
| 2 | 702 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 2 | 703 | | switch (message.Response.Status) |
| | 704 | | { |
| | 705 | | case 200: |
| | 706 | | { |
| 2 | 707 | | ApiKey value = default; |
| 2 | 708 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 2 | 709 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 710 | | { |
| 0 | 711 | | value = null; |
| | 712 | | } |
| | 713 | | else |
| | 714 | | { |
| 2 | 715 | | value = ApiKey.DeserializeApiKey(document.RootElement); |
| | 716 | | } |
| 2 | 717 | | return Response.FromValue(value, message.Response); |
| | 718 | | } |
| | 719 | | default: |
| 0 | 720 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 721 | | } |
| 2 | 722 | | } |
| | 723 | |
|
| | 724 | | /// <summary> Regenerates an access key for the specified configuration store. </summary> |
| | 725 | | /// <param name="resourceGroupName"> The name of the resource group to which the container registry belongs. </p |
| | 726 | | /// <param name="configStoreName"> The name of the configuration store. </param> |
| | 727 | | /// <param name="regenerateKeyParameters"> The parameters for regenerating an access key. </param> |
| | 728 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 729 | | public Response<ApiKey> RegenerateKey(string resourceGroupName, string configStoreName, RegenerateKeyParameters |
| | 730 | | { |
| 2 | 731 | | if (resourceGroupName == null) |
| | 732 | | { |
| 0 | 733 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 734 | | } |
| 2 | 735 | | if (configStoreName == null) |
| | 736 | | { |
| 0 | 737 | | throw new ArgumentNullException(nameof(configStoreName)); |
| | 738 | | } |
| 2 | 739 | | if (regenerateKeyParameters == null) |
| | 740 | | { |
| 0 | 741 | | throw new ArgumentNullException(nameof(regenerateKeyParameters)); |
| | 742 | | } |
| | 743 | |
|
| 2 | 744 | | using var message = CreateRegenerateKeyRequest(resourceGroupName, configStoreName, regenerateKeyParameters); |
| 2 | 745 | | _pipeline.Send(message, cancellationToken); |
| 2 | 746 | | switch (message.Response.Status) |
| | 747 | | { |
| | 748 | | case 200: |
| | 749 | | { |
| 2 | 750 | | ApiKey value = default; |
| 2 | 751 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 2 | 752 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 753 | | { |
| 0 | 754 | | value = null; |
| | 755 | | } |
| | 756 | | else |
| | 757 | | { |
| 2 | 758 | | value = ApiKey.DeserializeApiKey(document.RootElement); |
| | 759 | | } |
| 2 | 760 | | return Response.FromValue(value, message.Response); |
| | 761 | | } |
| | 762 | | default: |
| 0 | 763 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 764 | | } |
| 2 | 765 | | } |
| | 766 | |
|
| | 767 | | internal HttpMessage CreateListKeyValueRequest(string resourceGroupName, string configStoreName, ListKeyValuePar |
| | 768 | | { |
| 0 | 769 | | var message = _pipeline.CreateMessage(); |
| 0 | 770 | | var request = message.Request; |
| 0 | 771 | | request.Method = RequestMethod.Post; |
| 0 | 772 | | var uri = new RawRequestUriBuilder(); |
| 0 | 773 | | uri.Reset(endpoint); |
| 0 | 774 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 775 | | uri.AppendPath(subscriptionId, true); |
| 0 | 776 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 777 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 778 | | uri.AppendPath("/providers/Microsoft.AppConfiguration/configurationStores/", false); |
| 0 | 779 | | uri.AppendPath(configStoreName, true); |
| 0 | 780 | | uri.AppendPath("/listKeyValue", false); |
| 0 | 781 | | uri.AppendQuery("api-version", apiVersion, true); |
| 0 | 782 | | request.Uri = uri; |
| 0 | 783 | | request.Headers.Add("Content-Type", "application/json"); |
| 0 | 784 | | var content = new Utf8JsonRequestContent(); |
| 0 | 785 | | content.JsonWriter.WriteObjectValue(listKeyValueParameters); |
| 0 | 786 | | request.Content = content; |
| 0 | 787 | | return message; |
| | 788 | | } |
| | 789 | |
|
| | 790 | | /// <summary> Lists a configuration store key-value. </summary> |
| | 791 | | /// <param name="resourceGroupName"> The name of the resource group to which the container registry belongs. </p |
| | 792 | | /// <param name="configStoreName"> The name of the configuration store. </param> |
| | 793 | | /// <param name="listKeyValueParameters"> The parameters for retrieving a key-value. </param> |
| | 794 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 795 | | public async Task<Response<KeyValue>> ListKeyValueAsync(string resourceGroupName, string configStoreName, ListKe |
| | 796 | | { |
| 0 | 797 | | if (resourceGroupName == null) |
| | 798 | | { |
| 0 | 799 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 800 | | } |
| 0 | 801 | | if (configStoreName == null) |
| | 802 | | { |
| 0 | 803 | | throw new ArgumentNullException(nameof(configStoreName)); |
| | 804 | | } |
| 0 | 805 | | if (listKeyValueParameters == null) |
| | 806 | | { |
| 0 | 807 | | throw new ArgumentNullException(nameof(listKeyValueParameters)); |
| | 808 | | } |
| | 809 | |
|
| 0 | 810 | | using var message = CreateListKeyValueRequest(resourceGroupName, configStoreName, listKeyValueParameters); |
| 0 | 811 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 812 | | switch (message.Response.Status) |
| | 813 | | { |
| | 814 | | case 200: |
| | 815 | | { |
| 0 | 816 | | KeyValue value = default; |
| 0 | 817 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 818 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 819 | | { |
| 0 | 820 | | value = null; |
| | 821 | | } |
| | 822 | | else |
| | 823 | | { |
| 0 | 824 | | value = KeyValue.DeserializeKeyValue(document.RootElement); |
| | 825 | | } |
| 0 | 826 | | return Response.FromValue(value, message.Response); |
| | 827 | | } |
| | 828 | | default: |
| 0 | 829 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 830 | | } |
| 0 | 831 | | } |
| | 832 | |
|
| | 833 | | /// <summary> Lists a configuration store key-value. </summary> |
| | 834 | | /// <param name="resourceGroupName"> The name of the resource group to which the container registry belongs. </p |
| | 835 | | /// <param name="configStoreName"> The name of the configuration store. </param> |
| | 836 | | /// <param name="listKeyValueParameters"> The parameters for retrieving a key-value. </param> |
| | 837 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 838 | | public Response<KeyValue> ListKeyValue(string resourceGroupName, string configStoreName, ListKeyValueParameters |
| | 839 | | { |
| 0 | 840 | | if (resourceGroupName == null) |
| | 841 | | { |
| 0 | 842 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 843 | | } |
| 0 | 844 | | if (configStoreName == null) |
| | 845 | | { |
| 0 | 846 | | throw new ArgumentNullException(nameof(configStoreName)); |
| | 847 | | } |
| 0 | 848 | | if (listKeyValueParameters == null) |
| | 849 | | { |
| 0 | 850 | | throw new ArgumentNullException(nameof(listKeyValueParameters)); |
| | 851 | | } |
| | 852 | |
|
| 0 | 853 | | using var message = CreateListKeyValueRequest(resourceGroupName, configStoreName, listKeyValueParameters); |
| 0 | 854 | | _pipeline.Send(message, cancellationToken); |
| 0 | 855 | | switch (message.Response.Status) |
| | 856 | | { |
| | 857 | | case 200: |
| | 858 | | { |
| 0 | 859 | | KeyValue value = default; |
| 0 | 860 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 861 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 862 | | { |
| 0 | 863 | | value = null; |
| | 864 | | } |
| | 865 | | else |
| | 866 | | { |
| 0 | 867 | | value = KeyValue.DeserializeKeyValue(document.RootElement); |
| | 868 | | } |
| 0 | 869 | | return Response.FromValue(value, message.Response); |
| | 870 | | } |
| | 871 | | default: |
| 0 | 872 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 873 | | } |
| 0 | 874 | | } |
| | 875 | |
|
| | 876 | | internal HttpMessage CreateListNextPageRequest(string nextLink, string skipToken) |
| | 877 | | { |
| 4 | 878 | | var message = _pipeline.CreateMessage(); |
| 4 | 879 | | var request = message.Request; |
| 4 | 880 | | request.Method = RequestMethod.Get; |
| 4 | 881 | | var uri = new RawRequestUriBuilder(); |
| 4 | 882 | | uri.Reset(endpoint); |
| 4 | 883 | | uri.AppendRawNextLink(nextLink, false); |
| 4 | 884 | | request.Uri = uri; |
| 4 | 885 | | return message; |
| | 886 | | } |
| | 887 | |
|
| | 888 | | /// <summary> Lists the configuration stores for a given subscription. </summary> |
| | 889 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 890 | | /// <param name="skipToken"> A skip token is used to continue retrieving items after an operation returns a part |
| | 891 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 892 | | public async Task<Response<ConfigurationStoreListResult>> ListNextPageAsync(string nextLink, string skipToken = |
| | 893 | | { |
| 2 | 894 | | if (nextLink == null) |
| | 895 | | { |
| 0 | 896 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 897 | | } |
| | 898 | |
|
| 2 | 899 | | using var message = CreateListNextPageRequest(nextLink, skipToken); |
| 2 | 900 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 2 | 901 | | switch (message.Response.Status) |
| | 902 | | { |
| | 903 | | case 200: |
| | 904 | | { |
| 2 | 905 | | ConfigurationStoreListResult value = default; |
| 2 | 906 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 2 | 907 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 908 | | { |
| 0 | 909 | | value = null; |
| | 910 | | } |
| | 911 | | else |
| | 912 | | { |
| 2 | 913 | | value = ConfigurationStoreListResult.DeserializeConfigurationStoreListResult(document.RootEl |
| | 914 | | } |
| 2 | 915 | | return Response.FromValue(value, message.Response); |
| | 916 | | } |
| | 917 | | default: |
| 0 | 918 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 919 | | } |
| 2 | 920 | | } |
| | 921 | |
|
| | 922 | | /// <summary> Lists the configuration stores for a given subscription. </summary> |
| | 923 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 924 | | /// <param name="skipToken"> A skip token is used to continue retrieving items after an operation returns a part |
| | 925 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 926 | | public Response<ConfigurationStoreListResult> ListNextPage(string nextLink, string skipToken = null, Cancellatio |
| | 927 | | { |
| 2 | 928 | | if (nextLink == null) |
| | 929 | | { |
| 0 | 930 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 931 | | } |
| | 932 | |
|
| 2 | 933 | | using var message = CreateListNextPageRequest(nextLink, skipToken); |
| 2 | 934 | | _pipeline.Send(message, cancellationToken); |
| 2 | 935 | | switch (message.Response.Status) |
| | 936 | | { |
| | 937 | | case 200: |
| | 938 | | { |
| 2 | 939 | | ConfigurationStoreListResult value = default; |
| 2 | 940 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 2 | 941 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 942 | | { |
| 0 | 943 | | value = null; |
| | 944 | | } |
| | 945 | | else |
| | 946 | | { |
| 2 | 947 | | value = ConfigurationStoreListResult.DeserializeConfigurationStoreListResult(document.RootEl |
| | 948 | | } |
| 2 | 949 | | return Response.FromValue(value, message.Response); |
| | 950 | | } |
| | 951 | | default: |
| 0 | 952 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 953 | | } |
| 2 | 954 | | } |
| | 955 | |
|
| | 956 | | internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string resourceGroupName, string |
| | 957 | | { |
| 4 | 958 | | var message = _pipeline.CreateMessage(); |
| 4 | 959 | | var request = message.Request; |
| 4 | 960 | | request.Method = RequestMethod.Get; |
| 4 | 961 | | var uri = new RawRequestUriBuilder(); |
| 4 | 962 | | uri.Reset(endpoint); |
| 4 | 963 | | uri.AppendRawNextLink(nextLink, false); |
| 4 | 964 | | request.Uri = uri; |
| 4 | 965 | | return message; |
| | 966 | | } |
| | 967 | |
|
| | 968 | | /// <summary> Lists the configuration stores for a given resource group. </summary> |
| | 969 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 970 | | /// <param name="resourceGroupName"> The name of the resource group to which the container registry belongs. </p |
| | 971 | | /// <param name="skipToken"> A skip token is used to continue retrieving items after an operation returns a part |
| | 972 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 973 | | public async Task<Response<ConfigurationStoreListResult>> ListByResourceGroupNextPageAsync(string nextLink, stri |
| | 974 | | { |
| 2 | 975 | | if (nextLink == null) |
| | 976 | | { |
| 0 | 977 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 978 | | } |
| 2 | 979 | | if (resourceGroupName == null) |
| | 980 | | { |
| 0 | 981 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 982 | | } |
| | 983 | |
|
| 2 | 984 | | using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName, skipToken); |
| 2 | 985 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 2 | 986 | | switch (message.Response.Status) |
| | 987 | | { |
| | 988 | | case 200: |
| | 989 | | { |
| 2 | 990 | | ConfigurationStoreListResult value = default; |
| 2 | 991 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 2 | 992 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 993 | | { |
| 0 | 994 | | value = null; |
| | 995 | | } |
| | 996 | | else |
| | 997 | | { |
| 2 | 998 | | value = ConfigurationStoreListResult.DeserializeConfigurationStoreListResult(document.RootEl |
| | 999 | | } |
| 2 | 1000 | | return Response.FromValue(value, message.Response); |
| | 1001 | | } |
| | 1002 | | default: |
| 0 | 1003 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 1004 | | } |
| 2 | 1005 | | } |
| | 1006 | |
|
| | 1007 | | /// <summary> Lists the configuration stores for a given resource group. </summary> |
| | 1008 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 1009 | | /// <param name="resourceGroupName"> The name of the resource group to which the container registry belongs. </p |
| | 1010 | | /// <param name="skipToken"> A skip token is used to continue retrieving items after an operation returns a part |
| | 1011 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1012 | | public Response<ConfigurationStoreListResult> ListByResourceGroupNextPage(string nextLink, string resourceGroupN |
| | 1013 | | { |
| 2 | 1014 | | if (nextLink == null) |
| | 1015 | | { |
| 0 | 1016 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 1017 | | } |
| 2 | 1018 | | if (resourceGroupName == null) |
| | 1019 | | { |
| 0 | 1020 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1021 | | } |
| | 1022 | |
|
| 2 | 1023 | | using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName, skipToken); |
| 2 | 1024 | | _pipeline.Send(message, cancellationToken); |
| 2 | 1025 | | switch (message.Response.Status) |
| | 1026 | | { |
| | 1027 | | case 200: |
| | 1028 | | { |
| 2 | 1029 | | ConfigurationStoreListResult value = default; |
| 2 | 1030 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 2 | 1031 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 1032 | | { |
| 0 | 1033 | | value = null; |
| | 1034 | | } |
| | 1035 | | else |
| | 1036 | | { |
| 2 | 1037 | | value = ConfigurationStoreListResult.DeserializeConfigurationStoreListResult(document.RootEl |
| | 1038 | | } |
| 2 | 1039 | | return Response.FromValue(value, message.Response); |
| | 1040 | | } |
| | 1041 | | default: |
| 0 | 1042 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 1043 | | } |
| 2 | 1044 | | } |
| | 1045 | |
|
| | 1046 | | internal HttpMessage CreateListKeysNextPageRequest(string nextLink, string resourceGroupName, string configStore |
| | 1047 | | { |
| 0 | 1048 | | var message = _pipeline.CreateMessage(); |
| 0 | 1049 | | var request = message.Request; |
| 0 | 1050 | | request.Method = RequestMethod.Get; |
| 0 | 1051 | | var uri = new RawRequestUriBuilder(); |
| 0 | 1052 | | uri.Reset(endpoint); |
| 0 | 1053 | | uri.AppendRawNextLink(nextLink, false); |
| 0 | 1054 | | request.Uri = uri; |
| 0 | 1055 | | return message; |
| | 1056 | | } |
| | 1057 | |
|
| | 1058 | | /// <summary> Lists the access key for the specified configuration store. </summary> |
| | 1059 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 1060 | | /// <param name="resourceGroupName"> The name of the resource group to which the container registry belongs. </p |
| | 1061 | | /// <param name="configStoreName"> The name of the configuration store. </param> |
| | 1062 | | /// <param name="skipToken"> A skip token is used to continue retrieving items after an operation returns a part |
| | 1063 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1064 | | public async Task<Response<ApiKeyListResult>> ListKeysNextPageAsync(string nextLink, string resourceGroupName, s |
| | 1065 | | { |
| 0 | 1066 | | if (nextLink == null) |
| | 1067 | | { |
| 0 | 1068 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 1069 | | } |
| 0 | 1070 | | if (resourceGroupName == null) |
| | 1071 | | { |
| 0 | 1072 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1073 | | } |
| 0 | 1074 | | if (configStoreName == null) |
| | 1075 | | { |
| 0 | 1076 | | throw new ArgumentNullException(nameof(configStoreName)); |
| | 1077 | | } |
| | 1078 | |
|
| 0 | 1079 | | using var message = CreateListKeysNextPageRequest(nextLink, resourceGroupName, configStoreName, skipToken); |
| 0 | 1080 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 1081 | | switch (message.Response.Status) |
| | 1082 | | { |
| | 1083 | | case 200: |
| | 1084 | | { |
| 0 | 1085 | | ApiKeyListResult value = default; |
| 0 | 1086 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 1087 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 1088 | | { |
| 0 | 1089 | | value = null; |
| | 1090 | | } |
| | 1091 | | else |
| | 1092 | | { |
| 0 | 1093 | | value = ApiKeyListResult.DeserializeApiKeyListResult(document.RootElement); |
| | 1094 | | } |
| 0 | 1095 | | return Response.FromValue(value, message.Response); |
| | 1096 | | } |
| | 1097 | | default: |
| 0 | 1098 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 1099 | | } |
| 0 | 1100 | | } |
| | 1101 | |
|
| | 1102 | | /// <summary> Lists the access key for the specified configuration store. </summary> |
| | 1103 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 1104 | | /// <param name="resourceGroupName"> The name of the resource group to which the container registry belongs. </p |
| | 1105 | | /// <param name="configStoreName"> The name of the configuration store. </param> |
| | 1106 | | /// <param name="skipToken"> A skip token is used to continue retrieving items after an operation returns a part |
| | 1107 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1108 | | public Response<ApiKeyListResult> ListKeysNextPage(string nextLink, string resourceGroupName, string configStore |
| | 1109 | | { |
| 0 | 1110 | | if (nextLink == null) |
| | 1111 | | { |
| 0 | 1112 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 1113 | | } |
| 0 | 1114 | | if (resourceGroupName == null) |
| | 1115 | | { |
| 0 | 1116 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1117 | | } |
| 0 | 1118 | | if (configStoreName == null) |
| | 1119 | | { |
| 0 | 1120 | | throw new ArgumentNullException(nameof(configStoreName)); |
| | 1121 | | } |
| | 1122 | |
|
| 0 | 1123 | | using var message = CreateListKeysNextPageRequest(nextLink, resourceGroupName, configStoreName, skipToken); |
| 0 | 1124 | | _pipeline.Send(message, cancellationToken); |
| 0 | 1125 | | switch (message.Response.Status) |
| | 1126 | | { |
| | 1127 | | case 200: |
| | 1128 | | { |
| 0 | 1129 | | ApiKeyListResult value = default; |
| 0 | 1130 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 1131 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 1132 | | { |
| 0 | 1133 | | value = null; |
| | 1134 | | } |
| | 1135 | | else |
| | 1136 | | { |
| 0 | 1137 | | value = ApiKeyListResult.DeserializeApiKeyListResult(document.RootElement); |
| | 1138 | | } |
| 0 | 1139 | | return Response.FromValue(value, message.Response); |
| | 1140 | | } |
| | 1141 | | default: |
| 0 | 1142 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 1143 | | } |
| 0 | 1144 | | } |
| | 1145 | | } |
| | 1146 | | } |