| | 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.Resources.Models; |
| | 16 | |
|
| | 17 | | namespace Azure.ResourceManager.Resources |
| | 18 | | { |
| | 19 | | internal partial class ApplicationDefinitionsRestOperations |
| | 20 | | { |
| | 21 | | private string subscriptionId; |
| | 22 | | private Uri endpoint; |
| | 23 | | private ClientDiagnostics _clientDiagnostics; |
| | 24 | | private HttpPipeline _pipeline; |
| | 25 | |
|
| | 26 | | /// <summary> Initializes a new instance of ApplicationDefinitionsRestOperations. </summary> |
| | 27 | | /// <param name="clientDiagnostics"> The handler for diagnostic messaging in the client. </param> |
| | 28 | | /// <param name="pipeline"> The HTTP pipeline for sending and receiving REST requests and responses. </param> |
| | 29 | | /// <param name="subscriptionId"> The ID of the target subscription. </param> |
| | 30 | | /// <param name="endpoint"> server parameter. </param> |
| | 31 | | /// <exception cref="ArgumentNullException"> This occurs when one of the required arguments is null. </exception |
| 0 | 32 | | public ApplicationDefinitionsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string s |
| | 33 | | { |
| 0 | 34 | | if (subscriptionId == null) |
| | 35 | | { |
| 0 | 36 | | throw new ArgumentNullException(nameof(subscriptionId)); |
| | 37 | | } |
| 0 | 38 | | endpoint ??= new Uri("https://management.azure.com"); |
| | 39 | |
|
| 0 | 40 | | this.subscriptionId = subscriptionId; |
| 0 | 41 | | this.endpoint = endpoint; |
| 0 | 42 | | _clientDiagnostics = clientDiagnostics; |
| 0 | 43 | | _pipeline = pipeline; |
| 0 | 44 | | } |
| | 45 | |
|
| | 46 | | internal Core.HttpMessage CreateGetRequest(string resourceGroupName, string applicationDefinitionName) |
| | 47 | | { |
| 0 | 48 | | var message = _pipeline.CreateMessage(); |
| 0 | 49 | | var request = message.Request; |
| 0 | 50 | | request.Method = RequestMethod.Get; |
| 0 | 51 | | var uri = new RawRequestUriBuilder(); |
| 0 | 52 | | uri.Reset(endpoint); |
| 0 | 53 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 54 | | uri.AppendPath(subscriptionId, true); |
| 0 | 55 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 56 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 57 | | uri.AppendPath("/providers/Microsoft.Solutions/applicationDefinitions/", false); |
| 0 | 58 | | uri.AppendPath(applicationDefinitionName, true); |
| 0 | 59 | | uri.AppendQuery("api-version", "2018-06-01", true); |
| 0 | 60 | | request.Uri = uri; |
| 0 | 61 | | return message; |
| | 62 | | } |
| | 63 | |
|
| | 64 | | /// <summary> Gets the managed application definition. </summary> |
| | 65 | | /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param> |
| | 66 | | /// <param name="applicationDefinitionName"> The name of the managed application definition. </param> |
| | 67 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 68 | | public async Task<Response<ApplicationDefinition>> GetAsync(string resourceGroupName, string applicationDefiniti |
| | 69 | | { |
| 0 | 70 | | if (resourceGroupName == null) |
| | 71 | | { |
| 0 | 72 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 73 | | } |
| 0 | 74 | | if (applicationDefinitionName == null) |
| | 75 | | { |
| 0 | 76 | | throw new ArgumentNullException(nameof(applicationDefinitionName)); |
| | 77 | | } |
| | 78 | |
|
| 0 | 79 | | using var message = CreateGetRequest(resourceGroupName, applicationDefinitionName); |
| 0 | 80 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 81 | | switch (message.Response.Status) |
| | 82 | | { |
| | 83 | | case 200: |
| | 84 | | { |
| 0 | 85 | | ApplicationDefinition value = default; |
| 0 | 86 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 87 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 88 | | { |
| 0 | 89 | | value = null; |
| | 90 | | } |
| | 91 | | else |
| | 92 | | { |
| 0 | 93 | | value = ApplicationDefinition.DeserializeApplicationDefinition(document.RootElement); |
| | 94 | | } |
| 0 | 95 | | return Response.FromValue(value, message.Response); |
| | 96 | | } |
| | 97 | | case 404: |
| 0 | 98 | | return Response.FromValue<ApplicationDefinition>(null, message.Response); |
| | 99 | | default: |
| 0 | 100 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 101 | | } |
| 0 | 102 | | } |
| | 103 | |
|
| | 104 | | /// <summary> Gets the managed application definition. </summary> |
| | 105 | | /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param> |
| | 106 | | /// <param name="applicationDefinitionName"> The name of the managed application definition. </param> |
| | 107 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 108 | | public Response<ApplicationDefinition> Get(string resourceGroupName, string applicationDefinitionName, Cancellat |
| | 109 | | { |
| 0 | 110 | | if (resourceGroupName == null) |
| | 111 | | { |
| 0 | 112 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 113 | | } |
| 0 | 114 | | if (applicationDefinitionName == null) |
| | 115 | | { |
| 0 | 116 | | throw new ArgumentNullException(nameof(applicationDefinitionName)); |
| | 117 | | } |
| | 118 | |
|
| 0 | 119 | | using var message = CreateGetRequest(resourceGroupName, applicationDefinitionName); |
| 0 | 120 | | _pipeline.Send(message, cancellationToken); |
| 0 | 121 | | switch (message.Response.Status) |
| | 122 | | { |
| | 123 | | case 200: |
| | 124 | | { |
| 0 | 125 | | ApplicationDefinition value = default; |
| 0 | 126 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 127 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 128 | | { |
| 0 | 129 | | value = null; |
| | 130 | | } |
| | 131 | | else |
| | 132 | | { |
| 0 | 133 | | value = ApplicationDefinition.DeserializeApplicationDefinition(document.RootElement); |
| | 134 | | } |
| 0 | 135 | | return Response.FromValue(value, message.Response); |
| | 136 | | } |
| | 137 | | case 404: |
| 0 | 138 | | return Response.FromValue<ApplicationDefinition>(null, message.Response); |
| | 139 | | default: |
| 0 | 140 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 141 | | } |
| 0 | 142 | | } |
| | 143 | |
|
| | 144 | | internal Core.HttpMessage CreateDeleteRequest(string resourceGroupName, string applicationDefinitionName) |
| | 145 | | { |
| 0 | 146 | | var message = _pipeline.CreateMessage(); |
| 0 | 147 | | var request = message.Request; |
| 0 | 148 | | request.Method = RequestMethod.Delete; |
| 0 | 149 | | var uri = new RawRequestUriBuilder(); |
| 0 | 150 | | uri.Reset(endpoint); |
| 0 | 151 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 152 | | uri.AppendPath(subscriptionId, true); |
| 0 | 153 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 154 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 155 | | uri.AppendPath("/providers/Microsoft.Solutions/applicationDefinitions/", false); |
| 0 | 156 | | uri.AppendPath(applicationDefinitionName, true); |
| 0 | 157 | | uri.AppendQuery("api-version", "2018-06-01", true); |
| 0 | 158 | | request.Uri = uri; |
| 0 | 159 | | return message; |
| | 160 | | } |
| | 161 | |
|
| | 162 | | /// <summary> Deletes the managed application definition. </summary> |
| | 163 | | /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param> |
| | 164 | | /// <param name="applicationDefinitionName"> The name of the managed application definition to delete. </param> |
| | 165 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 166 | | public async Task<Response> DeleteAsync(string resourceGroupName, string applicationDefinitionName, Cancellation |
| | 167 | | { |
| 0 | 168 | | if (resourceGroupName == null) |
| | 169 | | { |
| 0 | 170 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 171 | | } |
| 0 | 172 | | if (applicationDefinitionName == null) |
| | 173 | | { |
| 0 | 174 | | throw new ArgumentNullException(nameof(applicationDefinitionName)); |
| | 175 | | } |
| | 176 | |
|
| 0 | 177 | | using var message = CreateDeleteRequest(resourceGroupName, applicationDefinitionName); |
| 0 | 178 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 179 | | switch (message.Response.Status) |
| | 180 | | { |
| | 181 | | case 200: |
| | 182 | | case 202: |
| | 183 | | case 204: |
| 0 | 184 | | return message.Response; |
| | 185 | | default: |
| 0 | 186 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 187 | | } |
| 0 | 188 | | } |
| | 189 | |
|
| | 190 | | /// <summary> Deletes the managed application definition. </summary> |
| | 191 | | /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param> |
| | 192 | | /// <param name="applicationDefinitionName"> The name of the managed application definition to delete. </param> |
| | 193 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 194 | | public Response Delete(string resourceGroupName, string applicationDefinitionName, CancellationToken cancellatio |
| | 195 | | { |
| 0 | 196 | | if (resourceGroupName == null) |
| | 197 | | { |
| 0 | 198 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 199 | | } |
| 0 | 200 | | if (applicationDefinitionName == null) |
| | 201 | | { |
| 0 | 202 | | throw new ArgumentNullException(nameof(applicationDefinitionName)); |
| | 203 | | } |
| | 204 | |
|
| 0 | 205 | | using var message = CreateDeleteRequest(resourceGroupName, applicationDefinitionName); |
| 0 | 206 | | _pipeline.Send(message, cancellationToken); |
| 0 | 207 | | switch (message.Response.Status) |
| | 208 | | { |
| | 209 | | case 200: |
| | 210 | | case 202: |
| | 211 | | case 204: |
| 0 | 212 | | return message.Response; |
| | 213 | | default: |
| 0 | 214 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 215 | | } |
| 0 | 216 | | } |
| | 217 | |
|
| | 218 | | internal Core.HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string applicationDefinitionName |
| | 219 | | { |
| 0 | 220 | | var message = _pipeline.CreateMessage(); |
| 0 | 221 | | var request = message.Request; |
| 0 | 222 | | request.Method = RequestMethod.Put; |
| 0 | 223 | | var uri = new RawRequestUriBuilder(); |
| 0 | 224 | | uri.Reset(endpoint); |
| 0 | 225 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 226 | | uri.AppendPath(subscriptionId, true); |
| 0 | 227 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 228 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 229 | | uri.AppendPath("/providers/Microsoft.Solutions/applicationDefinitions/", false); |
| 0 | 230 | | uri.AppendPath(applicationDefinitionName, true); |
| 0 | 231 | | uri.AppendQuery("api-version", "2018-06-01", true); |
| 0 | 232 | | request.Uri = uri; |
| 0 | 233 | | request.Headers.Add("Content-Type", "application/json"); |
| 0 | 234 | | var content = new Utf8JsonRequestContent(); |
| 0 | 235 | | content.JsonWriter.WriteObjectValue(parameters); |
| 0 | 236 | | request.Content = content; |
| 0 | 237 | | return message; |
| | 238 | | } |
| | 239 | |
|
| | 240 | | /// <summary> Creates a new managed application definition. </summary> |
| | 241 | | /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param> |
| | 242 | | /// <param name="applicationDefinitionName"> The name of the managed application definition. </param> |
| | 243 | | /// <param name="parameters"> Parameters supplied to the create or update an managed application definition. </p |
| | 244 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 245 | | public async Task<Response> CreateOrUpdateAsync(string resourceGroupName, string applicationDefinitionName, Appl |
| | 246 | | { |
| 0 | 247 | | if (resourceGroupName == null) |
| | 248 | | { |
| 0 | 249 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 250 | | } |
| 0 | 251 | | if (applicationDefinitionName == null) |
| | 252 | | { |
| 0 | 253 | | throw new ArgumentNullException(nameof(applicationDefinitionName)); |
| | 254 | | } |
| 0 | 255 | | if (parameters == null) |
| | 256 | | { |
| 0 | 257 | | throw new ArgumentNullException(nameof(parameters)); |
| | 258 | | } |
| | 259 | |
|
| 0 | 260 | | using var message = CreateCreateOrUpdateRequest(resourceGroupName, applicationDefinitionName, parameters); |
| 0 | 261 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 262 | | switch (message.Response.Status) |
| | 263 | | { |
| | 264 | | case 200: |
| | 265 | | case 201: |
| 0 | 266 | | return message.Response; |
| | 267 | | default: |
| 0 | 268 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 269 | | } |
| 0 | 270 | | } |
| | 271 | |
|
| | 272 | | /// <summary> Creates a new managed application definition. </summary> |
| | 273 | | /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param> |
| | 274 | | /// <param name="applicationDefinitionName"> The name of the managed application definition. </param> |
| | 275 | | /// <param name="parameters"> Parameters supplied to the create or update an managed application definition. </p |
| | 276 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 277 | | public Response CreateOrUpdate(string resourceGroupName, string applicationDefinitionName, ApplicationDefinition |
| | 278 | | { |
| 0 | 279 | | if (resourceGroupName == null) |
| | 280 | | { |
| 0 | 281 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 282 | | } |
| 0 | 283 | | if (applicationDefinitionName == null) |
| | 284 | | { |
| 0 | 285 | | throw new ArgumentNullException(nameof(applicationDefinitionName)); |
| | 286 | | } |
| 0 | 287 | | if (parameters == null) |
| | 288 | | { |
| 0 | 289 | | throw new ArgumentNullException(nameof(parameters)); |
| | 290 | | } |
| | 291 | |
|
| 0 | 292 | | using var message = CreateCreateOrUpdateRequest(resourceGroupName, applicationDefinitionName, parameters); |
| 0 | 293 | | _pipeline.Send(message, cancellationToken); |
| 0 | 294 | | switch (message.Response.Status) |
| | 295 | | { |
| | 296 | | case 200: |
| | 297 | | case 201: |
| 0 | 298 | | return message.Response; |
| | 299 | | default: |
| 0 | 300 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 301 | | } |
| 0 | 302 | | } |
| | 303 | |
|
| | 304 | | internal Core.HttpMessage CreateListByResourceGroupRequest(string resourceGroupName) |
| | 305 | | { |
| 0 | 306 | | var message = _pipeline.CreateMessage(); |
| 0 | 307 | | var request = message.Request; |
| 0 | 308 | | request.Method = RequestMethod.Get; |
| 0 | 309 | | var uri = new RawRequestUriBuilder(); |
| 0 | 310 | | uri.Reset(endpoint); |
| 0 | 311 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 312 | | uri.AppendPath(subscriptionId, true); |
| 0 | 313 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 314 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 315 | | uri.AppendPath("/providers/Microsoft.Solutions/applicationDefinitions", false); |
| 0 | 316 | | uri.AppendQuery("api-version", "2018-06-01", true); |
| 0 | 317 | | request.Uri = uri; |
| 0 | 318 | | return message; |
| | 319 | | } |
| | 320 | |
|
| | 321 | | /// <summary> Lists the managed application definitions in a resource group. </summary> |
| | 322 | | /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param> |
| | 323 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 324 | | public async Task<Response<ApplicationDefinitionListResult>> ListByResourceGroupAsync(string resourceGroupName, |
| | 325 | | { |
| 0 | 326 | | if (resourceGroupName == null) |
| | 327 | | { |
| 0 | 328 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 329 | | } |
| | 330 | |
|
| 0 | 331 | | using var message = CreateListByResourceGroupRequest(resourceGroupName); |
| 0 | 332 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 333 | | switch (message.Response.Status) |
| | 334 | | { |
| | 335 | | case 200: |
| | 336 | | { |
| 0 | 337 | | ApplicationDefinitionListResult value = default; |
| 0 | 338 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 339 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 340 | | { |
| 0 | 341 | | value = null; |
| | 342 | | } |
| | 343 | | else |
| | 344 | | { |
| 0 | 345 | | value = ApplicationDefinitionListResult.DeserializeApplicationDefinitionListResult(document. |
| | 346 | | } |
| 0 | 347 | | return Response.FromValue(value, message.Response); |
| | 348 | | } |
| | 349 | | default: |
| 0 | 350 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 351 | | } |
| 0 | 352 | | } |
| | 353 | |
|
| | 354 | | /// <summary> Lists the managed application definitions in a resource group. </summary> |
| | 355 | | /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param> |
| | 356 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 357 | | public Response<ApplicationDefinitionListResult> ListByResourceGroup(string resourceGroupName, CancellationToken |
| | 358 | | { |
| 0 | 359 | | if (resourceGroupName == null) |
| | 360 | | { |
| 0 | 361 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 362 | | } |
| | 363 | |
|
| 0 | 364 | | using var message = CreateListByResourceGroupRequest(resourceGroupName); |
| 0 | 365 | | _pipeline.Send(message, cancellationToken); |
| 0 | 366 | | switch (message.Response.Status) |
| | 367 | | { |
| | 368 | | case 200: |
| | 369 | | { |
| 0 | 370 | | ApplicationDefinitionListResult value = default; |
| 0 | 371 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 372 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 373 | | { |
| 0 | 374 | | value = null; |
| | 375 | | } |
| | 376 | | else |
| | 377 | | { |
| 0 | 378 | | value = ApplicationDefinitionListResult.DeserializeApplicationDefinitionListResult(document. |
| | 379 | | } |
| 0 | 380 | | return Response.FromValue(value, message.Response); |
| | 381 | | } |
| | 382 | | default: |
| 0 | 383 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 384 | | } |
| 0 | 385 | | } |
| | 386 | |
|
| | 387 | | internal Core.HttpMessage CreateGetByIdRequest(string applicationDefinitionId) |
| | 388 | | { |
| 0 | 389 | | var message = _pipeline.CreateMessage(); |
| 0 | 390 | | var request = message.Request; |
| 0 | 391 | | request.Method = RequestMethod.Get; |
| 0 | 392 | | var uri = new RawRequestUriBuilder(); |
| 0 | 393 | | uri.Reset(endpoint); |
| 0 | 394 | | uri.AppendPath("/", false); |
| 0 | 395 | | uri.AppendPath(applicationDefinitionId, false); |
| 0 | 396 | | uri.AppendQuery("api-version", "2018-06-01", true); |
| 0 | 397 | | request.Uri = uri; |
| 0 | 398 | | return message; |
| | 399 | | } |
| | 400 | |
|
| | 401 | | /// <summary> Gets the managed application definition. </summary> |
| | 402 | | /// <param name="applicationDefinitionId"> The fully qualified ID of the managed application definition, includi |
| | 403 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 404 | | public async Task<Response<ApplicationDefinition>> GetByIdAsync(string applicationDefinitionId, CancellationToke |
| | 405 | | { |
| 0 | 406 | | if (applicationDefinitionId == null) |
| | 407 | | { |
| 0 | 408 | | throw new ArgumentNullException(nameof(applicationDefinitionId)); |
| | 409 | | } |
| | 410 | |
|
| 0 | 411 | | using var message = CreateGetByIdRequest(applicationDefinitionId); |
| 0 | 412 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 413 | | switch (message.Response.Status) |
| | 414 | | { |
| | 415 | | case 200: |
| | 416 | | { |
| 0 | 417 | | ApplicationDefinition value = default; |
| 0 | 418 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 419 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 420 | | { |
| 0 | 421 | | value = null; |
| | 422 | | } |
| | 423 | | else |
| | 424 | | { |
| 0 | 425 | | value = ApplicationDefinition.DeserializeApplicationDefinition(document.RootElement); |
| | 426 | | } |
| 0 | 427 | | return Response.FromValue(value, message.Response); |
| | 428 | | } |
| | 429 | | case 404: |
| 0 | 430 | | return Response.FromValue<ApplicationDefinition>(null, message.Response); |
| | 431 | | default: |
| 0 | 432 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 433 | | } |
| 0 | 434 | | } |
| | 435 | |
|
| | 436 | | /// <summary> Gets the managed application definition. </summary> |
| | 437 | | /// <param name="applicationDefinitionId"> The fully qualified ID of the managed application definition, includi |
| | 438 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 439 | | public Response<ApplicationDefinition> GetById(string applicationDefinitionId, CancellationToken cancellationTok |
| | 440 | | { |
| 0 | 441 | | if (applicationDefinitionId == null) |
| | 442 | | { |
| 0 | 443 | | throw new ArgumentNullException(nameof(applicationDefinitionId)); |
| | 444 | | } |
| | 445 | |
|
| 0 | 446 | | using var message = CreateGetByIdRequest(applicationDefinitionId); |
| 0 | 447 | | _pipeline.Send(message, cancellationToken); |
| 0 | 448 | | switch (message.Response.Status) |
| | 449 | | { |
| | 450 | | case 200: |
| | 451 | | { |
| 0 | 452 | | ApplicationDefinition value = default; |
| 0 | 453 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 454 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 455 | | { |
| 0 | 456 | | value = null; |
| | 457 | | } |
| | 458 | | else |
| | 459 | | { |
| 0 | 460 | | value = ApplicationDefinition.DeserializeApplicationDefinition(document.RootElement); |
| | 461 | | } |
| 0 | 462 | | return Response.FromValue(value, message.Response); |
| | 463 | | } |
| | 464 | | case 404: |
| 0 | 465 | | return Response.FromValue<ApplicationDefinition>(null, message.Response); |
| | 466 | | default: |
| 0 | 467 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 468 | | } |
| 0 | 469 | | } |
| | 470 | |
|
| | 471 | | internal Core.HttpMessage CreateDeleteByIdRequest(string applicationDefinitionId) |
| | 472 | | { |
| 0 | 473 | | var message = _pipeline.CreateMessage(); |
| 0 | 474 | | var request = message.Request; |
| 0 | 475 | | request.Method = RequestMethod.Delete; |
| 0 | 476 | | var uri = new RawRequestUriBuilder(); |
| 0 | 477 | | uri.Reset(endpoint); |
| 0 | 478 | | uri.AppendPath("/", false); |
| 0 | 479 | | uri.AppendPath(applicationDefinitionId, false); |
| 0 | 480 | | uri.AppendQuery("api-version", "2018-06-01", true); |
| 0 | 481 | | request.Uri = uri; |
| 0 | 482 | | return message; |
| | 483 | | } |
| | 484 | |
|
| | 485 | | /// <summary> Deletes the managed application definition. </summary> |
| | 486 | | /// <param name="applicationDefinitionId"> The fully qualified ID of the managed application definition, includi |
| | 487 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 488 | | public async Task<Response> DeleteByIdAsync(string applicationDefinitionId, CancellationToken cancellationToken |
| | 489 | | { |
| 0 | 490 | | if (applicationDefinitionId == null) |
| | 491 | | { |
| 0 | 492 | | throw new ArgumentNullException(nameof(applicationDefinitionId)); |
| | 493 | | } |
| | 494 | |
|
| 0 | 495 | | using var message = CreateDeleteByIdRequest(applicationDefinitionId); |
| 0 | 496 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 497 | | switch (message.Response.Status) |
| | 498 | | { |
| | 499 | | case 200: |
| | 500 | | case 202: |
| | 501 | | case 204: |
| 0 | 502 | | return message.Response; |
| | 503 | | default: |
| 0 | 504 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 505 | | } |
| 0 | 506 | | } |
| | 507 | |
|
| | 508 | | /// <summary> Deletes the managed application definition. </summary> |
| | 509 | | /// <param name="applicationDefinitionId"> The fully qualified ID of the managed application definition, includi |
| | 510 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 511 | | public Response DeleteById(string applicationDefinitionId, CancellationToken cancellationToken = default) |
| | 512 | | { |
| 0 | 513 | | if (applicationDefinitionId == null) |
| | 514 | | { |
| 0 | 515 | | throw new ArgumentNullException(nameof(applicationDefinitionId)); |
| | 516 | | } |
| | 517 | |
|
| 0 | 518 | | using var message = CreateDeleteByIdRequest(applicationDefinitionId); |
| 0 | 519 | | _pipeline.Send(message, cancellationToken); |
| 0 | 520 | | switch (message.Response.Status) |
| | 521 | | { |
| | 522 | | case 200: |
| | 523 | | case 202: |
| | 524 | | case 204: |
| 0 | 525 | | return message.Response; |
| | 526 | | default: |
| 0 | 527 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 528 | | } |
| 0 | 529 | | } |
| | 530 | |
|
| | 531 | | internal Core.HttpMessage CreateCreateOrUpdateByIdRequest(string applicationDefinitionId, ApplicationDefinition |
| | 532 | | { |
| 0 | 533 | | var message = _pipeline.CreateMessage(); |
| 0 | 534 | | var request = message.Request; |
| 0 | 535 | | request.Method = RequestMethod.Put; |
| 0 | 536 | | var uri = new RawRequestUriBuilder(); |
| 0 | 537 | | uri.Reset(endpoint); |
| 0 | 538 | | uri.AppendPath("/", false); |
| 0 | 539 | | uri.AppendPath(applicationDefinitionId, false); |
| 0 | 540 | | uri.AppendQuery("api-version", "2018-06-01", true); |
| 0 | 541 | | request.Uri = uri; |
| 0 | 542 | | request.Headers.Add("Content-Type", "application/json"); |
| 0 | 543 | | var content = new Utf8JsonRequestContent(); |
| 0 | 544 | | content.JsonWriter.WriteObjectValue(parameters); |
| 0 | 545 | | request.Content = content; |
| 0 | 546 | | return message; |
| | 547 | | } |
| | 548 | |
|
| | 549 | | /// <summary> Creates a new managed application definition. </summary> |
| | 550 | | /// <param name="applicationDefinitionId"> The fully qualified ID of the managed application definition, includi |
| | 551 | | /// <param name="parameters"> Parameters supplied to the create or update a managed application definition. </pa |
| | 552 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 553 | | public async Task<Response> CreateOrUpdateByIdAsync(string applicationDefinitionId, ApplicationDefinition parame |
| | 554 | | { |
| 0 | 555 | | if (applicationDefinitionId == null) |
| | 556 | | { |
| 0 | 557 | | throw new ArgumentNullException(nameof(applicationDefinitionId)); |
| | 558 | | } |
| 0 | 559 | | if (parameters == null) |
| | 560 | | { |
| 0 | 561 | | throw new ArgumentNullException(nameof(parameters)); |
| | 562 | | } |
| | 563 | |
|
| 0 | 564 | | using var message = CreateCreateOrUpdateByIdRequest(applicationDefinitionId, parameters); |
| 0 | 565 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 566 | | switch (message.Response.Status) |
| | 567 | | { |
| | 568 | | case 200: |
| | 569 | | case 201: |
| 0 | 570 | | return message.Response; |
| | 571 | | default: |
| 0 | 572 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 573 | | } |
| 0 | 574 | | } |
| | 575 | |
|
| | 576 | | /// <summary> Creates a new managed application definition. </summary> |
| | 577 | | /// <param name="applicationDefinitionId"> The fully qualified ID of the managed application definition, includi |
| | 578 | | /// <param name="parameters"> Parameters supplied to the create or update a managed application definition. </pa |
| | 579 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 580 | | public Response CreateOrUpdateById(string applicationDefinitionId, ApplicationDefinition parameters, Cancellatio |
| | 581 | | { |
| 0 | 582 | | if (applicationDefinitionId == null) |
| | 583 | | { |
| 0 | 584 | | throw new ArgumentNullException(nameof(applicationDefinitionId)); |
| | 585 | | } |
| 0 | 586 | | if (parameters == null) |
| | 587 | | { |
| 0 | 588 | | throw new ArgumentNullException(nameof(parameters)); |
| | 589 | | } |
| | 590 | |
|
| 0 | 591 | | using var message = CreateCreateOrUpdateByIdRequest(applicationDefinitionId, parameters); |
| 0 | 592 | | _pipeline.Send(message, cancellationToken); |
| 0 | 593 | | switch (message.Response.Status) |
| | 594 | | { |
| | 595 | | case 200: |
| | 596 | | case 201: |
| 0 | 597 | | return message.Response; |
| | 598 | | default: |
| 0 | 599 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 600 | | } |
| 0 | 601 | | } |
| | 602 | |
|
| | 603 | | internal Core.HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string resourceGroupName) |
| | 604 | | { |
| 0 | 605 | | var message = _pipeline.CreateMessage(); |
| 0 | 606 | | var request = message.Request; |
| 0 | 607 | | request.Method = RequestMethod.Get; |
| 0 | 608 | | var uri = new RawRequestUriBuilder(); |
| 0 | 609 | | uri.Reset(endpoint); |
| 0 | 610 | | uri.AppendRawNextLink(nextLink, false); |
| 0 | 611 | | request.Uri = uri; |
| 0 | 612 | | return message; |
| | 613 | | } |
| | 614 | |
|
| | 615 | | /// <summary> Lists the managed application definitions in a resource group. </summary> |
| | 616 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 617 | | /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param> |
| | 618 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 619 | | public async Task<Response<ApplicationDefinitionListResult>> ListByResourceGroupNextPageAsync(string nextLink, s |
| | 620 | | { |
| 0 | 621 | | if (nextLink == null) |
| | 622 | | { |
| 0 | 623 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 624 | | } |
| 0 | 625 | | if (resourceGroupName == null) |
| | 626 | | { |
| 0 | 627 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 628 | | } |
| | 629 | |
|
| 0 | 630 | | using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName); |
| 0 | 631 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 632 | | switch (message.Response.Status) |
| | 633 | | { |
| | 634 | | case 200: |
| | 635 | | { |
| 0 | 636 | | ApplicationDefinitionListResult value = default; |
| 0 | 637 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 638 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 639 | | { |
| 0 | 640 | | value = null; |
| | 641 | | } |
| | 642 | | else |
| | 643 | | { |
| 0 | 644 | | value = ApplicationDefinitionListResult.DeserializeApplicationDefinitionListResult(document. |
| | 645 | | } |
| 0 | 646 | | return Response.FromValue(value, message.Response); |
| | 647 | | } |
| | 648 | | default: |
| 0 | 649 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 650 | | } |
| 0 | 651 | | } |
| | 652 | |
|
| | 653 | | /// <summary> Lists the managed application definitions in a resource group. </summary> |
| | 654 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 655 | | /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param> |
| | 656 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 657 | | public Response<ApplicationDefinitionListResult> ListByResourceGroupNextPage(string nextLink, string resourceGro |
| | 658 | | { |
| 0 | 659 | | if (nextLink == null) |
| | 660 | | { |
| 0 | 661 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 662 | | } |
| 0 | 663 | | if (resourceGroupName == null) |
| | 664 | | { |
| 0 | 665 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 666 | | } |
| | 667 | |
|
| 0 | 668 | | using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName); |
| 0 | 669 | | _pipeline.Send(message, cancellationToken); |
| 0 | 670 | | switch (message.Response.Status) |
| | 671 | | { |
| | 672 | | case 200: |
| | 673 | | { |
| 0 | 674 | | ApplicationDefinitionListResult value = default; |
| 0 | 675 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 676 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 677 | | { |
| 0 | 678 | | value = null; |
| | 679 | | } |
| | 680 | | else |
| | 681 | | { |
| 0 | 682 | | value = ApplicationDefinitionListResult.DeserializeApplicationDefinitionListResult(document. |
| | 683 | | } |
| 0 | 684 | | return Response.FromValue(value, message.Response); |
| | 685 | | } |
| | 686 | | default: |
| 0 | 687 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 688 | | } |
| 0 | 689 | | } |
| | 690 | | } |
| | 691 | | } |