From b011cc3719dac3a0f11ac7a8f116ee306ce24b5f Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 8 Dec 2021 04:46:45 +0000 Subject: [PATCH] CodeGen from PR 16973 in Azure/azure-rest-api-specs Merge 1ce8948d9a38b427668a1a82031d35b5ae2aca8c into d90729bbada2b4f784f2737ab4b4e39693a7aab8 --- .../src/Generated/ApplicationOperations.cs | 1346 ++++++++++++++++ .../ApplicationOperationsExtensions.cs | 344 +++++ .../src/Generated/CodePackageOperations.cs | 280 ++++ .../CodePackageOperationsExtensions.cs | 97 ++ .../src/Generated/GatewayOperations.cs | 1347 +++++++++++++++++ .../Generated/GatewayOperationsExtensions.cs | 346 +++++ .../src/Generated/IApplicationOperations.cs | 221 +++ .../src/Generated/ICodePackageOperations.cs | 68 + .../src/Generated/IGatewayOperations.cs | 222 +++ .../src/Generated/INetworkOperations.cs | 220 +++ .../src/Generated/IOperations.cs | 76 + .../src/Generated/ISecretOperations.cs | 220 +++ .../src/Generated/ISecretValueOperations.cs | 220 +++ .../IServiceFabricMeshManagementClient.cs | 124 ++ .../src/Generated/IServiceOperations.cs | 117 ++ .../Generated/IServiceReplicaOperations.cs | 123 ++ .../src/Generated/IVolumeOperations.cs | 220 +++ .../AddRemoveReplicaScalingMechanism.cs | 87 ++ .../Generated/Models/ApplicationProperties.cs | 144 ++ .../Models/ApplicationResourceDescription.cs | 187 +++ .../Models/ApplicationScopedVolume.cs | 76 + ...plicationScopedVolumeCreationParameters.cs | 54 + ...eationParametersServiceFabricVolumeDisk.cs | 76 + .../Models/ApplicationScopedVolumeKind.cs | 24 + .../Generated/Models/AutoScalingMechanism.cs | 36 + .../Models/AutoScalingMechanismKind.cs | 25 + .../src/Generated/Models/AutoScalingMetric.cs | 36 + .../Generated/Models/AutoScalingMetricKind.cs | 24 + .../src/Generated/Models/AutoScalingPolicy.cs | 93 ++ .../Models/AutoScalingResourceMetric.cs | 68 + .../Models/AutoScalingResourceMetricName.cs | 28 + .../Generated/Models/AutoScalingTrigger.cs | 35 + .../Models/AutoScalingTriggerKind.cs | 25 + .../Models/AvailableOperationDisplay.cs | 78 + .../Models/AverageLoadScalingTrigger.cs | 101 ++ ...ternalMonitoringPipelineSinkDescription.cs | 96 ++ .../Models/ContainerCodePackageProperties.cs | 273 ++++ .../src/Generated/Models/ContainerEvent.cs | 91 ++ .../Generated/Models/ContainerInstanceView.cs | 80 + .../src/Generated/Models/ContainerLabel.cs | 77 + .../src/Generated/Models/ContainerLogs.cs | 51 + .../src/Generated/Models/ContainerState.cs | 86 ++ .../Models/DiagnosticsDescription.cs | 74 + .../src/Generated/Models/DiagnosticsRef.cs | 64 + .../Generated/Models/DiagnosticsSinkKind.cs | 29 + .../Models/DiagnosticsSinkProperties.cs | 61 + .../Generated/Models/EndpointProperties.cs | 73 + .../src/Generated/Models/EndpointRef.cs | 51 + .../Generated/Models/EnvironmentVariable.cs | 59 + .../src/Generated/Models/ErrorDetailsModel.cs | 75 + .../src/Generated/Models/ErrorErrorModel.cs | 97 ++ .../src/Generated/Models/ErrorModel.cs | 69 + .../Generated/Models/ErrorModelException.cs | 61 + .../Generated/Models/GatewayDestination.cs | 92 ++ .../src/Generated/Models/GatewayProperties.cs | 160 ++ .../Models/GatewayResourceDescription.cs | 181 +++ .../src/Generated/Models/HeaderMatchType.cs | 21 + .../src/Generated/Models/HealthState.cs | 43 + .../src/Generated/Models/HttpConfig.cs | 100 ++ .../src/Generated/Models/HttpHostConfig.cs | 94 ++ .../src/Generated/Models/HttpRouteConfig.cs | 100 ++ .../Generated/Models/HttpRouteMatchHeader.cs | 83 + .../Generated/Models/HttpRouteMatchPath.cs | 87 ++ .../Generated/Models/HttpRouteMatchRule.cs | 91 ++ .../Models/ImageRegistryCredential.cs | 92 ++ .../InlinedValueSecretResourceProperties.cs | 63 + .../Models/LocalNetworkResourceProperties.cs | 65 + .../Generated/Models/ManagedProxyResource.cs | 78 + .../src/Generated/Models/NetworkKind.cs | 25 + .../src/Generated/Models/NetworkRef.cs | 62 + .../Models/NetworkResourceDescription.cs | 79 + .../Models/NetworkResourceProperties.cs | 75 + .../Models/NetworkResourcePropertiesBase.cs | 47 + .../Generated/Models/OperatingSystemType.cs | 28 + .../src/Generated/Models/OperationResult.cs | 77 + .../src/Generated/Models/Page.cs | 53 + .../Models/ProvisionedResourceProperties.cs | 53 + .../src/Generated/Models/ProxyResource.cs | 51 + .../Models/ReliableCollectionsRef.cs | 82 + .../src/Generated/Models/Resource.cs | 75 + .../src/Generated/Models/ResourceLimits.cs | 63 + .../src/Generated/Models/ResourceRequests.cs | 76 + .../Generated/Models/ResourceRequirements.cs | 82 + .../src/Generated/Models/ResourceStatus.cs | 46 + .../src/Generated/Models/SecretKind.cs | 25 + .../Models/SecretResourceDescription.cs | 79 + .../Models/SecretResourceProperties.cs | 88 ++ .../Models/SecretResourcePropertiesBase.cs | 47 + .../src/Generated/Models/SecretValue.cs | 51 + .../Generated/Models/SecretValueProperties.cs | 51 + .../Models/SecretValueResourceDescription.cs | 87 ++ .../src/Generated/Models/ServiceProperties.cs | 118 ++ .../Models/ServiceReplicaDescription.cs | 80 + .../Models/ServiceReplicaProperties.cs | 117 ++ .../Models/ServiceResourceDescription.cs | 217 +++ .../src/Generated/Models/Setting.cs | 62 + .../src/Generated/Models/SizeTypes.cs | 23 + .../src/Generated/Models/TcpConfig.cs | 93 ++ .../src/Generated/Models/TrackedResource.cs | 84 + .../src/Generated/Models/VolumeProperties.cs | 109 ++ .../src/Generated/Models/VolumeProvider.cs | 24 + .../VolumeProviderParametersAzureFile.cs | 92 ++ .../src/Generated/Models/VolumeReference.cs | 90 ++ .../Models/VolumeResourceDescription.cs | 133 ++ .../src/Generated/NetworkOperations.cs | 1345 ++++++++++++++++ .../Generated/NetworkOperationsExtensions.cs | 342 +++++ .../src/Generated/Operations.cs | 388 +++++ .../src/Generated/OperationsExtensions.cs | 103 ++ ...kInfo_ServiceFabricMeshManagementClient.cs | 36 + .../src/Generated/SecretOperations.cs | 1341 ++++++++++++++++ .../Generated/SecretOperationsExtensions.cs | 334 ++++ .../src/Generated/SecretValueOperations.cs | 1240 +++++++++++++++ .../SecretValueOperationsExtensions.cs | 350 +++++ .../ServiceFabricMeshManagementClient.cs | 429 ++++++ .../src/Generated/ServiceOperations.cs | 617 ++++++++ .../Generated/ServiceOperationsExtensions.cs | 169 +++ .../src/Generated/ServiceReplicaOperations.cs | 638 ++++++++ .../ServiceReplicaOperationsExtensions.cs | 187 +++ .../src/Generated/VolumeOperations.cs | 1341 ++++++++++++++++ .../Generated/VolumeOperationsExtensions.cs | 334 ++++ 120 files changed, 21443 insertions(+) create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/ApplicationOperations.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/ApplicationOperationsExtensions.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/CodePackageOperations.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/CodePackageOperationsExtensions.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/GatewayOperations.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/GatewayOperationsExtensions.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/IApplicationOperations.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/ICodePackageOperations.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/IGatewayOperations.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/INetworkOperations.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/IOperations.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/ISecretOperations.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/ISecretValueOperations.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/IServiceFabricMeshManagementClient.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/IServiceOperations.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/IServiceReplicaOperations.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/IVolumeOperations.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/AddRemoveReplicaScalingMechanism.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ApplicationProperties.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ApplicationResourceDescription.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ApplicationScopedVolume.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ApplicationScopedVolumeCreationParameters.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ApplicationScopedVolumeCreationParametersServiceFabricVolumeDisk.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ApplicationScopedVolumeKind.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/AutoScalingMechanism.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/AutoScalingMechanismKind.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/AutoScalingMetric.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/AutoScalingMetricKind.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/AutoScalingPolicy.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/AutoScalingResourceMetric.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/AutoScalingResourceMetricName.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/AutoScalingTrigger.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/AutoScalingTriggerKind.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/AvailableOperationDisplay.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/AverageLoadScalingTrigger.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/AzureInternalMonitoringPipelineSinkDescription.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ContainerCodePackageProperties.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ContainerEvent.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ContainerInstanceView.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ContainerLabel.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ContainerLogs.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ContainerState.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/DiagnosticsDescription.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/DiagnosticsRef.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/DiagnosticsSinkKind.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/DiagnosticsSinkProperties.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/EndpointProperties.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/EndpointRef.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/EnvironmentVariable.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ErrorDetailsModel.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ErrorErrorModel.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ErrorModel.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ErrorModelException.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/GatewayDestination.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/GatewayProperties.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/GatewayResourceDescription.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/HeaderMatchType.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/HealthState.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/HttpConfig.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/HttpHostConfig.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/HttpRouteConfig.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/HttpRouteMatchHeader.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/HttpRouteMatchPath.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/HttpRouteMatchRule.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ImageRegistryCredential.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/InlinedValueSecretResourceProperties.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/LocalNetworkResourceProperties.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ManagedProxyResource.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/NetworkKind.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/NetworkRef.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/NetworkResourceDescription.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/NetworkResourceProperties.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/NetworkResourcePropertiesBase.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/OperatingSystemType.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/OperationResult.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/Page.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ProvisionedResourceProperties.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ProxyResource.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ReliableCollectionsRef.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/Resource.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ResourceLimits.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ResourceRequests.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ResourceRequirements.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ResourceStatus.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/SecretKind.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/SecretResourceDescription.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/SecretResourceProperties.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/SecretResourcePropertiesBase.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/SecretValue.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/SecretValueProperties.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/SecretValueResourceDescription.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ServiceProperties.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ServiceReplicaDescription.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ServiceReplicaProperties.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ServiceResourceDescription.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/Setting.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/SizeTypes.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/TcpConfig.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/TrackedResource.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/VolumeProperties.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/VolumeProvider.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/VolumeProviderParametersAzureFile.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/VolumeReference.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/VolumeResourceDescription.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/NetworkOperations.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/NetworkOperationsExtensions.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Operations.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/OperationsExtensions.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/SdkInfo_ServiceFabricMeshManagementClient.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/SecretOperations.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/SecretOperationsExtensions.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/SecretValueOperations.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/SecretValueOperationsExtensions.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/ServiceFabricMeshManagementClient.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/ServiceOperations.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/ServiceOperationsExtensions.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/ServiceReplicaOperations.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/ServiceReplicaOperationsExtensions.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/VolumeOperations.cs create mode 100644 sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/VolumeOperationsExtensions.cs diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/ApplicationOperations.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/ApplicationOperations.cs new file mode 100644 index 000000000000..c2617c59da94 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/ApplicationOperations.cs @@ -0,0 +1,1346 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ApplicationOperations operations. + /// + internal partial class ApplicationOperations : IServiceOperations, IApplicationOperations + { + /// + /// Initializes a new instance of the ApplicationOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ApplicationOperations(ServiceFabricMeshManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ServiceFabricMeshManagementClient + /// + public ServiceFabricMeshManagementClient Client { get; private set; } + + /// + /// Creates or updates an application resource. + /// + /// + /// Creates an application resource with the specified name, description and + /// properties. If an application resource with the same name exists, then it + /// is updated with the specified description and properties. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the application. + /// + /// + /// Description for creating a Application resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateWithHttpMessagesAsync(string resourceGroupName, string applicationResourceName, ApplicationResourceDescription applicationResourceDescription, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (applicationResourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "applicationResourceName"); + } + if (applicationResourceDescription == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "applicationResourceDescription"); + } + if (applicationResourceDescription != null) + { + applicationResourceDescription.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("applicationResourceName", applicationResourceName); + tracingParameters.Add("applicationResourceDescription", applicationResourceDescription); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh/applications/{applicationResourceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{applicationResourceName}", applicationResourceName); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(applicationResourceDescription != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(applicationResourceDescription, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201 && (int)_statusCode != 202) + { + var ex = new ErrorModelException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorModel _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets the application resource with the given name. + /// + /// + /// Gets the information about the application resource with the given name. + /// The information include the description and other properties of the + /// application. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the application. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string applicationResourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (applicationResourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "applicationResourceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("applicationResourceName", applicationResourceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh/applications/{applicationResourceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{applicationResourceName}", applicationResourceName); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorModelException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorModel _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes the application resource. + /// + /// + /// Deletes the application resource identified by the name. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the application. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string applicationResourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (applicationResourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "applicationResourceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("applicationResourceName", applicationResourceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh/applications/{applicationResourceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{applicationResourceName}", applicationResourceName); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorModelException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorModel _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets all the application resources in a given resource group. + /// + /// + /// Gets the information about all application resources in a given resource + /// group. The information include the description and other properties of the + /// Application. + /// + /// + /// Azure resource group name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh/applications").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorModelException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorModel _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets all the application resources in a given subscription. + /// + /// + /// Gets the information about all application resources in a given resource + /// group. The information include the description and other properties of the + /// application. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabricMesh/applications").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorModelException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorModel _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets all the application resources in a given resource group. + /// + /// + /// Gets the information about all application resources in a given resource + /// group. The information include the description and other properties of the + /// Application. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorModelException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorModel _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets all the application resources in a given subscription. + /// + /// + /// Gets the information about all application resources in a given resource + /// group. The information include the description and other properties of the + /// application. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListBySubscriptionNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorModelException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorModel _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/ApplicationOperationsExtensions.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/ApplicationOperationsExtensions.cs new file mode 100644 index 000000000000..2af4145e343c --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/ApplicationOperationsExtensions.cs @@ -0,0 +1,344 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ApplicationOperations. + /// + public static partial class ApplicationOperationsExtensions + { + /// + /// Creates or updates an application resource. + /// + /// + /// Creates an application resource with the specified name, description and + /// properties. If an application resource with the same name exists, then it + /// is updated with the specified description and properties. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the application. + /// + /// + /// Description for creating a Application resource. + /// + public static ApplicationResourceDescription Create(this IApplicationOperations operations, string resourceGroupName, string applicationResourceName, ApplicationResourceDescription applicationResourceDescription) + { + return operations.CreateAsync(resourceGroupName, applicationResourceName, applicationResourceDescription).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates an application resource. + /// + /// + /// Creates an application resource with the specified name, description and + /// properties. If an application resource with the same name exists, then it + /// is updated with the specified description and properties. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the application. + /// + /// + /// Description for creating a Application resource. + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IApplicationOperations operations, string resourceGroupName, string applicationResourceName, ApplicationResourceDescription applicationResourceDescription, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, applicationResourceName, applicationResourceDescription, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the application resource with the given name. + /// + /// + /// Gets the information about the application resource with the given name. + /// The information include the description and other properties of the + /// application. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the application. + /// + public static ApplicationResourceDescription Get(this IApplicationOperations operations, string resourceGroupName, string applicationResourceName) + { + return operations.GetAsync(resourceGroupName, applicationResourceName).GetAwaiter().GetResult(); + } + + /// + /// Gets the application resource with the given name. + /// + /// + /// Gets the information about the application resource with the given name. + /// The information include the description and other properties of the + /// application. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the application. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IApplicationOperations operations, string resourceGroupName, string applicationResourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, applicationResourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the application resource. + /// + /// + /// Deletes the application resource identified by the name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the application. + /// + public static void Delete(this IApplicationOperations operations, string resourceGroupName, string applicationResourceName) + { + operations.DeleteAsync(resourceGroupName, applicationResourceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the application resource. + /// + /// + /// Deletes the application resource identified by the name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the application. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IApplicationOperations operations, string resourceGroupName, string applicationResourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, applicationResourceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets all the application resources in a given resource group. + /// + /// + /// Gets the information about all application resources in a given resource + /// group. The information include the description and other properties of the + /// Application. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group name + /// + public static IPage ListByResourceGroup(this IApplicationOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Gets all the application resources in a given resource group. + /// + /// + /// Gets the information about all application resources in a given resource + /// group. The information include the description and other properties of the + /// Application. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group name + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this IApplicationOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets all the application resources in a given subscription. + /// + /// + /// Gets the information about all application resources in a given resource + /// group. The information include the description and other properties of the + /// application. + /// + /// + /// The operations group for this extension method. + /// + public static IPage ListBySubscription(this IApplicationOperations operations) + { + return operations.ListBySubscriptionAsync().GetAwaiter().GetResult(); + } + + /// + /// Gets all the application resources in a given subscription. + /// + /// + /// Gets the information about all application resources in a given resource + /// group. The information include the description and other properties of the + /// application. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySubscriptionAsync(this IApplicationOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets all the application resources in a given resource group. + /// + /// + /// Gets the information about all application resources in a given resource + /// group. The information include the description and other properties of the + /// Application. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this IApplicationOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets all the application resources in a given resource group. + /// + /// + /// Gets the information about all application resources in a given resource + /// group. The information include the description and other properties of the + /// Application. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupNextAsync(this IApplicationOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets all the application resources in a given subscription. + /// + /// + /// Gets the information about all application resources in a given resource + /// group. The information include the description and other properties of the + /// application. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListBySubscriptionNext(this IApplicationOperations operations, string nextPageLink) + { + return operations.ListBySubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets all the application resources in a given subscription. + /// + /// + /// Gets the information about all application resources in a given resource + /// group. The information include the description and other properties of the + /// application. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySubscriptionNextAsync(this IApplicationOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/CodePackageOperations.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/CodePackageOperations.cs new file mode 100644 index 000000000000..19e2daa688b8 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/CodePackageOperations.cs @@ -0,0 +1,280 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// CodePackageOperations operations. + /// + internal partial class CodePackageOperations : IServiceOperations, ICodePackageOperations + { + /// + /// Initializes a new instance of the CodePackageOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal CodePackageOperations(ServiceFabricMeshManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ServiceFabricMeshManagementClient + /// + public ServiceFabricMeshManagementClient Client { get; private set; } + + /// + /// Gets the logs from the container. + /// + /// + /// Gets the logs for the container of the specified code package of the + /// service replica. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the application. + /// + /// + /// The identity of the service. + /// + /// + /// Service Fabric replica name. + /// + /// + /// The name of code package of the service. + /// + /// + /// Number of lines to show from the end of the logs. Default is 100. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetContainerLogsWithHttpMessagesAsync(string resourceGroupName, string applicationResourceName, string serviceResourceName, string replicaName, string codePackageName, int? tail = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (applicationResourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "applicationResourceName"); + } + if (serviceResourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serviceResourceName"); + } + if (replicaName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "replicaName"); + } + if (codePackageName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "codePackageName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("applicationResourceName", applicationResourceName); + tracingParameters.Add("serviceResourceName", serviceResourceName); + tracingParameters.Add("replicaName", replicaName); + tracingParameters.Add("codePackageName", codePackageName); + tracingParameters.Add("tail", tail); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetContainerLogs", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh/applications/{applicationResourceName}/services/{serviceResourceName}/replicas/{replicaName}/codePackages/{codePackageName}/logs").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{applicationResourceName}", applicationResourceName); + _url = _url.Replace("{serviceResourceName}", serviceResourceName); + _url = _url.Replace("{replicaName}", replicaName); + _url = _url.Replace("{codePackageName}", System.Uri.EscapeDataString(codePackageName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (tail != null) + { + _queryParameters.Add(string.Format("tail={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(tail, Client.SerializationSettings).Trim('"')))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorModelException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorModel _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/CodePackageOperationsExtensions.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/CodePackageOperationsExtensions.cs new file mode 100644 index 000000000000..d7fc7a566fd6 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/CodePackageOperationsExtensions.cs @@ -0,0 +1,97 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for CodePackageOperations. + /// + public static partial class CodePackageOperationsExtensions + { + /// + /// Gets the logs from the container. + /// + /// + /// Gets the logs for the container of the specified code package of the + /// service replica. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the application. + /// + /// + /// The identity of the service. + /// + /// + /// Service Fabric replica name. + /// + /// + /// The name of code package of the service. + /// + /// + /// Number of lines to show from the end of the logs. Default is 100. + /// + public static ContainerLogs GetContainerLogs(this ICodePackageOperations operations, string resourceGroupName, string applicationResourceName, string serviceResourceName, string replicaName, string codePackageName, int? tail = default(int?)) + { + return operations.GetContainerLogsAsync(resourceGroupName, applicationResourceName, serviceResourceName, replicaName, codePackageName, tail).GetAwaiter().GetResult(); + } + + /// + /// Gets the logs from the container. + /// + /// + /// Gets the logs for the container of the specified code package of the + /// service replica. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the application. + /// + /// + /// The identity of the service. + /// + /// + /// Service Fabric replica name. + /// + /// + /// The name of code package of the service. + /// + /// + /// Number of lines to show from the end of the logs. Default is 100. + /// + /// + /// The cancellation token. + /// + public static async Task GetContainerLogsAsync(this ICodePackageOperations operations, string resourceGroupName, string applicationResourceName, string serviceResourceName, string replicaName, string codePackageName, int? tail = default(int?), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetContainerLogsWithHttpMessagesAsync(resourceGroupName, applicationResourceName, serviceResourceName, replicaName, codePackageName, tail, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/GatewayOperations.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/GatewayOperations.cs new file mode 100644 index 000000000000..32d710fd5514 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/GatewayOperations.cs @@ -0,0 +1,1347 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// GatewayOperations operations. + /// + internal partial class GatewayOperations : IServiceOperations, IGatewayOperations + { + /// + /// Initializes a new instance of the GatewayOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal GatewayOperations(ServiceFabricMeshManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ServiceFabricMeshManagementClient + /// + public ServiceFabricMeshManagementClient Client { get; private set; } + + /// + /// Creates or updates a gateway resource. + /// + /// + /// Creates a gateway resource with the specified name, description and + /// properties. If a gateway resource with the same name exists, then it is + /// updated with the specified description and properties. Use gateway + /// resources to create a gateway for public connectivity for services within + /// your application. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the gateway. + /// + /// + /// Description for creating a Gateway resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateWithHttpMessagesAsync(string resourceGroupName, string gatewayResourceName, GatewayResourceDescription gatewayResourceDescription, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (gatewayResourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "gatewayResourceName"); + } + if (gatewayResourceDescription == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "gatewayResourceDescription"); + } + if (gatewayResourceDescription != null) + { + gatewayResourceDescription.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("gatewayResourceName", gatewayResourceName); + tracingParameters.Add("gatewayResourceDescription", gatewayResourceDescription); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh/gateways/{gatewayResourceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{gatewayResourceName}", gatewayResourceName); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(gatewayResourceDescription != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(gatewayResourceDescription, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201 && (int)_statusCode != 202) + { + var ex = new ErrorModelException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorModel _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets the gateway resource with the given name. + /// + /// + /// Gets the information about the gateway resource with the given name. The + /// information include the description and other properties of the gateway. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the gateway. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string gatewayResourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (gatewayResourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "gatewayResourceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("gatewayResourceName", gatewayResourceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh/gateways/{gatewayResourceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{gatewayResourceName}", gatewayResourceName); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorModelException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorModel _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes the gateway resource. + /// + /// + /// Deletes the gateway resource identified by the name. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the gateway. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string gatewayResourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (gatewayResourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "gatewayResourceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("gatewayResourceName", gatewayResourceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh/gateways/{gatewayResourceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{gatewayResourceName}", gatewayResourceName); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorModelException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorModel _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets all the gateway resources in a given resource group. + /// + /// + /// Gets the information about all gateway resources in a given resource group. + /// The information include the description and other properties of the + /// Gateway. + /// + /// + /// Azure resource group name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh/gateways").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorModelException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorModel _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets all the gateway resources in a given subscription. + /// + /// + /// Gets the information about all gateway resources in a given resource group. + /// The information include the description and other properties of the + /// gateway. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabricMesh/gateways").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorModelException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorModel _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets all the gateway resources in a given resource group. + /// + /// + /// Gets the information about all gateway resources in a given resource group. + /// The information include the description and other properties of the + /// Gateway. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorModelException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorModel _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets all the gateway resources in a given subscription. + /// + /// + /// Gets the information about all gateway resources in a given resource group. + /// The information include the description and other properties of the + /// gateway. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListBySubscriptionNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorModelException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorModel _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/GatewayOperationsExtensions.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/GatewayOperationsExtensions.cs new file mode 100644 index 000000000000..dce0a4fc684c --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/GatewayOperationsExtensions.cs @@ -0,0 +1,346 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for GatewayOperations. + /// + public static partial class GatewayOperationsExtensions + { + /// + /// Creates or updates a gateway resource. + /// + /// + /// Creates a gateway resource with the specified name, description and + /// properties. If a gateway resource with the same name exists, then it is + /// updated with the specified description and properties. Use gateway + /// resources to create a gateway for public connectivity for services within + /// your application. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the gateway. + /// + /// + /// Description for creating a Gateway resource. + /// + public static GatewayResourceDescription Create(this IGatewayOperations operations, string resourceGroupName, string gatewayResourceName, GatewayResourceDescription gatewayResourceDescription) + { + return operations.CreateAsync(resourceGroupName, gatewayResourceName, gatewayResourceDescription).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a gateway resource. + /// + /// + /// Creates a gateway resource with the specified name, description and + /// properties. If a gateway resource with the same name exists, then it is + /// updated with the specified description and properties. Use gateway + /// resources to create a gateway for public connectivity for services within + /// your application. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the gateway. + /// + /// + /// Description for creating a Gateway resource. + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IGatewayOperations operations, string resourceGroupName, string gatewayResourceName, GatewayResourceDescription gatewayResourceDescription, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, gatewayResourceName, gatewayResourceDescription, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the gateway resource with the given name. + /// + /// + /// Gets the information about the gateway resource with the given name. The + /// information include the description and other properties of the gateway. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the gateway. + /// + public static GatewayResourceDescription Get(this IGatewayOperations operations, string resourceGroupName, string gatewayResourceName) + { + return operations.GetAsync(resourceGroupName, gatewayResourceName).GetAwaiter().GetResult(); + } + + /// + /// Gets the gateway resource with the given name. + /// + /// + /// Gets the information about the gateway resource with the given name. The + /// information include the description and other properties of the gateway. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the gateway. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IGatewayOperations operations, string resourceGroupName, string gatewayResourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, gatewayResourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the gateway resource. + /// + /// + /// Deletes the gateway resource identified by the name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the gateway. + /// + public static void Delete(this IGatewayOperations operations, string resourceGroupName, string gatewayResourceName) + { + operations.DeleteAsync(resourceGroupName, gatewayResourceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the gateway resource. + /// + /// + /// Deletes the gateway resource identified by the name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the gateway. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IGatewayOperations operations, string resourceGroupName, string gatewayResourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, gatewayResourceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets all the gateway resources in a given resource group. + /// + /// + /// Gets the information about all gateway resources in a given resource group. + /// The information include the description and other properties of the + /// Gateway. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group name + /// + public static IPage ListByResourceGroup(this IGatewayOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Gets all the gateway resources in a given resource group. + /// + /// + /// Gets the information about all gateway resources in a given resource group. + /// The information include the description and other properties of the + /// Gateway. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group name + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this IGatewayOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets all the gateway resources in a given subscription. + /// + /// + /// Gets the information about all gateway resources in a given resource group. + /// The information include the description and other properties of the + /// gateway. + /// + /// + /// The operations group for this extension method. + /// + public static IPage ListBySubscription(this IGatewayOperations operations) + { + return operations.ListBySubscriptionAsync().GetAwaiter().GetResult(); + } + + /// + /// Gets all the gateway resources in a given subscription. + /// + /// + /// Gets the information about all gateway resources in a given resource group. + /// The information include the description and other properties of the + /// gateway. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySubscriptionAsync(this IGatewayOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets all the gateway resources in a given resource group. + /// + /// + /// Gets the information about all gateway resources in a given resource group. + /// The information include the description and other properties of the + /// Gateway. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this IGatewayOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets all the gateway resources in a given resource group. + /// + /// + /// Gets the information about all gateway resources in a given resource group. + /// The information include the description and other properties of the + /// Gateway. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupNextAsync(this IGatewayOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets all the gateway resources in a given subscription. + /// + /// + /// Gets the information about all gateway resources in a given resource group. + /// The information include the description and other properties of the + /// gateway. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListBySubscriptionNext(this IGatewayOperations operations, string nextPageLink) + { + return operations.ListBySubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets all the gateway resources in a given subscription. + /// + /// + /// Gets the information about all gateway resources in a given resource group. + /// The information include the description and other properties of the + /// gateway. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySubscriptionNextAsync(this IGatewayOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/IApplicationOperations.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/IApplicationOperations.cs new file mode 100644 index 000000000000..2b73cc4347a1 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/IApplicationOperations.cs @@ -0,0 +1,221 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ApplicationOperations operations. + /// + public partial interface IApplicationOperations + { + /// + /// Creates or updates an application resource. + /// + /// + /// Creates an application resource with the specified name, + /// description and properties. If an application resource with the + /// same name exists, then it is updated with the specified description + /// and properties. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the application. + /// + /// + /// Description for creating a Application resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateWithHttpMessagesAsync(string resourceGroupName, string applicationResourceName, ApplicationResourceDescription applicationResourceDescription, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the application resource with the given name. + /// + /// + /// Gets the information about the application resource with the given + /// name. The information include the description and other properties + /// of the application. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the application. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string applicationResourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the application resource. + /// + /// + /// Deletes the application resource identified by the name. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the application. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string applicationResourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all the application resources in a given resource group. + /// + /// + /// Gets the information about all application resources in a given + /// resource group. The information include the description and other + /// properties of the Application. + /// + /// + /// Azure resource group name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all the application resources in a given subscription. + /// + /// + /// Gets the information about all application resources in a given + /// resource group. The information include the description and other + /// properties of the application. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all the application resources in a given resource group. + /// + /// + /// Gets the information about all application resources in a given + /// resource group. The information include the description and other + /// properties of the Application. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all the application resources in a given subscription. + /// + /// + /// Gets the information about all application resources in a given + /// resource group. The information include the description and other + /// properties of the application. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/ICodePackageOperations.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/ICodePackageOperations.cs new file mode 100644 index 000000000000..ebff2e5b191c --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/ICodePackageOperations.cs @@ -0,0 +1,68 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// CodePackageOperations operations. + /// + public partial interface ICodePackageOperations + { + /// + /// Gets the logs from the container. + /// + /// + /// Gets the logs for the container of the specified code package of + /// the service replica. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the application. + /// + /// + /// The identity of the service. + /// + /// + /// Service Fabric replica name. + /// + /// + /// The name of code package of the service. + /// + /// + /// Number of lines to show from the end of the logs. Default is 100. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetContainerLogsWithHttpMessagesAsync(string resourceGroupName, string applicationResourceName, string serviceResourceName, string replicaName, string codePackageName, int? tail = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/IGatewayOperations.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/IGatewayOperations.cs new file mode 100644 index 000000000000..90850409d9ae --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/IGatewayOperations.cs @@ -0,0 +1,222 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// GatewayOperations operations. + /// + public partial interface IGatewayOperations + { + /// + /// Creates or updates a gateway resource. + /// + /// + /// Creates a gateway resource with the specified name, description and + /// properties. If a gateway resource with the same name exists, then + /// it is updated with the specified description and properties. Use + /// gateway resources to create a gateway for public connectivity for + /// services within your application. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the gateway. + /// + /// + /// Description for creating a Gateway resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateWithHttpMessagesAsync(string resourceGroupName, string gatewayResourceName, GatewayResourceDescription gatewayResourceDescription, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the gateway resource with the given name. + /// + /// + /// Gets the information about the gateway resource with the given + /// name. The information include the description and other properties + /// of the gateway. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the gateway. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string gatewayResourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the gateway resource. + /// + /// + /// Deletes the gateway resource identified by the name. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the gateway. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string gatewayResourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all the gateway resources in a given resource group. + /// + /// + /// Gets the information about all gateway resources in a given + /// resource group. The information include the description and other + /// properties of the Gateway. + /// + /// + /// Azure resource group name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all the gateway resources in a given subscription. + /// + /// + /// Gets the information about all gateway resources in a given + /// resource group. The information include the description and other + /// properties of the gateway. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all the gateway resources in a given resource group. + /// + /// + /// Gets the information about all gateway resources in a given + /// resource group. The information include the description and other + /// properties of the Gateway. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all the gateway resources in a given subscription. + /// + /// + /// Gets the information about all gateway resources in a given + /// resource group. The information include the description and other + /// properties of the gateway. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/INetworkOperations.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/INetworkOperations.cs new file mode 100644 index 000000000000..4b80529adf5b --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/INetworkOperations.cs @@ -0,0 +1,220 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// NetworkOperations operations. + /// + public partial interface INetworkOperations + { + /// + /// Creates or updates a network resource. + /// + /// + /// Creates a network resource with the specified name, description and + /// properties. If a network resource with the same name exists, then + /// it is updated with the specified description and properties. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the network. + /// + /// + /// Description for creating a Network resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateWithHttpMessagesAsync(string resourceGroupName, string networkResourceName, NetworkResourceDescription networkResourceDescription, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the network resource with the given name. + /// + /// + /// Gets the information about the network resource with the given + /// name. The information include the description and other properties + /// of the network. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the network. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string networkResourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the network resource. + /// + /// + /// Deletes the network resource identified by the name. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the network. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string networkResourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all the network resources in a given resource group. + /// + /// + /// Gets the information about all network resources in a given + /// resource group. The information include the description and other + /// properties of the Network. + /// + /// + /// Azure resource group name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all the network resources in a given subscription. + /// + /// + /// Gets the information about all network resources in a given + /// resource group. The information include the description and other + /// properties of the network. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all the network resources in a given resource group. + /// + /// + /// Gets the information about all network resources in a given + /// resource group. The information include the description and other + /// properties of the Network. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all the network resources in a given subscription. + /// + /// + /// Gets the information about all network resources in a given + /// resource group. The information include the description and other + /// properties of the network. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/IOperations.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/IOperations.cs new file mode 100644 index 000000000000..c624deaae9af --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/IOperations.cs @@ -0,0 +1,76 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Operations operations. + /// + public partial interface IOperations + { + /// + /// Lists all of the available operations. + /// + /// + /// Lists all the available operations provided by Service Fabric + /// SeaBreeze resource provider. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all of the available operations. + /// + /// + /// Lists all the available operations provided by Service Fabric + /// SeaBreeze resource provider. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/ISecretOperations.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/ISecretOperations.cs new file mode 100644 index 000000000000..421bbce0f430 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/ISecretOperations.cs @@ -0,0 +1,220 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SecretOperations operations. + /// + public partial interface ISecretOperations + { + /// + /// Creates or updates a secret resource. + /// + /// + /// Creates a secret resource with the specified name, description and + /// properties. If a secret resource with the same name exists, then it + /// is updated with the specified description and properties. + /// + /// + /// Azure resource group name + /// + /// + /// The name of the secret resource. + /// + /// + /// Description for creating a secret resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateWithHttpMessagesAsync(string resourceGroupName, string secretResourceName, SecretResourceDescription secretResourceDescription, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the secret resource with the given name. + /// + /// + /// Gets the information about the secret resource with the given name. + /// The information include the description and other properties of the + /// secret. + /// + /// + /// Azure resource group name + /// + /// + /// The name of the secret resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string secretResourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the secret resource. + /// + /// + /// Deletes the secret resource identified by the name. + /// + /// + /// Azure resource group name + /// + /// + /// The name of the secret resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string secretResourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all the secret resources in a given resource group. + /// + /// + /// Gets the information about all secret resources in a given resource + /// group. The information include the description and other properties + /// of the Secret. + /// + /// + /// Azure resource group name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all the secret resources in a given subscription. + /// + /// + /// Gets the information about all secret resources in a given resource + /// group. The information include the description and other properties + /// of the secret. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all the secret resources in a given resource group. + /// + /// + /// Gets the information about all secret resources in a given resource + /// group. The information include the description and other properties + /// of the Secret. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all the secret resources in a given subscription. + /// + /// + /// Gets the information about all secret resources in a given resource + /// group. The information include the description and other properties + /// of the secret. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/ISecretValueOperations.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/ISecretValueOperations.cs new file mode 100644 index 000000000000..bd8de0278f4a --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/ISecretValueOperations.cs @@ -0,0 +1,220 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SecretValueOperations operations. + /// + public partial interface ISecretValueOperations + { + /// + /// Adds the specified value as a new version of the specified secret + /// resource. + /// + /// + /// Creates a new value of the specified secret resource. The name of + /// the value is typically the version identifier. Once created the + /// value cannot be changed. + /// + /// + /// Azure resource group name + /// + /// + /// The name of the secret resource. + /// + /// + /// The name of the secret resource value which is typically the + /// version identifier for the value. + /// + /// + /// Description for creating a value of a secret resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateWithHttpMessagesAsync(string resourceGroupName, string secretResourceName, string secretValueResourceName, SecretValueResourceDescription secretValueResourceDescription, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the specified secret value resource. + /// + /// + /// Get the information about the specified named secret value + /// resources. The information does not include the actual value of the + /// secret. + /// + /// + /// Azure resource group name + /// + /// + /// The name of the secret resource. + /// + /// + /// The name of the secret resource value which is typically the + /// version identifier for the value. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string secretResourceName, string secretValueResourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the specified value of the named secret resource. + /// + /// + /// Deletes the secret value resource identified by the name. The name + /// of the resource is typically the version associated with that + /// value. Deletion will fail if the specified value is in use. + /// + /// + /// Azure resource group name + /// + /// + /// The name of the secret resource. + /// + /// + /// The name of the secret resource value which is typically the + /// version identifier for the value. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string secretResourceName, string secretValueResourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List names of all values of the specified secret resource. + /// + /// + /// Gets information about all secret value resources of the specified + /// secret resource. The information includes the names of the secret + /// value resources, but not the actual values. + /// + /// + /// Azure resource group name + /// + /// + /// The name of the secret resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string secretResourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the specified value of the secret resource. + /// + /// + /// Lists the decrypted value of the specified named value of the + /// secret resource. This is a privileged operation. + /// + /// + /// Azure resource group name + /// + /// + /// The name of the secret resource. + /// + /// + /// The name of the secret resource value which is typically the + /// version identifier for the value. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> ListValueWithHttpMessagesAsync(string resourceGroupName, string secretResourceName, string secretValueResourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List names of all values of the specified secret resource. + /// + /// + /// Gets information about all secret value resources of the specified + /// secret resource. The information includes the names of the secret + /// value resources, but not the actual values. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/IServiceFabricMeshManagementClient.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/IServiceFabricMeshManagementClient.cs new file mode 100644 index 000000000000..284d4e81a469 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/IServiceFabricMeshManagementClient.cs @@ -0,0 +1,124 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + + /// + /// Service Fabric Mesh Management Client + /// + public partial interface IServiceFabricMeshManagementClient : System.IDisposable + { + /// + /// The base URI of the service. + /// + System.Uri BaseUri { get; set; } + + /// + /// Gets or sets json serialization settings. + /// + JsonSerializerSettings SerializationSettings { get; } + + /// + /// Gets or sets json deserialization settings. + /// + JsonSerializerSettings DeserializationSettings { get; } + + /// + /// Credentials needed for the client to connect to Azure. + /// + ServiceClientCredentials Credentials { get; } + + /// + /// The version of the API. This parameter is required and its value + /// must be `2018-09-01-preview`. + /// + string ApiVersion { get; } + + /// + /// The customer subscription identifier + /// + string SubscriptionId { get; set; } + + /// + /// The preferred language for the response. + /// + string AcceptLanguage { get; set; } + + /// + /// The retry timeout in seconds for Long Running Operations. Default + /// value is 30. + /// + int? LongRunningOperationRetryTimeout { get; set; } + + /// + /// Whether a unique x-ms-client-request-id should be generated. When + /// set to true a unique x-ms-client-request-id value is generated and + /// included in each request. Default is true. + /// + bool? GenerateClientRequestId { get; set; } + + + /// + /// Gets the IOperations. + /// + IOperations Operations { get; } + + /// + /// Gets the ISecretOperations. + /// + ISecretOperations Secret { get; } + + /// + /// Gets the ISecretValueOperations. + /// + ISecretValueOperations SecretValue { get; } + + /// + /// Gets the IVolumeOperations. + /// + IVolumeOperations Volume { get; } + + /// + /// Gets the INetworkOperations. + /// + INetworkOperations Network { get; } + + /// + /// Gets the IGatewayOperations. + /// + IGatewayOperations Gateway { get; } + + /// + /// Gets the IApplicationOperations. + /// + IApplicationOperations Application { get; } + + /// + /// Gets the IServiceOperations. + /// + IServiceOperations Service { get; } + + /// + /// Gets the IServiceReplicaOperations. + /// + IServiceReplicaOperations ServiceReplica { get; } + + /// + /// Gets the ICodePackageOperations. + /// + ICodePackageOperations CodePackage { get; } + + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/IServiceOperations.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/IServiceOperations.cs new file mode 100644 index 000000000000..270440b884ac --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/IServiceOperations.cs @@ -0,0 +1,117 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ServiceOperations operations. + /// + public partial interface IServiceOperations + { + /// + /// Gets the service resource with the given name. + /// + /// + /// Gets the information about the service resource with the given + /// name. The information include the description and other properties + /// of the service. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the application. + /// + /// + /// The identity of the service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string applicationResourceName, string serviceResourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all the service resources. + /// + /// + /// Gets the information about all services of an application resource. + /// The information include the description and other properties of the + /// Service. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the application. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string applicationResourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all the service resources. + /// + /// + /// Gets the information about all services of an application resource. + /// The information include the description and other properties of the + /// Service. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/IServiceReplicaOperations.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/IServiceReplicaOperations.cs new file mode 100644 index 000000000000..a9326c27ea28 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/IServiceReplicaOperations.cs @@ -0,0 +1,123 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ServiceReplicaOperations operations. + /// + public partial interface IServiceReplicaOperations + { + /// + /// Gets the given replica of the service of an application. + /// + /// + /// Gets the information about the service replica with the given name. + /// The information include the description and other properties of the + /// service replica. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the application. + /// + /// + /// The identity of the service. + /// + /// + /// Service Fabric replica name. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string applicationResourceName, string serviceResourceName, string replicaName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets replicas of a given service. + /// + /// + /// Gets the information about all replicas of a given service of an + /// application. The information includes the runtime properties of the + /// replica instance. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the application. + /// + /// + /// The identity of the service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string applicationResourceName, string serviceResourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets replicas of a given service. + /// + /// + /// Gets the information about all replicas of a given service of an + /// application. The information includes the runtime properties of the + /// replica instance. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/IVolumeOperations.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/IVolumeOperations.cs new file mode 100644 index 000000000000..7ef1e6611190 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/IVolumeOperations.cs @@ -0,0 +1,220 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// VolumeOperations operations. + /// + public partial interface IVolumeOperations + { + /// + /// Creates or updates a volume resource. + /// + /// + /// Creates a volume resource with the specified name, description and + /// properties. If a volume resource with the same name exists, then it + /// is updated with the specified description and properties. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the volume. + /// + /// + /// Description for creating a Volume resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateWithHttpMessagesAsync(string resourceGroupName, string volumeResourceName, VolumeResourceDescription volumeResourceDescription, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the volume resource with the given name. + /// + /// + /// Gets the information about the volume resource with the given name. + /// The information include the description and other properties of the + /// volume. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the volume. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string volumeResourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the volume resource. + /// + /// + /// Deletes the volume resource identified by the name. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the volume. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string volumeResourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all the volume resources in a given resource group. + /// + /// + /// Gets the information about all volume resources in a given resource + /// group. The information include the description and other properties + /// of the Volume. + /// + /// + /// Azure resource group name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all the volume resources in a given subscription. + /// + /// + /// Gets the information about all volume resources in a given resource + /// group. The information include the description and other properties + /// of the volume. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all the volume resources in a given resource group. + /// + /// + /// Gets the information about all volume resources in a given resource + /// group. The information include the description and other properties + /// of the Volume. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all the volume resources in a given subscription. + /// + /// + /// Gets the information about all volume resources in a given resource + /// group. The information include the description and other properties + /// of the volume. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/AddRemoveReplicaScalingMechanism.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/AddRemoveReplicaScalingMechanism.cs new file mode 100644 index 000000000000..c34bec7c5356 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/AddRemoveReplicaScalingMechanism.cs @@ -0,0 +1,87 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes the horizontal auto scaling mechanism that adds or removes + /// replicas (containers or container groups). + /// + [Newtonsoft.Json.JsonObject("AddRemoveReplica")] + public partial class AddRemoveReplicaScalingMechanism : AutoScalingMechanism + { + /// + /// Initializes a new instance of the AddRemoveReplicaScalingMechanism + /// class. + /// + public AddRemoveReplicaScalingMechanism() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AddRemoveReplicaScalingMechanism + /// class. + /// + /// Minimum number of containers (scale down + /// won't be performed below this number). + /// Maximum number of containers (scale up won't + /// be performed above this number). + /// Each time auto scaling is performed, + /// this number of containers will be added or removed. + public AddRemoveReplicaScalingMechanism(int minCount, int maxCount, int scaleIncrement) + { + MinCount = minCount; + MaxCount = maxCount; + ScaleIncrement = scaleIncrement; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets minimum number of containers (scale down won't be + /// performed below this number). + /// + [JsonProperty(PropertyName = "minCount")] + public int MinCount { get; set; } + + /// + /// Gets or sets maximum number of containers (scale up won't be + /// performed above this number). + /// + [JsonProperty(PropertyName = "maxCount")] + public int MaxCount { get; set; } + + /// + /// Gets or sets each time auto scaling is performed, this number of + /// containers will be added or removed. + /// + [JsonProperty(PropertyName = "scaleIncrement")] + public int ScaleIncrement { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + //Nothing to validate + } + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ApplicationProperties.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ApplicationProperties.cs new file mode 100644 index 000000000000..a7bc427c7387 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ApplicationProperties.cs @@ -0,0 +1,144 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes properties of a application resource. + /// + public partial class ApplicationProperties + { + /// + /// Initializes a new instance of the ApplicationProperties class. + /// + public ApplicationProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ApplicationProperties class. + /// + /// User readable description of the + /// application. + /// Describes the services in the application. + /// This property is used to create or modify services of the + /// application. On get only the name of the service is returned. The + /// service description can be obtained by querying for the service + /// resource. + /// Describes the diagnostics definition and + /// usage for an application resource. + /// Internal - used by Visual Studio to setup + /// the debugging session on the local development environment. + /// Names of the services in the + /// application. + /// Status of the application. Possible values + /// include: 'Unknown', 'Ready', 'Upgrading', 'Creating', 'Deleting', + /// 'Failed' + /// Gives additional information about the + /// current status of the application. + /// Describes the health state of an + /// application resource. Possible values include: 'Invalid', 'Ok', + /// 'Warning', 'Error', 'Unknown' + /// When the application's health + /// state is not 'Ok', this additional details from service fabric + /// Health Manager for the user to know why the application is marked + /// unhealthy. + public ApplicationProperties(string description = default(string), IList services = default(IList), DiagnosticsDescription diagnostics = default(DiagnosticsDescription), string debugParams = default(string), IList serviceNames = default(IList), string status = default(string), string statusDetails = default(string), string healthState = default(string), string unhealthyEvaluation = default(string)) + { + Description = description; + Services = services; + Diagnostics = diagnostics; + DebugParams = debugParams; + ServiceNames = serviceNames; + Status = status; + StatusDetails = statusDetails; + HealthState = healthState; + UnhealthyEvaluation = unhealthyEvaluation; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets user readable description of the application. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// Gets or sets describes the services in the application. This + /// property is used to create or modify services of the application. + /// On get only the name of the service is returned. The service + /// description can be obtained by querying for the service resource. + /// + [JsonProperty(PropertyName = "services")] + public IList Services { get; set; } + + /// + /// Gets or sets describes the diagnostics definition and usage for an + /// application resource. + /// + [JsonProperty(PropertyName = "diagnostics")] + public DiagnosticsDescription Diagnostics { get; set; } + + /// + /// Gets or sets internal - used by Visual Studio to setup the + /// debugging session on the local development environment. + /// + [JsonProperty(PropertyName = "debugParams")] + public string DebugParams { get; set; } + + /// + /// Gets names of the services in the application. + /// + [JsonProperty(PropertyName = "serviceNames")] + public IList ServiceNames { get; private set; } + + /// + /// Gets status of the application. Possible values include: 'Unknown', + /// 'Ready', 'Upgrading', 'Creating', 'Deleting', 'Failed' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; private set; } + + /// + /// Gets gives additional information about the current status of the + /// application. + /// + [JsonProperty(PropertyName = "statusDetails")] + public string StatusDetails { get; private set; } + + /// + /// Gets describes the health state of an application resource. + /// Possible values include: 'Invalid', 'Ok', 'Warning', 'Error', + /// 'Unknown' + /// + [JsonProperty(PropertyName = "healthState")] + public string HealthState { get; private set; } + + /// + /// Gets when the application's health state is not 'Ok', this + /// additional details from service fabric Health Manager for the user + /// to know why the application is marked unhealthy. + /// + [JsonProperty(PropertyName = "unhealthyEvaluation")] + public string UnhealthyEvaluation { get; private set; } + + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ApplicationResourceDescription.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ApplicationResourceDescription.cs new file mode 100644 index 000000000000..1e212e819511 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ApplicationResourceDescription.cs @@ -0,0 +1,187 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// This type describes an application resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class ApplicationResourceDescription : TrackedResource + { + /// + /// Initializes a new instance of the ApplicationResourceDescription + /// class. + /// + public ApplicationResourceDescription() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ApplicationResourceDescription + /// class. + /// + /// The geo-location where the resource + /// lives + /// Fully qualified identifier for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// Resource tags. + /// State of the resource. + /// User readable description of the + /// application. + /// Describes the services in the application. + /// This property is used to create or modify services of the + /// application. On get only the name of the service is returned. The + /// service description can be obtained by querying for the service + /// resource. + /// Describes the diagnostics definition and + /// usage for an application resource. + /// Internal - used by Visual Studio to setup + /// the debugging session on the local development environment. + /// Names of the services in the + /// application. + /// Status of the application. Possible values + /// include: 'Unknown', 'Ready', 'Upgrading', 'Creating', 'Deleting', + /// 'Failed' + /// Gives additional information about the + /// current status of the application. + /// Describes the health state of an + /// application resource. Possible values include: 'Invalid', 'Ok', + /// 'Warning', 'Error', 'Unknown' + /// When the application's health + /// state is not 'Ok', this additional details from service fabric + /// Health Manager for the user to know why the application is marked + /// unhealthy. + public ApplicationResourceDescription(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string provisioningState = default(string), string description = default(string), IList services = default(IList), DiagnosticsDescription diagnostics = default(DiagnosticsDescription), string debugParams = default(string), IList serviceNames = default(IList), string status = default(string), string statusDetails = default(string), string healthState = default(string), string unhealthyEvaluation = default(string)) + : base(location, id, name, type, tags) + { + ProvisioningState = provisioningState; + Description = description; + Services = services; + Diagnostics = diagnostics; + DebugParams = debugParams; + ServiceNames = serviceNames; + Status = status; + StatusDetails = statusDetails; + HealthState = healthState; + UnhealthyEvaluation = unhealthyEvaluation; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets state of the resource. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets user readable description of the application. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets or sets describes the services in the application. This + /// property is used to create or modify services of the application. + /// On get only the name of the service is returned. The service + /// description can be obtained by querying for the service resource. + /// + [JsonProperty(PropertyName = "properties.services")] + public IList Services { get; set; } + + /// + /// Gets or sets describes the diagnostics definition and usage for an + /// application resource. + /// + [JsonProperty(PropertyName = "properties.diagnostics")] + public DiagnosticsDescription Diagnostics { get; set; } + + /// + /// Gets or sets internal - used by Visual Studio to setup the + /// debugging session on the local development environment. + /// + [JsonProperty(PropertyName = "properties.debugParams")] + public string DebugParams { get; set; } + + /// + /// Gets names of the services in the application. + /// + [JsonProperty(PropertyName = "properties.serviceNames")] + public IList ServiceNames { get; private set; } + + /// + /// Gets status of the application. Possible values include: 'Unknown', + /// 'Ready', 'Upgrading', 'Creating', 'Deleting', 'Failed' + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; private set; } + + /// + /// Gets gives additional information about the current status of the + /// application. + /// + [JsonProperty(PropertyName = "properties.statusDetails")] + public string StatusDetails { get; private set; } + + /// + /// Gets describes the health state of an application resource. + /// Possible values include: 'Invalid', 'Ok', 'Warning', 'Error', + /// 'Unknown' + /// + [JsonProperty(PropertyName = "properties.healthState")] + public string HealthState { get; private set; } + + /// + /// Gets when the application's health state is not 'Ok', this + /// additional details from service fabric Health Manager for the user + /// to know why the application is marked unhealthy. + /// + [JsonProperty(PropertyName = "properties.unhealthyEvaluation")] + public string UnhealthyEvaluation { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (Services != null) + { + foreach (var element in Services) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ApplicationScopedVolume.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ApplicationScopedVolume.cs new file mode 100644 index 000000000000..d7b7de0bb3af --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ApplicationScopedVolume.cs @@ -0,0 +1,76 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes a volume whose lifetime is scoped to the application's + /// lifetime. + /// + public partial class ApplicationScopedVolume : VolumeReference + { + /// + /// Initializes a new instance of the ApplicationScopedVolume class. + /// + public ApplicationScopedVolume() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ApplicationScopedVolume class. + /// + /// Name of the volume being referenced. + /// The path within the container at + /// which the volume should be mounted. Only valid path characters are + /// allowed. + /// Describes parameters for creating + /// application-scoped volumes. + /// The flag indicating whether the + /// volume is read only. Default is 'false'. + public ApplicationScopedVolume(string name, string destinationPath, ApplicationScopedVolumeCreationParameters creationParameters, bool? readOnlyProperty = default(bool?)) + : base(name, destinationPath, readOnlyProperty) + { + CreationParameters = creationParameters; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets describes parameters for creating application-scoped + /// volumes. + /// + [JsonProperty(PropertyName = "creationParameters")] + public ApplicationScopedVolumeCreationParameters CreationParameters { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (CreationParameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "CreationParameters"); + } + } + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ApplicationScopedVolumeCreationParameters.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ApplicationScopedVolumeCreationParameters.cs new file mode 100644 index 000000000000..b214d8d5db36 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ApplicationScopedVolumeCreationParameters.cs @@ -0,0 +1,54 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes parameters for creating application-scoped volumes. + /// + public partial class ApplicationScopedVolumeCreationParameters + { + /// + /// Initializes a new instance of the + /// ApplicationScopedVolumeCreationParameters class. + /// + public ApplicationScopedVolumeCreationParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ApplicationScopedVolumeCreationParameters class. + /// + /// User readable description of the + /// volume. + public ApplicationScopedVolumeCreationParameters(string description = default(string)) + { + Description = description; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets user readable description of the volume. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ApplicationScopedVolumeCreationParametersServiceFabricVolumeDisk.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ApplicationScopedVolumeCreationParametersServiceFabricVolumeDisk.cs new file mode 100644 index 000000000000..81e62c74204f --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ApplicationScopedVolumeCreationParametersServiceFabricVolumeDisk.cs @@ -0,0 +1,76 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes parameters for creating application-scoped volumes provided + /// by Service Fabric Volume Disks + /// + [Newtonsoft.Json.JsonObject("ServiceFabricVolumeDisk")] + public partial class ApplicationScopedVolumeCreationParametersServiceFabricVolumeDisk : ApplicationScopedVolumeCreationParameters + { + /// + /// Initializes a new instance of the + /// ApplicationScopedVolumeCreationParametersServiceFabricVolumeDisk + /// class. + /// + public ApplicationScopedVolumeCreationParametersServiceFabricVolumeDisk() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ApplicationScopedVolumeCreationParametersServiceFabricVolumeDisk + /// class. + /// + /// Volume size. Possible values include: + /// 'Small', 'Medium', 'Large' + /// User readable description of the + /// volume. + public ApplicationScopedVolumeCreationParametersServiceFabricVolumeDisk(string sizeDisk, string description = default(string)) + : base(description) + { + SizeDisk = sizeDisk; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets volume size. Possible values include: 'Small', + /// 'Medium', 'Large' + /// + [JsonProperty(PropertyName = "sizeDisk")] + public string SizeDisk { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (SizeDisk == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "SizeDisk"); + } + } + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ApplicationScopedVolumeKind.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ApplicationScopedVolumeKind.cs new file mode 100644 index 000000000000..57635140e81b --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ApplicationScopedVolumeKind.cs @@ -0,0 +1,24 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + + /// + /// Defines values for ApplicationScopedVolumeKind. + /// + public static class ApplicationScopedVolumeKind + { + /// + /// Provides Service Fabric High Availability Volume Disk + /// + public const string ServiceFabricVolumeDisk = "ServiceFabricVolumeDisk"; + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/AutoScalingMechanism.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/AutoScalingMechanism.cs new file mode 100644 index 000000000000..2fa546d689e5 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/AutoScalingMechanism.cs @@ -0,0 +1,36 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using System.Linq; + + /// + /// Describes the mechanism for performing auto scaling operation. Derived + /// classes will describe the actual mechanism. + /// + public partial class AutoScalingMechanism + { + /// + /// Initializes a new instance of the AutoScalingMechanism class. + /// + public AutoScalingMechanism() + { + CustomInit(); + } + + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/AutoScalingMechanismKind.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/AutoScalingMechanismKind.cs new file mode 100644 index 000000000000..1c8bd8b291e5 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/AutoScalingMechanismKind.cs @@ -0,0 +1,25 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + + /// + /// Defines values for AutoScalingMechanismKind. + /// + public static class AutoScalingMechanismKind + { + /// + /// Indicates that scaling should be performed by adding or removing + /// replicas. + /// + public const string AddRemoveReplica = "AddRemoveReplica"; + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/AutoScalingMetric.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/AutoScalingMetric.cs new file mode 100644 index 000000000000..efcc2965ec6e --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/AutoScalingMetric.cs @@ -0,0 +1,36 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using System.Linq; + + /// + /// Describes the metric that is used for triggering auto scaling + /// operation. Derived classes will describe resources or metrics. + /// + public partial class AutoScalingMetric + { + /// + /// Initializes a new instance of the AutoScalingMetric class. + /// + public AutoScalingMetric() + { + CustomInit(); + } + + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/AutoScalingMetricKind.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/AutoScalingMetricKind.cs new file mode 100644 index 000000000000..e4679c706da0 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/AutoScalingMetricKind.cs @@ -0,0 +1,24 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + + /// + /// Defines values for AutoScalingMetricKind. + /// + public static class AutoScalingMetricKind + { + /// + /// Indicates that the metric is one of resources, like cpu or memory. + /// + public const string Resource = "Resource"; + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/AutoScalingPolicy.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/AutoScalingPolicy.cs new file mode 100644 index 000000000000..71a61a4edf19 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/AutoScalingPolicy.cs @@ -0,0 +1,93 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes the auto scaling policy + /// + public partial class AutoScalingPolicy + { + /// + /// Initializes a new instance of the AutoScalingPolicy class. + /// + public AutoScalingPolicy() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AutoScalingPolicy class. + /// + /// The name of the auto scaling policy. + /// Determines when auto scaling operation will + /// be invoked. + /// The mechanism that is used to scale when + /// auto scaling operation is invoked. + public AutoScalingPolicy(string name, AutoScalingTrigger trigger, AutoScalingMechanism mechanism) + { + Name = name; + Trigger = trigger; + Mechanism = mechanism; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the auto scaling policy. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets determines when auto scaling operation will be + /// invoked. + /// + [JsonProperty(PropertyName = "trigger")] + public AutoScalingTrigger Trigger { get; set; } + + /// + /// Gets or sets the mechanism that is used to scale when auto scaling + /// operation is invoked. + /// + [JsonProperty(PropertyName = "mechanism")] + public AutoScalingMechanism Mechanism { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (Trigger == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Trigger"); + } + if (Mechanism == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Mechanism"); + } + } + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/AutoScalingResourceMetric.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/AutoScalingResourceMetric.cs new file mode 100644 index 000000000000..e9ea0dbbdc17 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/AutoScalingResourceMetric.cs @@ -0,0 +1,68 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes the resource that is used for triggering auto scaling. + /// + [Newtonsoft.Json.JsonObject("Resource")] + public partial class AutoScalingResourceMetric : AutoScalingMetric + { + /// + /// Initializes a new instance of the AutoScalingResourceMetric class. + /// + public AutoScalingResourceMetric() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AutoScalingResourceMetric class. + /// + /// Name of the resource. Possible values include: + /// 'cpu', 'memoryInGB' + public AutoScalingResourceMetric(string name) + { + Name = name; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets name of the resource. Possible values include: 'cpu', + /// 'memoryInGB' + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + } + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/AutoScalingResourceMetricName.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/AutoScalingResourceMetricName.cs new file mode 100644 index 000000000000..22ce89283f30 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/AutoScalingResourceMetricName.cs @@ -0,0 +1,28 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + + /// + /// Defines values for AutoScalingResourceMetricName. + /// + public static class AutoScalingResourceMetricName + { + /// + /// Indicates that the resource is CPU cores. + /// + public const string Cpu = "cpu"; + /// + /// Indicates that the resource is memory in GB. + /// + public const string MemoryInGB = "memoryInGB"; + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/AutoScalingTrigger.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/AutoScalingTrigger.cs new file mode 100644 index 000000000000..ca4ae2428352 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/AutoScalingTrigger.cs @@ -0,0 +1,35 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using System.Linq; + + /// + /// Describes the trigger for performing auto scaling operation. + /// + public partial class AutoScalingTrigger + { + /// + /// Initializes a new instance of the AutoScalingTrigger class. + /// + public AutoScalingTrigger() + { + CustomInit(); + } + + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/AutoScalingTriggerKind.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/AutoScalingTriggerKind.cs new file mode 100644 index 000000000000..9d621119bbd1 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/AutoScalingTriggerKind.cs @@ -0,0 +1,25 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + + /// + /// Defines values for AutoScalingTriggerKind. + /// + public static class AutoScalingTriggerKind + { + /// + /// Indicates that scaling should be performed based on average load of + /// all replicas in the service. + /// + public const string AverageLoad = "AverageLoad"; + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/AvailableOperationDisplay.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/AvailableOperationDisplay.cs new file mode 100644 index 000000000000..9280dede73d9 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/AvailableOperationDisplay.cs @@ -0,0 +1,78 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// An operation available at the listed Azure resource provider. + /// + public partial class AvailableOperationDisplay + { + /// + /// Initializes a new instance of the AvailableOperationDisplay class. + /// + public AvailableOperationDisplay() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AvailableOperationDisplay class. + /// + /// Name of the operation provider. + /// Name of the resource on which the operation + /// is available. + /// Name of the available operation. + /// Description of the available + /// operation. + public AvailableOperationDisplay(string provider = default(string), string resource = default(string), string operation = default(string), string description = default(string)) + { + Provider = provider; + Resource = resource; + Operation = operation; + Description = description; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets name of the operation provider. + /// + [JsonProperty(PropertyName = "provider")] + public string Provider { get; set; } + + /// + /// Gets or sets name of the resource on which the operation is + /// available. + /// + [JsonProperty(PropertyName = "resource")] + public string Resource { get; set; } + + /// + /// Gets or sets name of the available operation. + /// + [JsonProperty(PropertyName = "operation")] + public string Operation { get; set; } + + /// + /// Gets or sets description of the available operation. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/AverageLoadScalingTrigger.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/AverageLoadScalingTrigger.cs new file mode 100644 index 000000000000..2926e232afe5 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/AverageLoadScalingTrigger.cs @@ -0,0 +1,101 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes the average load trigger used for auto scaling. + /// + [Newtonsoft.Json.JsonObject("AverageLoad")] + public partial class AverageLoadScalingTrigger : AutoScalingTrigger + { + /// + /// Initializes a new instance of the AverageLoadScalingTrigger class. + /// + public AverageLoadScalingTrigger() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AverageLoadScalingTrigger class. + /// + /// Description of the metric that is used for + /// scaling. + /// Lower load threshold (if average + /// load is below this threshold, service will scale down). + /// Upper load threshold (if average + /// load is above this threshold, service will scale up). + /// Scale interval that indicates + /// how often will this trigger be checked. + public AverageLoadScalingTrigger(AutoScalingMetric metric, double lowerLoadThreshold, double upperLoadThreshold, int scaleIntervalInSeconds) + { + Metric = metric; + LowerLoadThreshold = lowerLoadThreshold; + UpperLoadThreshold = upperLoadThreshold; + ScaleIntervalInSeconds = scaleIntervalInSeconds; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets description of the metric that is used for scaling. + /// + [JsonProperty(PropertyName = "metric")] + public AutoScalingMetric Metric { get; set; } + + /// + /// Gets or sets lower load threshold (if average load is below this + /// threshold, service will scale down). + /// + [JsonProperty(PropertyName = "lowerLoadThreshold")] + public double LowerLoadThreshold { get; set; } + + /// + /// Gets or sets upper load threshold (if average load is above this + /// threshold, service will scale up). + /// + [JsonProperty(PropertyName = "upperLoadThreshold")] + public double UpperLoadThreshold { get; set; } + + /// + /// Gets or sets scale interval that indicates how often will this + /// trigger be checked. + /// + [JsonProperty(PropertyName = "scaleIntervalInSeconds")] + public int ScaleIntervalInSeconds { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Metric == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Metric"); + } + if (ScaleIntervalInSeconds < 60) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "ScaleIntervalInSeconds", 60); + } + } + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/AzureInternalMonitoringPipelineSinkDescription.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/AzureInternalMonitoringPipelineSinkDescription.cs new file mode 100644 index 000000000000..8e72a91e77f0 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/AzureInternalMonitoringPipelineSinkDescription.cs @@ -0,0 +1,96 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Diagnostics settings for Geneva. + /// + [Newtonsoft.Json.JsonObject("AzureInternalMonitoringPipeline")] + public partial class AzureInternalMonitoringPipelineSinkDescription : DiagnosticsSinkProperties + { + /// + /// Initializes a new instance of the + /// AzureInternalMonitoringPipelineSinkDescription class. + /// + public AzureInternalMonitoringPipelineSinkDescription() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// AzureInternalMonitoringPipelineSinkDescription class. + /// + /// Name of the sink. This value is referenced by + /// DiagnosticsReferenceDescription + /// A description of the sink. + /// Azure Internal monitoring pipeline + /// account. + /// Azure Internal monitoring pipeline + /// account namespace. + /// Azure Internal monitoring agent + /// configuration. + /// Azure Internal monitoring agent + /// fluentd configuration. + /// Azure Internal monitoring pipeline + /// autokey associated with the certificate. + public AzureInternalMonitoringPipelineSinkDescription(string name = default(string), string description = default(string), string accountName = default(string), string namespaceProperty = default(string), string maConfigUrl = default(string), object fluentdConfigUrl = default(object), string autoKeyConfigUrl = default(string)) + : base(name, description) + { + AccountName = accountName; + NamespaceProperty = namespaceProperty; + MaConfigUrl = maConfigUrl; + FluentdConfigUrl = fluentdConfigUrl; + AutoKeyConfigUrl = autoKeyConfigUrl; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets azure Internal monitoring pipeline account. + /// + [JsonProperty(PropertyName = "accountName")] + public string AccountName { get; set; } + + /// + /// Gets or sets azure Internal monitoring pipeline account namespace. + /// + [JsonProperty(PropertyName = "namespace")] + public string NamespaceProperty { get; set; } + + /// + /// Gets or sets azure Internal monitoring agent configuration. + /// + [JsonProperty(PropertyName = "maConfigUrl")] + public string MaConfigUrl { get; set; } + + /// + /// Gets or sets azure Internal monitoring agent fluentd configuration. + /// + [JsonProperty(PropertyName = "fluentdConfigUrl")] + public object FluentdConfigUrl { get; set; } + + /// + /// Gets or sets azure Internal monitoring pipeline autokey associated + /// with the certificate. + /// + [JsonProperty(PropertyName = "autoKeyConfigUrl")] + public string AutoKeyConfigUrl { get; set; } + + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ContainerCodePackageProperties.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ContainerCodePackageProperties.cs new file mode 100644 index 000000000000..7b2bf1e2c878 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ContainerCodePackageProperties.cs @@ -0,0 +1,273 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a container and its runtime properties. + /// + public partial class ContainerCodePackageProperties + { + /// + /// Initializes a new instance of the ContainerCodePackageProperties + /// class. + /// + public ContainerCodePackageProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ContainerCodePackageProperties + /// class. + /// + /// The name of the code package. + /// The Container image to use. + /// The resources required by this + /// container. + /// Image registry + /// credential. + /// Override for the default entry point in + /// the container. + /// Command array to execute within the + /// container in exec form. + /// The environment variables to set + /// in this container + /// The settings to set in this container. The + /// setting file path can be fetched from environment variable + /// "Fabric_SettingPath". The path for Windows container is + /// "C:\\secrets". The path for Linux container is + /// "/var/secrets". + /// The labels to set in this container. + /// The endpoints exposed by this + /// container. + /// Volumes to be attached to the container. + /// The lifetime of these volumes is independent of the application's + /// lifetime. + /// Volumes to be attached to the container. The + /// lifetime of these volumes is scoped to the application's + /// lifetime. + /// Reference to sinks in + /// DiagnosticsDescription. + /// A list of ReliableCollection + /// resources used by this particular code package. Please refer to + /// ReliableCollectionsRef for more details. + /// Runtime information of a container + /// instance. + public ContainerCodePackageProperties(string name, string image, ResourceRequirements resources, ImageRegistryCredential imageRegistryCredential = default(ImageRegistryCredential), string entrypoint = default(string), IList commands = default(IList), IList environmentVariables = default(IList), IList settings = default(IList), IList labels = default(IList), IList endpoints = default(IList), IList volumeRefs = default(IList), IList volumes = default(IList), DiagnosticsRef diagnostics = default(DiagnosticsRef), IList reliableCollectionsRefs = default(IList), ContainerInstanceView instanceView = default(ContainerInstanceView)) + { + Name = name; + Image = image; + ImageRegistryCredential = imageRegistryCredential; + Entrypoint = entrypoint; + Commands = commands; + EnvironmentVariables = environmentVariables; + Settings = settings; + Labels = labels; + Endpoints = endpoints; + Resources = resources; + VolumeRefs = volumeRefs; + Volumes = volumes; + Diagnostics = diagnostics; + ReliableCollectionsRefs = reliableCollectionsRefs; + InstanceView = instanceView; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the code package. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the Container image to use. + /// + [JsonProperty(PropertyName = "image")] + public string Image { get; set; } + + /// + /// Gets or sets image registry credential. + /// + [JsonProperty(PropertyName = "imageRegistryCredential")] + public ImageRegistryCredential ImageRegistryCredential { get; set; } + + /// + /// Gets or sets override for the default entry point in the container. + /// + [JsonProperty(PropertyName = "entrypoint")] + public string Entrypoint { get; set; } + + /// + /// Gets or sets command array to execute within the container in exec + /// form. + /// + [JsonProperty(PropertyName = "commands")] + public IList Commands { get; set; } + + /// + /// Gets or sets the environment variables to set in this container + /// + [JsonProperty(PropertyName = "environmentVariables")] + public IList EnvironmentVariables { get; set; } + + /// + /// Gets or sets the settings to set in this container. The setting + /// file path can be fetched from environment variable + /// "Fabric_SettingPath". The path for Windows container is + /// "C:\\secrets". The path for Linux container is "/var/secrets". + /// + [JsonProperty(PropertyName = "settings")] + public IList Settings { get; set; } + + /// + /// Gets or sets the labels to set in this container. + /// + [JsonProperty(PropertyName = "labels")] + public IList Labels { get; set; } + + /// + /// Gets or sets the endpoints exposed by this container. + /// + [JsonProperty(PropertyName = "endpoints")] + public IList Endpoints { get; set; } + + /// + /// Gets or sets the resources required by this container. + /// + [JsonProperty(PropertyName = "resources")] + public ResourceRequirements Resources { get; set; } + + /// + /// Gets or sets volumes to be attached to the container. The lifetime + /// of these volumes is independent of the application's lifetime. + /// + [JsonProperty(PropertyName = "volumeRefs")] + public IList VolumeRefs { get; set; } + + /// + /// Gets or sets volumes to be attached to the container. The lifetime + /// of these volumes is scoped to the application's lifetime. + /// + [JsonProperty(PropertyName = "volumes")] + public IList Volumes { get; set; } + + /// + /// Gets or sets reference to sinks in DiagnosticsDescription. + /// + [JsonProperty(PropertyName = "diagnostics")] + public DiagnosticsRef Diagnostics { get; set; } + + /// + /// Gets or sets a list of ReliableCollection resources used by this + /// particular code package. Please refer to ReliableCollectionsRef for + /// more details. + /// + [JsonProperty(PropertyName = "reliableCollectionsRefs")] + public IList ReliableCollectionsRefs { get; set; } + + /// + /// Gets runtime information of a container instance. + /// + [JsonProperty(PropertyName = "instanceView")] + public ContainerInstanceView InstanceView { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (Image == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Image"); + } + if (Resources == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Resources"); + } + if (ImageRegistryCredential != null) + { + ImageRegistryCredential.Validate(); + } + if (Labels != null) + { + foreach (var element in Labels) + { + if (element != null) + { + element.Validate(); + } + } + } + if (Endpoints != null) + { + foreach (var element1 in Endpoints) + { + if (element1 != null) + { + element1.Validate(); + } + } + } + if (Resources != null) + { + Resources.Validate(); + } + if (VolumeRefs != null) + { + foreach (var element2 in VolumeRefs) + { + if (element2 != null) + { + element2.Validate(); + } + } + } + if (Volumes != null) + { + foreach (var element3 in Volumes) + { + if (element3 != null) + { + element3.Validate(); + } + } + } + if (ReliableCollectionsRefs != null) + { + foreach (var element4 in ReliableCollectionsRefs) + { + if (element4 != null) + { + element4.Validate(); + } + } + } + } + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ContainerEvent.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ContainerEvent.cs new file mode 100644 index 000000000000..4c8ce5e82690 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ContainerEvent.cs @@ -0,0 +1,91 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// A container event. + /// + public partial class ContainerEvent + { + /// + /// Initializes a new instance of the ContainerEvent class. + /// + public ContainerEvent() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ContainerEvent class. + /// + /// The name of the container event. + /// The count of the event. + /// Date/time of the first event. + /// Date/time of the last event. + /// The event message + /// The event type. + public ContainerEvent(string name = default(string), int? count = default(int?), string firstTimestamp = default(string), string lastTimestamp = default(string), string message = default(string), string type = default(string)) + { + Name = name; + Count = count; + FirstTimestamp = firstTimestamp; + LastTimestamp = lastTimestamp; + Message = message; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the container event. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the count of the event. + /// + [JsonProperty(PropertyName = "count")] + public int? Count { get; set; } + + /// + /// Gets or sets date/time of the first event. + /// + [JsonProperty(PropertyName = "firstTimestamp")] + public string FirstTimestamp { get; set; } + + /// + /// Gets or sets date/time of the last event. + /// + [JsonProperty(PropertyName = "lastTimestamp")] + public string LastTimestamp { get; set; } + + /// + /// Gets or sets the event message + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + /// + /// Gets or sets the event type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ContainerInstanceView.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ContainerInstanceView.cs new file mode 100644 index 000000000000..757df834f04c --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ContainerInstanceView.cs @@ -0,0 +1,80 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Runtime information of a container instance. + /// + public partial class ContainerInstanceView + { + /// + /// Initializes a new instance of the ContainerInstanceView class. + /// + public ContainerInstanceView() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ContainerInstanceView class. + /// + /// The number of times the container has + /// been restarted. + /// Current container instance + /// state. + /// Previous container instance + /// state. + /// The events of this container instance. + public ContainerInstanceView(int? restartCount = default(int?), ContainerState currentState = default(ContainerState), ContainerState previousState = default(ContainerState), IList events = default(IList)) + { + RestartCount = restartCount; + CurrentState = currentState; + PreviousState = previousState; + Events = events; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the number of times the container has been restarted. + /// + [JsonProperty(PropertyName = "restartCount")] + public int? RestartCount { get; set; } + + /// + /// Gets or sets current container instance state. + /// + [JsonProperty(PropertyName = "currentState")] + public ContainerState CurrentState { get; set; } + + /// + /// Gets or sets previous container instance state. + /// + [JsonProperty(PropertyName = "previousState")] + public ContainerState PreviousState { get; set; } + + /// + /// Gets or sets the events of this container instance. + /// + [JsonProperty(PropertyName = "events")] + public IList Events { get; set; } + + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ContainerLabel.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ContainerLabel.cs new file mode 100644 index 000000000000..0d1b7fa28858 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ContainerLabel.cs @@ -0,0 +1,77 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes a container label. + /// + public partial class ContainerLabel + { + /// + /// Initializes a new instance of the ContainerLabel class. + /// + public ContainerLabel() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ContainerLabel class. + /// + /// The name of the container label. + /// The value of the container label. + public ContainerLabel(string name, string value) + { + Name = name; + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the container label. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the value of the container label. + /// + [JsonProperty(PropertyName = "value")] + public string Value { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (Value == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Value"); + } + } + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ContainerLogs.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ContainerLogs.cs new file mode 100644 index 000000000000..d2db2dcf1f77 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ContainerLogs.cs @@ -0,0 +1,51 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Container logs. + /// + public partial class ContainerLogs + { + /// + /// Initializes a new instance of the ContainerLogs class. + /// + public ContainerLogs() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ContainerLogs class. + /// + /// Container logs. + public ContainerLogs(string content = default(string)) + { + Content = content; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets container logs. + /// + [JsonProperty(PropertyName = "content")] + public string Content { get; set; } + + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ContainerState.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ContainerState.cs new file mode 100644 index 000000000000..d2b6f4036555 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ContainerState.cs @@ -0,0 +1,86 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The container state. + /// + public partial class ContainerState + { + /// + /// Initializes a new instance of the ContainerState class. + /// + public ContainerState() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ContainerState class. + /// + /// The state of this container + /// Date/time when the container state + /// started. + /// The container exit code. + /// Date/time when the container state + /// finished. + /// Human-readable status of this + /// state. + public ContainerState(string state = default(string), System.DateTime? startTime = default(System.DateTime?), string exitCode = default(string), System.DateTime? finishTime = default(System.DateTime?), string detailStatus = default(string)) + { + State = state; + StartTime = startTime; + ExitCode = exitCode; + FinishTime = finishTime; + DetailStatus = detailStatus; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the state of this container + /// + [JsonProperty(PropertyName = "state")] + public string State { get; set; } + + /// + /// Gets or sets date/time when the container state started. + /// + [JsonProperty(PropertyName = "startTime")] + public System.DateTime? StartTime { get; set; } + + /// + /// Gets or sets the container exit code. + /// + [JsonProperty(PropertyName = "exitCode")] + public string ExitCode { get; set; } + + /// + /// Gets or sets date/time when the container state finished. + /// + [JsonProperty(PropertyName = "finishTime")] + public System.DateTime? FinishTime { get; set; } + + /// + /// Gets or sets human-readable status of this state. + /// + [JsonProperty(PropertyName = "detailStatus")] + public string DetailStatus { get; set; } + + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/DiagnosticsDescription.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/DiagnosticsDescription.cs new file mode 100644 index 000000000000..040be5a4f403 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/DiagnosticsDescription.cs @@ -0,0 +1,74 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes the diagnostics options available + /// + public partial class DiagnosticsDescription + { + /// + /// Initializes a new instance of the DiagnosticsDescription class. + /// + public DiagnosticsDescription() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DiagnosticsDescription class. + /// + /// List of supported sinks that can be + /// referenced. + /// Status of whether or not sinks are + /// enabled. + /// The sinks to be used if diagnostics + /// is enabled. Sink choices can be overridden at the service and code + /// package level. + public DiagnosticsDescription(IList sinks = default(IList), bool? enabled = default(bool?), IList defaultSinkRefs = default(IList)) + { + Sinks = sinks; + Enabled = enabled; + DefaultSinkRefs = defaultSinkRefs; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of supported sinks that can be referenced. + /// + [JsonProperty(PropertyName = "sinks")] + public IList Sinks { get; set; } + + /// + /// Gets or sets status of whether or not sinks are enabled. + /// + [JsonProperty(PropertyName = "enabled")] + public bool? Enabled { get; set; } + + /// + /// Gets or sets the sinks to be used if diagnostics is enabled. Sink + /// choices can be overridden at the service and code package level. + /// + [JsonProperty(PropertyName = "defaultSinkRefs")] + public IList DefaultSinkRefs { get; set; } + + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/DiagnosticsRef.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/DiagnosticsRef.cs new file mode 100644 index 000000000000..da3996349ee5 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/DiagnosticsRef.cs @@ -0,0 +1,64 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Reference to sinks in DiagnosticsDescription. + /// + public partial class DiagnosticsRef + { + /// + /// Initializes a new instance of the DiagnosticsRef class. + /// + public DiagnosticsRef() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DiagnosticsRef class. + /// + /// Status of whether or not sinks are + /// enabled. + /// List of sinks to be used if enabled. + /// References the list of sinks in DiagnosticsDescription. + public DiagnosticsRef(bool? enabled = default(bool?), IList sinkRefs = default(IList)) + { + Enabled = enabled; + SinkRefs = sinkRefs; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets status of whether or not sinks are enabled. + /// + [JsonProperty(PropertyName = "enabled")] + public bool? Enabled { get; set; } + + /// + /// Gets or sets list of sinks to be used if enabled. References the + /// list of sinks in DiagnosticsDescription. + /// + [JsonProperty(PropertyName = "sinkRefs")] + public IList SinkRefs { get; set; } + + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/DiagnosticsSinkKind.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/DiagnosticsSinkKind.cs new file mode 100644 index 000000000000..09ad3d988d81 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/DiagnosticsSinkKind.cs @@ -0,0 +1,29 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + + /// + /// Defines values for DiagnosticsSinkKind. + /// + public static class DiagnosticsSinkKind + { + /// + /// Indicates an invalid sink kind. All Service Fabric enumerations + /// have the invalid type. + /// + public const string Invalid = "Invalid"; + /// + /// Diagnostics settings for Geneva. + /// + public const string AzureInternalMonitoringPipeline = "AzureInternalMonitoringPipeline"; + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/DiagnosticsSinkProperties.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/DiagnosticsSinkProperties.cs new file mode 100644 index 000000000000..fcd260e7d93e --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/DiagnosticsSinkProperties.cs @@ -0,0 +1,61 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties of a DiagnosticsSink. + /// + public partial class DiagnosticsSinkProperties + { + /// + /// Initializes a new instance of the DiagnosticsSinkProperties class. + /// + public DiagnosticsSinkProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DiagnosticsSinkProperties class. + /// + /// Name of the sink. This value is referenced by + /// DiagnosticsReferenceDescription + /// A description of the sink. + public DiagnosticsSinkProperties(string name = default(string), string description = default(string)) + { + Name = name; + Description = description; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets name of the sink. This value is referenced by + /// DiagnosticsReferenceDescription + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets a description of the sink. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/EndpointProperties.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/EndpointProperties.cs new file mode 100644 index 000000000000..0aaf44afc92a --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/EndpointProperties.cs @@ -0,0 +1,73 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes a container endpoint. + /// + public partial class EndpointProperties + { + /// + /// Initializes a new instance of the EndpointProperties class. + /// + public EndpointProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EndpointProperties class. + /// + /// The name of the endpoint. + /// Port used by the container. + public EndpointProperties(string name, int? port = default(int?)) + { + Name = name; + Port = port; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the endpoint. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets port used by the container. + /// + [JsonProperty(PropertyName = "port")] + public int? Port { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + } + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/EndpointRef.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/EndpointRef.cs new file mode 100644 index 000000000000..db497c500080 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/EndpointRef.cs @@ -0,0 +1,51 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes a reference to a service endpoint. + /// + public partial class EndpointRef + { + /// + /// Initializes a new instance of the EndpointRef class. + /// + public EndpointRef() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EndpointRef class. + /// + /// Name of the endpoint. + public EndpointRef(string name = default(string)) + { + Name = name; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets name of the endpoint. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/EnvironmentVariable.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/EnvironmentVariable.cs new file mode 100644 index 000000000000..ac9908d83d9c --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/EnvironmentVariable.cs @@ -0,0 +1,59 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes an environment variable for the container. + /// + public partial class EnvironmentVariable + { + /// + /// Initializes a new instance of the EnvironmentVariable class. + /// + public EnvironmentVariable() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EnvironmentVariable class. + /// + /// The name of the environment variable. + /// The value of the environment variable. + public EnvironmentVariable(string name = default(string), string value = default(string)) + { + Name = name; + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the environment variable. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the value of the environment variable. + /// + [JsonProperty(PropertyName = "value")] + public string Value { get; set; } + + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ErrorDetailsModel.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ErrorDetailsModel.cs new file mode 100644 index 000000000000..26aec648b875 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ErrorDetailsModel.cs @@ -0,0 +1,75 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Error model details information + /// + public partial class ErrorDetailsModel + { + /// + /// Initializes a new instance of the ErrorDetailsModel class. + /// + public ErrorDetailsModel() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorDetailsModel class. + /// + /// Error message. + public ErrorDetailsModel(string code, string message) + { + Code = code; + Message = message; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; set; } + + /// + /// Gets or sets error message. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Code == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Code"); + } + if (Message == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Message"); + } + } + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ErrorErrorModel.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ErrorErrorModel.cs new file mode 100644 index 000000000000..b0ec0aa48ffe --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ErrorErrorModel.cs @@ -0,0 +1,97 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Error model information + /// + public partial class ErrorErrorModel + { + /// + /// Initializes a new instance of the ErrorErrorModel class. + /// + public ErrorErrorModel() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorErrorModel class. + /// + /// Error message. + /// List of error message details. + public ErrorErrorModel(string code, string message = default(string), string innerError = default(string), IList details = default(IList)) + { + Code = code; + Message = message; + InnerError = innerError; + Details = details; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; set; } + + /// + /// Gets or sets error message. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + /// + /// + [JsonProperty(PropertyName = "innerError")] + public string InnerError { get; set; } + + /// + /// Gets or sets list of error message details. + /// + [JsonProperty(PropertyName = "details")] + public IList Details { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Code == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Code"); + } + if (Details != null) + { + foreach (var element in Details) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ErrorModel.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ErrorModel.cs new file mode 100644 index 000000000000..197ae228e3d7 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ErrorModel.cs @@ -0,0 +1,69 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The error details. + /// + public partial class ErrorModel + { + /// + /// Initializes a new instance of the ErrorModel class. + /// + public ErrorModel() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorModel class. + /// + /// Error model information + public ErrorModel(ErrorErrorModel error) + { + Error = error; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets error model information + /// + [JsonProperty(PropertyName = "error")] + public ErrorErrorModel Error { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Error == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Error"); + } + if (Error != null) + { + Error.Validate(); + } + } + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ErrorModelException.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ErrorModelException.cs new file mode 100644 index 000000000000..849b1ed326a0 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ErrorModelException.cs @@ -0,0 +1,61 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Microsoft.Rest; + + /// + /// Exception thrown for an invalid response with ErrorModel information. + /// + public partial class ErrorModelException : RestException + { + /// + /// Gets information about the associated HTTP request. + /// + public HttpRequestMessageWrapper Request { get; set; } + + /// + /// Gets information about the associated HTTP response. + /// + public HttpResponseMessageWrapper Response { get; set; } + + /// + /// Gets or sets the body object. + /// + public ErrorModel Body { get; set; } + + /// + /// Initializes a new instance of the ErrorModelException class. + /// + public ErrorModelException() + { + } + + /// + /// Initializes a new instance of the ErrorModelException class. + /// + /// The exception message. + public ErrorModelException(string message) + : this(message, null) + { + } + + /// + /// Initializes a new instance of the ErrorModelException class. + /// + /// The exception message. + /// Inner exception. + public ErrorModelException(string message, System.Exception innerException) + : base(message, innerException) + { + } + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/GatewayDestination.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/GatewayDestination.cs new file mode 100644 index 000000000000..025b38ae787e --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/GatewayDestination.cs @@ -0,0 +1,92 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes destination endpoint for routing traffic. + /// + public partial class GatewayDestination + { + /// + /// Initializes a new instance of the GatewayDestination class. + /// + public GatewayDestination() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GatewayDestination class. + /// + /// Name of the service fabric Mesh + /// application. + /// service that contains the + /// endpoint. + /// name of the endpoint in the + /// service. + public GatewayDestination(string applicationName, string serviceName, string endpointName) + { + ApplicationName = applicationName; + ServiceName = serviceName; + EndpointName = endpointName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets name of the service fabric Mesh application. + /// + [JsonProperty(PropertyName = "applicationName")] + public string ApplicationName { get; set; } + + /// + /// Gets or sets service that contains the endpoint. + /// + [JsonProperty(PropertyName = "serviceName")] + public string ServiceName { get; set; } + + /// + /// Gets or sets name of the endpoint in the service. + /// + [JsonProperty(PropertyName = "endpointName")] + public string EndpointName { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ApplicationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ApplicationName"); + } + if (ServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ServiceName"); + } + if (EndpointName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "EndpointName"); + } + } + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/GatewayProperties.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/GatewayProperties.cs new file mode 100644 index 000000000000..46c60cf99930 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/GatewayProperties.cs @@ -0,0 +1,160 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes properties of a gateway resource. + /// + public partial class GatewayProperties + { + /// + /// Initializes a new instance of the GatewayProperties class. + /// + public GatewayProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GatewayProperties class. + /// + /// Network the gateway should listen on + /// for requests. + /// Network that the Application is + /// using. + /// User readable description of the + /// gateway. + /// Configuration for tcp connectivity for this + /// gateway. + /// Configuration for http connectivity for this + /// gateway. + /// Status of the resource. Possible values + /// include: 'Unknown', 'Ready', 'Upgrading', 'Creating', 'Deleting', + /// 'Failed' + /// Gives additional information about the + /// current status of the gateway. + /// IP address of the gateway. This is + /// populated in the response and is ignored for incoming + /// requests. + public GatewayProperties(NetworkRef sourceNetwork, NetworkRef destinationNetwork, string description = default(string), IList tcp = default(IList), IList http = default(IList), string status = default(string), string statusDetails = default(string), string ipAddress = default(string)) + { + Description = description; + SourceNetwork = sourceNetwork; + DestinationNetwork = destinationNetwork; + Tcp = tcp; + Http = http; + Status = status; + StatusDetails = statusDetails; + IpAddress = ipAddress; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets user readable description of the gateway. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// Gets or sets network the gateway should listen on for requests. + /// + [JsonProperty(PropertyName = "sourceNetwork")] + public NetworkRef SourceNetwork { get; set; } + + /// + /// Gets or sets network that the Application is using. + /// + [JsonProperty(PropertyName = "destinationNetwork")] + public NetworkRef DestinationNetwork { get; set; } + + /// + /// Gets or sets configuration for tcp connectivity for this gateway. + /// + [JsonProperty(PropertyName = "tcp")] + public IList Tcp { get; set; } + + /// + /// Gets or sets configuration for http connectivity for this gateway. + /// + [JsonProperty(PropertyName = "http")] + public IList Http { get; set; } + + /// + /// Gets status of the resource. Possible values include: 'Unknown', + /// 'Ready', 'Upgrading', 'Creating', 'Deleting', 'Failed' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; private set; } + + /// + /// Gets gives additional information about the current status of the + /// gateway. + /// + [JsonProperty(PropertyName = "statusDetails")] + public string StatusDetails { get; private set; } + + /// + /// Gets IP address of the gateway. This is populated in the response + /// and is ignored for incoming requests. + /// + [JsonProperty(PropertyName = "ipAddress")] + public string IpAddress { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (SourceNetwork == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "SourceNetwork"); + } + if (DestinationNetwork == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DestinationNetwork"); + } + if (Tcp != null) + { + foreach (var element in Tcp) + { + if (element != null) + { + element.Validate(); + } + } + } + if (Http != null) + { + foreach (var element1 in Http) + { + if (element1 != null) + { + element1.Validate(); + } + } + } + } + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/GatewayResourceDescription.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/GatewayResourceDescription.cs new file mode 100644 index 000000000000..e903f58e395b --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/GatewayResourceDescription.cs @@ -0,0 +1,181 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// This type describes a gateway resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class GatewayResourceDescription : TrackedResource + { + /// + /// Initializes a new instance of the GatewayResourceDescription class. + /// + public GatewayResourceDescription() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GatewayResourceDescription class. + /// + /// The geo-location where the resource + /// lives + /// Network the gateway should listen on + /// for requests. + /// Network that the Application is + /// using. + /// Fully qualified identifier for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// Resource tags. + /// State of the resource. + /// User readable description of the + /// gateway. + /// Configuration for tcp connectivity for this + /// gateway. + /// Configuration for http connectivity for this + /// gateway. + /// Status of the resource. Possible values + /// include: 'Unknown', 'Ready', 'Upgrading', 'Creating', 'Deleting', + /// 'Failed' + /// Gives additional information about the + /// current status of the gateway. + /// IP address of the gateway. This is + /// populated in the response and is ignored for incoming + /// requests. + public GatewayResourceDescription(string location, NetworkRef sourceNetwork, NetworkRef destinationNetwork, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string provisioningState = default(string), string description = default(string), IList tcp = default(IList), IList http = default(IList), string status = default(string), string statusDetails = default(string), string ipAddress = default(string)) + : base(location, id, name, type, tags) + { + ProvisioningState = provisioningState; + Description = description; + SourceNetwork = sourceNetwork; + DestinationNetwork = destinationNetwork; + Tcp = tcp; + Http = http; + Status = status; + StatusDetails = statusDetails; + IpAddress = ipAddress; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets state of the resource. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets user readable description of the gateway. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets or sets network the gateway should listen on for requests. + /// + [JsonProperty(PropertyName = "properties.sourceNetwork")] + public NetworkRef SourceNetwork { get; set; } + + /// + /// Gets or sets network that the Application is using. + /// + [JsonProperty(PropertyName = "properties.destinationNetwork")] + public NetworkRef DestinationNetwork { get; set; } + + /// + /// Gets or sets configuration for tcp connectivity for this gateway. + /// + [JsonProperty(PropertyName = "properties.tcp")] + public IList Tcp { get; set; } + + /// + /// Gets or sets configuration for http connectivity for this gateway. + /// + [JsonProperty(PropertyName = "properties.http")] + public IList Http { get; set; } + + /// + /// Gets status of the resource. Possible values include: 'Unknown', + /// 'Ready', 'Upgrading', 'Creating', 'Deleting', 'Failed' + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; private set; } + + /// + /// Gets gives additional information about the current status of the + /// gateway. + /// + [JsonProperty(PropertyName = "properties.statusDetails")] + public string StatusDetails { get; private set; } + + /// + /// Gets IP address of the gateway. This is populated in the response + /// and is ignored for incoming requests. + /// + [JsonProperty(PropertyName = "properties.ipAddress")] + public string IpAddress { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (SourceNetwork == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "SourceNetwork"); + } + if (DestinationNetwork == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DestinationNetwork"); + } + if (Tcp != null) + { + foreach (var element in Tcp) + { + if (element != null) + { + element.Validate(); + } + } + } + if (Http != null) + { + foreach (var element1 in Http) + { + if (element1 != null) + { + element1.Validate(); + } + } + } + } + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/HeaderMatchType.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/HeaderMatchType.cs new file mode 100644 index 000000000000..eae0668c116b --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/HeaderMatchType.cs @@ -0,0 +1,21 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + + /// + /// Defines values for HeaderMatchType. + /// + public static class HeaderMatchType + { + public const string Exact = "exact"; + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/HealthState.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/HealthState.cs new file mode 100644 index 000000000000..f7c63f67e32c --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/HealthState.cs @@ -0,0 +1,43 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + + /// + /// Defines values for HealthState. + /// + public static class HealthState + { + /// + /// Indicates an invalid health state. All Service Fabric enumerations + /// have the invalid type. The value is zero. + /// + public const string Invalid = "Invalid"; + /// + /// Indicates the health state is okay. The value is 1. + /// + public const string Ok = "Ok"; + /// + /// Indicates the health state is at a warning level. The value is 2. + /// + public const string Warning = "Warning"; + /// + /// Indicates the health state is at an error level. Error health state + /// should be investigated, as they can impact the correct + /// functionality of the cluster. The value is 3. + /// + public const string Error = "Error"; + /// + /// Indicates an unknown health status. The value is 65535. + /// + public const string Unknown = "Unknown"; + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/HttpConfig.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/HttpConfig.cs new file mode 100644 index 000000000000..13e798b706bc --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/HttpConfig.cs @@ -0,0 +1,100 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes the http configuration for external connectivity for this + /// network. + /// + public partial class HttpConfig + { + /// + /// Initializes a new instance of the HttpConfig class. + /// + public HttpConfig() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the HttpConfig class. + /// + /// http gateway config name. + /// Specifies the port at which the service endpoint + /// below needs to be exposed. + /// description for routing. + public HttpConfig(string name, int port, IList hosts) + { + Name = name; + Port = port; + Hosts = hosts; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets http gateway config name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets specifies the port at which the service endpoint below + /// needs to be exposed. + /// + [JsonProperty(PropertyName = "port")] + public int Port { get; set; } + + /// + /// Gets or sets description for routing. + /// + [JsonProperty(PropertyName = "hosts")] + public IList Hosts { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (Hosts == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Hosts"); + } + if (Hosts != null) + { + foreach (var element in Hosts) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/HttpHostConfig.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/HttpHostConfig.cs new file mode 100644 index 000000000000..fb8ab0a7ea26 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/HttpHostConfig.cs @@ -0,0 +1,94 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes the hostname properties for http routing. + /// + public partial class HttpHostConfig + { + /// + /// Initializes a new instance of the HttpHostConfig class. + /// + public HttpHostConfig() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the HttpHostConfig class. + /// + /// http hostname config name. + /// Route information to use for routing. Routes + /// are processed in the order they are specified. Specify routes that + /// are more specific before routes that can handle general + /// cases. + public HttpHostConfig(string name, IList routes) + { + Name = name; + Routes = routes; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets http hostname config name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets route information to use for routing. Routes are + /// processed in the order they are specified. Specify routes that are + /// more specific before routes that can handle general cases. + /// + [JsonProperty(PropertyName = "routes")] + public IList Routes { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (Routes == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Routes"); + } + if (Routes != null) + { + foreach (var element in Routes) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/HttpRouteConfig.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/HttpRouteConfig.cs new file mode 100644 index 000000000000..aa8e51f7fc97 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/HttpRouteConfig.cs @@ -0,0 +1,100 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes the hostname properties for http routing. + /// + public partial class HttpRouteConfig + { + /// + /// Initializes a new instance of the HttpRouteConfig class. + /// + public HttpRouteConfig() + { + Match = new HttpRouteMatchRule(); + CustomInit(); + } + + /// + /// Initializes a new instance of the HttpRouteConfig class. + /// + /// http route name. + /// Describes a rule for http route + /// matching. + /// Describes destination endpoint for + /// routing traffic. + public HttpRouteConfig(string name, HttpRouteMatchRule match, GatewayDestination destination) + { + Name = name; + Match = match; + Destination = destination; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets http route name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets describes a rule for http route matching. + /// + [JsonProperty(PropertyName = "match")] + public HttpRouteMatchRule Match { get; set; } + + /// + /// Gets or sets describes destination endpoint for routing traffic. + /// + [JsonProperty(PropertyName = "destination")] + public GatewayDestination Destination { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (Match == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Match"); + } + if (Destination == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Destination"); + } + if (Match != null) + { + Match.Validate(); + } + if (Destination != null) + { + Destination.Validate(); + } + } + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/HttpRouteMatchHeader.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/HttpRouteMatchHeader.cs new file mode 100644 index 000000000000..763945cf960e --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/HttpRouteMatchHeader.cs @@ -0,0 +1,83 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes header information for http route matching. + /// + public partial class HttpRouteMatchHeader + { + /// + /// Initializes a new instance of the HttpRouteMatchHeader class. + /// + public HttpRouteMatchHeader() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the HttpRouteMatchHeader class. + /// + /// Name of header to match in request. + /// Value of header to match in request. + /// how to match header value. Possible values + /// include: 'exact' + public HttpRouteMatchHeader(string name, string value = default(string), string type = default(string)) + { + Name = name; + Value = value; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets name of header to match in request. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets value of header to match in request. + /// + [JsonProperty(PropertyName = "value")] + public string Value { get; set; } + + /// + /// Gets or sets how to match header value. Possible values include: + /// 'exact' + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + } + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/HttpRouteMatchPath.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/HttpRouteMatchPath.cs new file mode 100644 index 000000000000..aa6379a8e3a4 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/HttpRouteMatchPath.cs @@ -0,0 +1,87 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Path to match for routing. + /// + public partial class HttpRouteMatchPath + { + /// + /// Initializes a new instance of the HttpRouteMatchPath class. + /// + public HttpRouteMatchPath() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the HttpRouteMatchPath class. + /// + /// Uri path to match for request. + /// replacement string for matched part of the + /// Uri. + public HttpRouteMatchPath(string value, string rewrite = default(string)) + { + Value = value; + Rewrite = rewrite; + CustomInit(); + } + /// + /// Static constructor for HttpRouteMatchPath class. + /// + static HttpRouteMatchPath() + { + Type = "prefix"; + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets uri path to match for request. + /// + [JsonProperty(PropertyName = "value")] + public string Value { get; set; } + + /// + /// Gets or sets replacement string for matched part of the Uri. + /// + [JsonProperty(PropertyName = "rewrite")] + public string Rewrite { get; set; } + + /// + /// how to match value in the Uri + /// + [JsonProperty(PropertyName = "type")] + public static string Type { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Value == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Value"); + } + } + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/HttpRouteMatchRule.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/HttpRouteMatchRule.cs new file mode 100644 index 000000000000..c084655e85fd --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/HttpRouteMatchRule.cs @@ -0,0 +1,91 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a rule for http route matching. + /// + public partial class HttpRouteMatchRule + { + /// + /// Initializes a new instance of the HttpRouteMatchRule class. + /// + public HttpRouteMatchRule() + { + Path = new HttpRouteMatchPath(); + CustomInit(); + } + + /// + /// Initializes a new instance of the HttpRouteMatchRule class. + /// + /// Path to match for routing. + /// headers and their values to match in + /// request. + public HttpRouteMatchRule(HttpRouteMatchPath path, IList headers = default(IList)) + { + Path = path; + Headers = headers; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets path to match for routing. + /// + [JsonProperty(PropertyName = "path")] + public HttpRouteMatchPath Path { get; set; } + + /// + /// Gets or sets headers and their values to match in request. + /// + [JsonProperty(PropertyName = "headers")] + public IList Headers { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Path == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Path"); + } + if (Path != null) + { + Path.Validate(); + } + if (Headers != null) + { + foreach (var element in Headers) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ImageRegistryCredential.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ImageRegistryCredential.cs new file mode 100644 index 000000000000..0a23c91b24af --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ImageRegistryCredential.cs @@ -0,0 +1,92 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Image registry credential. + /// + public partial class ImageRegistryCredential + { + /// + /// Initializes a new instance of the ImageRegistryCredential class. + /// + public ImageRegistryCredential() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ImageRegistryCredential class. + /// + /// Docker image registry server, without protocol + /// such as `http` and `https`. + /// The username for the private + /// registry. + /// The password for the private registry. The + /// password is required for create or update operations, however it is + /// not returned in the get or list operations. + public ImageRegistryCredential(string server, string username, string password = default(string)) + { + Server = server; + Username = username; + Password = password; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets docker image registry server, without protocol such as + /// `http` and `https`. + /// + [JsonProperty(PropertyName = "server")] + public string Server { get; set; } + + /// + /// Gets or sets the username for the private registry. + /// + [JsonProperty(PropertyName = "username")] + public string Username { get; set; } + + /// + /// Gets or sets the password for the private registry. The password is + /// required for create or update operations, however it is not + /// returned in the get or list operations. + /// + [JsonProperty(PropertyName = "password")] + public string Password { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Server == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Server"); + } + if (Username == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Username"); + } + } + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/InlinedValueSecretResourceProperties.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/InlinedValueSecretResourceProperties.cs new file mode 100644 index 000000000000..db1a6456fa57 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/InlinedValueSecretResourceProperties.cs @@ -0,0 +1,63 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes the properties of a secret resource whose value is provided + /// explicitly as plaintext. The secret resource may have multiple values, + /// each being uniquely versioned. The secret value of each version is + /// stored encrypted, and delivered as plaintext into the context of + /// applications referencing it. + /// + [Newtonsoft.Json.JsonObject("inlinedValue")] + public partial class InlinedValueSecretResourceProperties : SecretResourceProperties + { + /// + /// Initializes a new instance of the + /// InlinedValueSecretResourceProperties class. + /// + public InlinedValueSecretResourceProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// InlinedValueSecretResourceProperties class. + /// + /// State of the resource. + /// User readable description of the + /// secret. + /// Status of the resource. Possible values + /// include: 'Unknown', 'Ready', 'Upgrading', 'Creating', 'Deleting', + /// 'Failed' + /// Gives additional information about the + /// current status of the secret. + /// The type of the content stored in the + /// secret value. The value of this property is opaque to Service + /// Fabric. Once set, the value of this property cannot be + /// changed. + public InlinedValueSecretResourceProperties(string provisioningState = default(string), string description = default(string), string status = default(string), string statusDetails = default(string), string contentType = default(string)) + : base(provisioningState, description, status, statusDetails, contentType) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/LocalNetworkResourceProperties.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/LocalNetworkResourceProperties.cs new file mode 100644 index 000000000000..33dc4d3e20f2 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/LocalNetworkResourceProperties.cs @@ -0,0 +1,65 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Information about a Service Fabric container network local to a single + /// Service Fabric cluster. + /// + [Newtonsoft.Json.JsonObject("Local")] + public partial class LocalNetworkResourceProperties : NetworkResourceProperties + { + /// + /// Initializes a new instance of the LocalNetworkResourceProperties + /// class. + /// + public LocalNetworkResourceProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LocalNetworkResourceProperties + /// class. + /// + /// State of the resource. + /// User readable description of the + /// network. + /// Status of the network. Possible values + /// include: 'Unknown', 'Ready', 'Upgrading', 'Creating', 'Deleting', + /// 'Failed' + /// Gives additional information about the + /// current status of the network. + /// Address space for the local + /// container network. + public LocalNetworkResourceProperties(string provisioningState = default(string), string description = default(string), string status = default(string), string statusDetails = default(string), string networkAddressPrefix = default(string)) + : base(provisioningState, description, status, statusDetails) + { + NetworkAddressPrefix = networkAddressPrefix; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets address space for the local container network. + /// + [JsonProperty(PropertyName = "networkAddressPrefix")] + public string NetworkAddressPrefix { get; set; } + + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ManagedProxyResource.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ManagedProxyResource.cs new file mode 100644 index 000000000000..d4e31b428bbb --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ManagedProxyResource.cs @@ -0,0 +1,78 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The resource model definition for Azure Resource Manager proxy + /// resource. It will have everything other than required location and + /// tags. This proxy resource is explicitly created or updated by including + /// it in the parent resource. + /// + public partial class ManagedProxyResource : IResource + { + /// + /// Initializes a new instance of the ManagedProxyResource class. + /// + public ManagedProxyResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagedProxyResource class. + /// + /// Fully qualified identifier for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + public ManagedProxyResource(string id = default(string), string name = default(string), string type = default(string)) + { + Id = id; + Name = name; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets fully qualified identifier for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets or sets the name of the resource + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets the type of the resource. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/NetworkKind.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/NetworkKind.cs new file mode 100644 index 000000000000..331c055b0a23 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/NetworkKind.cs @@ -0,0 +1,25 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + + /// + /// Defines values for NetworkKind. + /// + public static class NetworkKind + { + /// + /// Indicates a container network local to a single Service Fabric + /// cluster. The value is 1. + /// + public const string Local = "Local"; + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/NetworkRef.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/NetworkRef.cs new file mode 100644 index 000000000000..afd35e2c9a28 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/NetworkRef.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a network reference in a service. + /// + public partial class NetworkRef + { + /// + /// Initializes a new instance of the NetworkRef class. + /// + public NetworkRef() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NetworkRef class. + /// + /// Name of the network + /// A list of endpoints that are exposed on + /// this network. + public NetworkRef(string name = default(string), IList endpointRefs = default(IList)) + { + Name = name; + EndpointRefs = endpointRefs; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets name of the network + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets a list of endpoints that are exposed on this network. + /// + [JsonProperty(PropertyName = "endpointRefs")] + public IList EndpointRefs { get; set; } + + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/NetworkResourceDescription.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/NetworkResourceDescription.cs new file mode 100644 index 000000000000..7a8b5d04163e --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/NetworkResourceDescription.cs @@ -0,0 +1,79 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// This type describes a network resource. + /// + public partial class NetworkResourceDescription : TrackedResource + { + /// + /// Initializes a new instance of the NetworkResourceDescription class. + /// + public NetworkResourceDescription() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NetworkResourceDescription class. + /// + /// The geo-location where the resource + /// lives + /// Describes properties of a network + /// resource. + /// Fully qualified identifier for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// Resource tags. + public NetworkResourceDescription(string location, NetworkResourceProperties properties, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary)) + : base(location, id, name, type, tags) + { + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets describes properties of a network resource. + /// + [JsonProperty(PropertyName = "properties")] + public NetworkResourceProperties Properties { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (Properties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Properties"); + } + } + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/NetworkResourceProperties.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/NetworkResourceProperties.cs new file mode 100644 index 000000000000..f6da8cec28ca --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/NetworkResourceProperties.cs @@ -0,0 +1,75 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes properties of a network resource. + /// + public partial class NetworkResourceProperties : NetworkResourcePropertiesBase + { + /// + /// Initializes a new instance of the NetworkResourceProperties class. + /// + public NetworkResourceProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NetworkResourceProperties class. + /// + /// State of the resource. + /// User readable description of the + /// network. + /// Status of the network. Possible values + /// include: 'Unknown', 'Ready', 'Upgrading', 'Creating', 'Deleting', + /// 'Failed' + /// Gives additional information about the + /// current status of the network. + public NetworkResourceProperties(string provisioningState = default(string), string description = default(string), string status = default(string), string statusDetails = default(string)) + : base(provisioningState) + { + Description = description; + Status = status; + StatusDetails = statusDetails; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets user readable description of the network. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// Gets status of the network. Possible values include: 'Unknown', + /// 'Ready', 'Upgrading', 'Creating', 'Deleting', 'Failed' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; private set; } + + /// + /// Gets gives additional information about the current status of the + /// network. + /// + [JsonProperty(PropertyName = "statusDetails")] + public string StatusDetails { get; private set; } + + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/NetworkResourcePropertiesBase.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/NetworkResourcePropertiesBase.cs new file mode 100644 index 000000000000..aca6be82772d --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/NetworkResourcePropertiesBase.cs @@ -0,0 +1,47 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using System.Linq; + + /// + /// This type describes the properties of a network resource, including its + /// kind. + /// + public partial class NetworkResourcePropertiesBase : ProvisionedResourceProperties + { + /// + /// Initializes a new instance of the NetworkResourcePropertiesBase + /// class. + /// + public NetworkResourcePropertiesBase() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NetworkResourcePropertiesBase + /// class. + /// + /// State of the resource. + public NetworkResourcePropertiesBase(string provisioningState = default(string)) + : base(provisioningState) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/OperatingSystemType.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/OperatingSystemType.cs new file mode 100644 index 000000000000..6c9c4c0fb0d3 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/OperatingSystemType.cs @@ -0,0 +1,28 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + + /// + /// Defines values for OperatingSystemType. + /// + public static class OperatingSystemType + { + /// + /// The required operating system is Linux. + /// + public const string Linux = "Linux"; + /// + /// The required operating system is Windows. + /// + public const string Windows = "Windows"; + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/OperationResult.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/OperationResult.cs new file mode 100644 index 000000000000..c22eddcd91c5 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/OperationResult.cs @@ -0,0 +1,77 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// List of operations available at the listed Azure resource provider. + /// + public partial class OperationResult + { + /// + /// Initializes a new instance of the OperationResult class. + /// + public OperationResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationResult class. + /// + /// The name of the operation. + /// The object that represents the + /// operation. + /// Origin result + /// The URL to use for getting the next set of + /// results. + public OperationResult(string name = default(string), AvailableOperationDisplay display = default(AvailableOperationDisplay), string origin = default(string), string nextLink = default(string)) + { + Name = name; + Display = display; + Origin = origin; + NextLink = nextLink; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the operation. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the object that represents the operation. + /// + [JsonProperty(PropertyName = "display")] + public AvailableOperationDisplay Display { get; set; } + + /// + /// Gets or sets origin result + /// + [JsonProperty(PropertyName = "origin")] + public string Origin { get; set; } + + /// + /// Gets or sets the URL to use for getting the next set of results. + /// + [JsonProperty(PropertyName = "nextLink")] + public string NextLink { get; set; } + + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/Page.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/Page.cs new file mode 100644 index 000000000000..fdcbecc7a4e0 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/Page.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + + /// + /// Defines a page in Azure responses. + /// + /// Type of the page content items + [JsonObject] + public class Page : IPage + { + /// + /// Gets the link to the next page. + /// + [JsonProperty("nextLink")] + public string NextPageLink { get; private set; } + + [JsonProperty("value")] + private IList Items{ get; set; } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + public IEnumerator GetEnumerator() + { + return Items == null ? System.Linq.Enumerable.Empty().GetEnumerator() : Items.GetEnumerator(); + } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ProvisionedResourceProperties.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ProvisionedResourceProperties.cs new file mode 100644 index 000000000000..a42676af9707 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ProvisionedResourceProperties.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes common properties of a provisioned resource. + /// + public partial class ProvisionedResourceProperties + { + /// + /// Initializes a new instance of the ProvisionedResourceProperties + /// class. + /// + public ProvisionedResourceProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ProvisionedResourceProperties + /// class. + /// + /// State of the resource. + public ProvisionedResourceProperties(string provisioningState = default(string)) + { + ProvisioningState = provisioningState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets state of the resource. + /// + [JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState { get; private set; } + + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ProxyResource.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ProxyResource.cs new file mode 100644 index 000000000000..cdac8e906d6b --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ProxyResource.cs @@ -0,0 +1,51 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using System.Linq; + + /// + /// The resource model definition for Azure Resource Manager proxy + /// resource. It will have everything other than required location and + /// tags. + /// + public partial class ProxyResource : Resource + { + /// + /// Initializes a new instance of the ProxyResource class. + /// + public ProxyResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ProxyResource class. + /// + /// Fully qualified identifier for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + public ProxyResource(string id = default(string), string name = default(string), string type = default(string)) + : base(id, name, type) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ReliableCollectionsRef.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ReliableCollectionsRef.cs new file mode 100644 index 000000000000..0959a20e1241 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ReliableCollectionsRef.cs @@ -0,0 +1,82 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Specifying this parameter adds support for reliable collections + /// + public partial class ReliableCollectionsRef + { + /// + /// Initializes a new instance of the ReliableCollectionsRef class. + /// + public ReliableCollectionsRef() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ReliableCollectionsRef class. + /// + /// Name of ReliableCollection resource. Right now + /// it's not used and you can use any string. + /// False (the default) if + /// ReliableCollections state is persisted to disk as usual. True if + /// you do not want to persist state, in which case replication is + /// still enabled and you can use ReliableCollections as distributed + /// cache. + public ReliableCollectionsRef(string name, bool? doNotPersistState = default(bool?)) + { + Name = name; + DoNotPersistState = doNotPersistState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets name of ReliableCollection resource. Right now it's + /// not used and you can use any string. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets false (the default) if ReliableCollections state is + /// persisted to disk as usual. True if you do not want to persist + /// state, in which case replication is still enabled and you can use + /// ReliableCollections as distributed cache. + /// + [JsonProperty(PropertyName = "doNotPersistState")] + public bool? DoNotPersistState { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + } + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/Resource.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/Resource.cs new file mode 100644 index 000000000000..ecb89b6bb4d7 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/Resource.cs @@ -0,0 +1,75 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The resource model definition for Azure Resource Manager resource. + /// + public partial class Resource : IResource + { + /// + /// Initializes a new instance of the Resource class. + /// + public Resource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Resource class. + /// + /// Fully qualified identifier for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + public Resource(string id = default(string), string name = default(string), string type = default(string)) + { + Id = id; + Name = name; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets fully qualified identifier for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets the name of the resource + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the type of the resource. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ResourceLimits.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ResourceLimits.cs new file mode 100644 index 000000000000..30a981b13b5c --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ResourceLimits.cs @@ -0,0 +1,63 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// This type describes the resource limits for a given container. It + /// describes the most amount of resources a container is allowed to use + /// before being restarted. + /// + public partial class ResourceLimits + { + /// + /// Initializes a new instance of the ResourceLimits class. + /// + public ResourceLimits() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceLimits class. + /// + /// The memory limit in GB. + /// CPU limits in cores. At present, only full cores + /// are supported. + public ResourceLimits(double? memoryInGB = default(double?), double? cpu = default(double?)) + { + MemoryInGB = memoryInGB; + Cpu = cpu; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the memory limit in GB. + /// + [JsonProperty(PropertyName = "memoryInGB")] + public double? MemoryInGB { get; set; } + + /// + /// Gets or sets CPU limits in cores. At present, only full cores are + /// supported. + /// + [JsonProperty(PropertyName = "cpu")] + public double? Cpu { get; set; } + + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ResourceRequests.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ResourceRequests.cs new file mode 100644 index 000000000000..abd379eaef59 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ResourceRequests.cs @@ -0,0 +1,76 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// This type describes the requested resources for a given container. It + /// describes the least amount of resources required for the container. A + /// container can consume more than requested resources up to the specified + /// limits before being restarted. Currently, the requested resources are + /// treated as limits. + /// + public partial class ResourceRequests + { + /// + /// Initializes a new instance of the ResourceRequests class. + /// + public ResourceRequests() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceRequests class. + /// + /// The memory request in GB for this + /// container. + /// Requested number of CPU cores. At present, only + /// full cores are supported. + public ResourceRequests(double memoryInGB, double cpu) + { + MemoryInGB = memoryInGB; + Cpu = cpu; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the memory request in GB for this container. + /// + [JsonProperty(PropertyName = "memoryInGB")] + public double MemoryInGB { get; set; } + + /// + /// Gets or sets requested number of CPU cores. At present, only full + /// cores are supported. + /// + [JsonProperty(PropertyName = "cpu")] + public double Cpu { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + //Nothing to validate + } + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ResourceRequirements.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ResourceRequirements.cs new file mode 100644 index 000000000000..31a5441a5905 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ResourceRequirements.cs @@ -0,0 +1,82 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// This type describes the resource requirements for a container or a + /// service. + /// + public partial class ResourceRequirements + { + /// + /// Initializes a new instance of the ResourceRequirements class. + /// + public ResourceRequirements() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceRequirements class. + /// + /// Describes the requested resources for a + /// given container. + /// Describes the maximum limits on the resources + /// for a given container. + public ResourceRequirements(ResourceRequests requests, ResourceLimits limits = default(ResourceLimits)) + { + Requests = requests; + Limits = limits; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets describes the requested resources for a given + /// container. + /// + [JsonProperty(PropertyName = "requests")] + public ResourceRequests Requests { get; set; } + + /// + /// Gets or sets describes the maximum limits on the resources for a + /// given container. + /// + [JsonProperty(PropertyName = "limits")] + public ResourceLimits Limits { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Requests == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Requests"); + } + if (Requests != null) + { + Requests.Validate(); + } + } + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ResourceStatus.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ResourceStatus.cs new file mode 100644 index 000000000000..a6404dfeac6e --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ResourceStatus.cs @@ -0,0 +1,46 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + + /// + /// Defines values for ResourceStatus. + /// + public static class ResourceStatus + { + /// + /// Indicates the resource status is unknown. The value is zero. + /// + public const string Unknown = "Unknown"; + /// + /// Indicates the resource is ready. The value is 1. + /// + public const string Ready = "Ready"; + /// + /// Indicates the resource is upgrading. The value is 2. + /// + public const string Upgrading = "Upgrading"; + /// + /// Indicates the resource is being created. The value is 3. + /// + public const string Creating = "Creating"; + /// + /// Indicates the resource is being deleted. The value is 4. + /// + public const string Deleting = "Deleting"; + /// + /// Indicates the resource is not functional due to persistent + /// failures. See statusDetails property for more details. The value is + /// 5. + /// + public const string Failed = "Failed"; + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/SecretKind.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/SecretKind.cs new file mode 100644 index 000000000000..4e2118a8c381 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/SecretKind.cs @@ -0,0 +1,25 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + + /// + /// Defines values for SecretKind. + /// + public static class SecretKind + { + /// + /// A simple secret resource whose plaintext value is provided by the + /// user. + /// + public const string InlinedValue = "inlinedValue"; + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/SecretResourceDescription.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/SecretResourceDescription.cs new file mode 100644 index 000000000000..b238a4aecbfb --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/SecretResourceDescription.cs @@ -0,0 +1,79 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// This type describes a secret resource. + /// + public partial class SecretResourceDescription : TrackedResource + { + /// + /// Initializes a new instance of the SecretResourceDescription class. + /// + public SecretResourceDescription() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SecretResourceDescription class. + /// + /// The geo-location where the resource + /// lives + /// Describes the properties of a secret + /// resource. + /// Fully qualified identifier for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// Resource tags. + public SecretResourceDescription(string location, SecretResourceProperties properties, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary)) + : base(location, id, name, type, tags) + { + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets describes the properties of a secret resource. + /// + [JsonProperty(PropertyName = "properties")] + public SecretResourceProperties Properties { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (Properties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Properties"); + } + } + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/SecretResourceProperties.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/SecretResourceProperties.cs new file mode 100644 index 000000000000..359a2dd1d4ce --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/SecretResourceProperties.cs @@ -0,0 +1,88 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes the properties of a secret resource. + /// + public partial class SecretResourceProperties : SecretResourcePropertiesBase + { + /// + /// Initializes a new instance of the SecretResourceProperties class. + /// + public SecretResourceProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SecretResourceProperties class. + /// + /// State of the resource. + /// User readable description of the + /// secret. + /// Status of the resource. Possible values + /// include: 'Unknown', 'Ready', 'Upgrading', 'Creating', 'Deleting', + /// 'Failed' + /// Gives additional information about the + /// current status of the secret. + /// The type of the content stored in the + /// secret value. The value of this property is opaque to Service + /// Fabric. Once set, the value of this property cannot be + /// changed. + public SecretResourceProperties(string provisioningState = default(string), string description = default(string), string status = default(string), string statusDetails = default(string), string contentType = default(string)) + : base(provisioningState) + { + Description = description; + Status = status; + StatusDetails = statusDetails; + ContentType = contentType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets user readable description of the secret. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// Gets status of the resource. Possible values include: 'Unknown', + /// 'Ready', 'Upgrading', 'Creating', 'Deleting', 'Failed' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; private set; } + + /// + /// Gets gives additional information about the current status of the + /// secret. + /// + [JsonProperty(PropertyName = "statusDetails")] + public string StatusDetails { get; private set; } + + /// + /// Gets or sets the type of the content stored in the secret value. + /// The value of this property is opaque to Service Fabric. Once set, + /// the value of this property cannot be changed. + /// + [JsonProperty(PropertyName = "contentType")] + public string ContentType { get; set; } + + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/SecretResourcePropertiesBase.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/SecretResourcePropertiesBase.cs new file mode 100644 index 000000000000..8fc42fd05dd4 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/SecretResourcePropertiesBase.cs @@ -0,0 +1,47 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using System.Linq; + + /// + /// This type describes the properties of a secret resource, including its + /// kind. + /// + public partial class SecretResourcePropertiesBase : ProvisionedResourceProperties + { + /// + /// Initializes a new instance of the SecretResourcePropertiesBase + /// class. + /// + public SecretResourcePropertiesBase() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SecretResourcePropertiesBase + /// class. + /// + /// State of the resource. + public SecretResourcePropertiesBase(string provisioningState = default(string)) + : base(provisioningState) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/SecretValue.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/SecretValue.cs new file mode 100644 index 000000000000..c05215e10bce --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/SecretValue.cs @@ -0,0 +1,51 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// This type represents the unencrypted value of the secret. + /// + public partial class SecretValue + { + /// + /// Initializes a new instance of the SecretValue class. + /// + public SecretValue() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SecretValue class. + /// + /// The actual value of the secret. + public SecretValue(string value = default(string)) + { + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the actual value of the secret. + /// + [JsonProperty(PropertyName = "value")] + public string Value { get; set; } + + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/SecretValueProperties.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/SecretValueProperties.cs new file mode 100644 index 000000000000..f6b61f7afce7 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/SecretValueProperties.cs @@ -0,0 +1,51 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// This type describes properties of secret value resource. + /// + public partial class SecretValueProperties + { + /// + /// Initializes a new instance of the SecretValueProperties class. + /// + public SecretValueProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SecretValueProperties class. + /// + /// The actual value of the secret. + public SecretValueProperties(string value = default(string)) + { + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the actual value of the secret. + /// + [JsonProperty(PropertyName = "value")] + public string Value { get; set; } + + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/SecretValueResourceDescription.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/SecretValueResourceDescription.cs new file mode 100644 index 000000000000..bbc76e12168c --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/SecretValueResourceDescription.cs @@ -0,0 +1,87 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// This type describes a value of a secret resource. The name of this + /// resource is the version identifier corresponding to this secret value. + /// + [Rest.Serialization.JsonTransformation] + public partial class SecretValueResourceDescription : TrackedResource + { + /// + /// Initializes a new instance of the SecretValueResourceDescription + /// class. + /// + public SecretValueResourceDescription() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SecretValueResourceDescription + /// class. + /// + /// The geo-location where the resource + /// lives + /// Fully qualified identifier for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// Resource tags. + /// State of the resource. + /// The actual value of the secret. + public SecretValueResourceDescription(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string provisioningState = default(string), string value = default(string)) + : base(location, id, name, type, tags) + { + ProvisioningState = provisioningState; + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets state of the resource. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets the actual value of the secret. + /// + [JsonProperty(PropertyName = "properties.value")] + public string Value { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ServiceProperties.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ServiceProperties.cs new file mode 100644 index 000000000000..ae244654c50c --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ServiceProperties.cs @@ -0,0 +1,118 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes properties of a service resource. + /// + public partial class ServiceProperties + { + /// + /// Initializes a new instance of the ServiceProperties class. + /// + public ServiceProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ServiceProperties class. + /// + /// User readable description of the + /// service. + /// The number of replicas of the service to + /// create. Defaults to 1 if not specified. + /// Auto scaling policies + /// Status of the service. Possible values + /// include: 'Unknown', 'Ready', 'Upgrading', 'Creating', 'Deleting', + /// 'Failed' + /// Gives additional information about the + /// current status of the service. + /// Describes the health state of an + /// application resource. Possible values include: 'Invalid', 'Ok', + /// 'Warning', 'Error', 'Unknown' + /// When the service's health state + /// is not 'Ok', this additional details from service fabric Health + /// Manager for the user to know why the service is marked + /// unhealthy. + public ServiceProperties(string description = default(string), int? replicaCount = default(int?), IList autoScalingPolicies = default(IList), string status = default(string), string statusDetails = default(string), string healthState = default(string), string unhealthyEvaluation = default(string)) + { + Description = description; + ReplicaCount = replicaCount; + AutoScalingPolicies = autoScalingPolicies; + Status = status; + StatusDetails = statusDetails; + HealthState = healthState; + UnhealthyEvaluation = unhealthyEvaluation; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets user readable description of the service. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// Gets or sets the number of replicas of the service to create. + /// Defaults to 1 if not specified. + /// + [JsonProperty(PropertyName = "replicaCount")] + public int? ReplicaCount { get; set; } + + /// + /// Gets or sets auto scaling policies + /// + [JsonProperty(PropertyName = "autoScalingPolicies")] + public IList AutoScalingPolicies { get; set; } + + /// + /// Gets status of the service. Possible values include: 'Unknown', + /// 'Ready', 'Upgrading', 'Creating', 'Deleting', 'Failed' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; private set; } + + /// + /// Gets gives additional information about the current status of the + /// service. + /// + [JsonProperty(PropertyName = "statusDetails")] + public string StatusDetails { get; private set; } + + /// + /// Gets describes the health state of an application resource. + /// Possible values include: 'Invalid', 'Ok', 'Warning', 'Error', + /// 'Unknown' + /// + [JsonProperty(PropertyName = "healthState")] + public string HealthState { get; private set; } + + /// + /// Gets when the service's health state is not 'Ok', this additional + /// details from service fabric Health Manager for the user to know why + /// the service is marked unhealthy. + /// + [JsonProperty(PropertyName = "unhealthyEvaluation")] + public string UnhealthyEvaluation { get; private set; } + + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ServiceReplicaDescription.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ServiceReplicaDescription.cs new file mode 100644 index 000000000000..4f380b619186 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ServiceReplicaDescription.cs @@ -0,0 +1,80 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a replica of a service resource. + /// + public partial class ServiceReplicaDescription : ServiceReplicaProperties + { + /// + /// Initializes a new instance of the ServiceReplicaDescription class. + /// + public ServiceReplicaDescription() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ServiceReplicaDescription class. + /// + /// The operation system required by the code in + /// service. Possible values include: 'Linux', 'Windows' + /// Describes the set of code packages that + /// forms the service. A code package describes the container and the + /// properties for running it. All the code packages are started + /// together on the same host and share the same context (network, + /// process etc.). + /// Name of the replica. + /// The names of the private networks that + /// this service needs to be part of. + /// Reference to sinks in + /// DiagnosticsDescription. + public ServiceReplicaDescription(string osType, IList codePackages, string replicaName, IList networkRefs = default(IList), DiagnosticsRef diagnostics = default(DiagnosticsRef)) + : base(osType, codePackages, networkRefs, diagnostics) + { + ReplicaName = replicaName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets name of the replica. + /// + [JsonProperty(PropertyName = "replicaName")] + public string ReplicaName { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (ReplicaName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ReplicaName"); + } + } + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ServiceReplicaProperties.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ServiceReplicaProperties.cs new file mode 100644 index 000000000000..c1cd90dc52e1 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ServiceReplicaProperties.cs @@ -0,0 +1,117 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes the properties of a service replica. + /// + public partial class ServiceReplicaProperties + { + /// + /// Initializes a new instance of the ServiceReplicaProperties class. + /// + public ServiceReplicaProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ServiceReplicaProperties class. + /// + /// The operation system required by the code in + /// service. Possible values include: 'Linux', 'Windows' + /// Describes the set of code packages that + /// forms the service. A code package describes the container and the + /// properties for running it. All the code packages are started + /// together on the same host and share the same context (network, + /// process etc.). + /// The names of the private networks that + /// this service needs to be part of. + /// Reference to sinks in + /// DiagnosticsDescription. + public ServiceReplicaProperties(string osType, IList codePackages, IList networkRefs = default(IList), DiagnosticsRef diagnostics = default(DiagnosticsRef)) + { + OsType = osType; + CodePackages = codePackages; + NetworkRefs = networkRefs; + Diagnostics = diagnostics; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the operation system required by the code in service. + /// Possible values include: 'Linux', 'Windows' + /// + [JsonProperty(PropertyName = "osType")] + public string OsType { get; set; } + + /// + /// Gets or sets describes the set of code packages that forms the + /// service. A code package describes the container and the properties + /// for running it. All the code packages are started together on the + /// same host and share the same context (network, process etc.). + /// + [JsonProperty(PropertyName = "codePackages")] + public IList CodePackages { get; set; } + + /// + /// Gets or sets the names of the private networks that this service + /// needs to be part of. + /// + [JsonProperty(PropertyName = "networkRefs")] + public IList NetworkRefs { get; set; } + + /// + /// Gets or sets reference to sinks in DiagnosticsDescription. + /// + [JsonProperty(PropertyName = "diagnostics")] + public DiagnosticsRef Diagnostics { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (OsType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "OsType"); + } + if (CodePackages == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "CodePackages"); + } + if (CodePackages != null) + { + foreach (var element in CodePackages) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ServiceResourceDescription.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ServiceResourceDescription.cs new file mode 100644 index 000000000000..035ff6fa3278 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/ServiceResourceDescription.cs @@ -0,0 +1,217 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// This type describes a service resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class ServiceResourceDescription : ManagedProxyResource + { + /// + /// Initializes a new instance of the ServiceResourceDescription class. + /// + public ServiceResourceDescription() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ServiceResourceDescription class. + /// + /// The operation system required by the code in + /// service. Possible values include: 'Linux', 'Windows' + /// Describes the set of code packages that + /// forms the service. A code package describes the container and the + /// properties for running it. All the code packages are started + /// together on the same host and share the same context (network, + /// process etc.). + /// Fully qualified identifier for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// State of the resource. + /// The names of the private networks that + /// this service needs to be part of. + /// Reference to sinks in + /// DiagnosticsDescription. + /// User readable description of the + /// service. + /// The number of replicas of the service to + /// create. Defaults to 1 if not specified. + /// Auto scaling policies + /// Status of the service. Possible values + /// include: 'Unknown', 'Ready', 'Upgrading', 'Creating', 'Deleting', + /// 'Failed' + /// Gives additional information about the + /// current status of the service. + /// Describes the health state of an + /// application resource. Possible values include: 'Invalid', 'Ok', + /// 'Warning', 'Error', 'Unknown' + /// When the service's health state + /// is not 'Ok', this additional details from service fabric Health + /// Manager for the user to know why the service is marked + /// unhealthy. + public ServiceResourceDescription(string osType, IList codePackages, string id = default(string), string name = default(string), string type = default(string), string provisioningState = default(string), IList networkRefs = default(IList), DiagnosticsRef diagnostics = default(DiagnosticsRef), string description = default(string), int? replicaCount = default(int?), IList autoScalingPolicies = default(IList), string status = default(string), string statusDetails = default(string), string healthState = default(string), string unhealthyEvaluation = default(string)) + : base(id, name, type) + { + ProvisioningState = provisioningState; + OsType = osType; + CodePackages = codePackages; + NetworkRefs = networkRefs; + Diagnostics = diagnostics; + Description = description; + ReplicaCount = replicaCount; + AutoScalingPolicies = autoScalingPolicies; + Status = status; + StatusDetails = statusDetails; + HealthState = healthState; + UnhealthyEvaluation = unhealthyEvaluation; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets state of the resource. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets the operation system required by the code in service. + /// Possible values include: 'Linux', 'Windows' + /// + [JsonProperty(PropertyName = "properties.osType")] + public string OsType { get; set; } + + /// + /// Gets or sets describes the set of code packages that forms the + /// service. A code package describes the container and the properties + /// for running it. All the code packages are started together on the + /// same host and share the same context (network, process etc.). + /// + [JsonProperty(PropertyName = "properties.codePackages")] + public IList CodePackages { get; set; } + + /// + /// Gets or sets the names of the private networks that this service + /// needs to be part of. + /// + [JsonProperty(PropertyName = "properties.networkRefs")] + public IList NetworkRefs { get; set; } + + /// + /// Gets or sets reference to sinks in DiagnosticsDescription. + /// + [JsonProperty(PropertyName = "properties.diagnostics")] + public DiagnosticsRef Diagnostics { get; set; } + + /// + /// Gets or sets user readable description of the service. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets or sets the number of replicas of the service to create. + /// Defaults to 1 if not specified. + /// + [JsonProperty(PropertyName = "properties.replicaCount")] + public int? ReplicaCount { get; set; } + + /// + /// Gets or sets auto scaling policies + /// + [JsonProperty(PropertyName = "properties.autoScalingPolicies")] + public IList AutoScalingPolicies { get; set; } + + /// + /// Gets status of the service. Possible values include: 'Unknown', + /// 'Ready', 'Upgrading', 'Creating', 'Deleting', 'Failed' + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; private set; } + + /// + /// Gets gives additional information about the current status of the + /// service. + /// + [JsonProperty(PropertyName = "properties.statusDetails")] + public string StatusDetails { get; private set; } + + /// + /// Gets describes the health state of an application resource. + /// Possible values include: 'Invalid', 'Ok', 'Warning', 'Error', + /// 'Unknown' + /// + [JsonProperty(PropertyName = "properties.healthState")] + public string HealthState { get; private set; } + + /// + /// Gets when the service's health state is not 'Ok', this additional + /// details from service fabric Health Manager for the user to know why + /// the service is marked unhealthy. + /// + [JsonProperty(PropertyName = "properties.unhealthyEvaluation")] + public string UnhealthyEvaluation { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (OsType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "OsType"); + } + if (CodePackages == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "CodePackages"); + } + if (CodePackages != null) + { + foreach (var element in CodePackages) + { + if (element != null) + { + element.Validate(); + } + } + } + if (AutoScalingPolicies != null) + { + foreach (var element1 in AutoScalingPolicies) + { + if (element1 != null) + { + element1.Validate(); + } + } + } + } + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/Setting.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/Setting.cs new file mode 100644 index 000000000000..e067ee968c24 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/Setting.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes a setting for the container. The setting file path can be + /// fetched from environment variable "Fabric_SettingPath". The path for + /// Windows container is "C:\\secrets". The path for Linux container is + /// "/var/secrets". + /// + public partial class Setting + { + /// + /// Initializes a new instance of the Setting class. + /// + public Setting() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Setting class. + /// + /// The name of the setting. + /// The value of the setting. + public Setting(string name = default(string), string value = default(string)) + { + Name = name; + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the setting. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the value of the setting. + /// + [JsonProperty(PropertyName = "value")] + public string Value { get; set; } + + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/SizeTypes.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/SizeTypes.cs new file mode 100644 index 000000000000..b3d13eb47236 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/SizeTypes.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + + /// + /// Defines values for SizeTypes. + /// + public static class SizeTypes + { + public const string Small = "Small"; + public const string Medium = "Medium"; + public const string Large = "Large"; + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/TcpConfig.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/TcpConfig.cs new file mode 100644 index 000000000000..bcc2d85b094a --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/TcpConfig.cs @@ -0,0 +1,93 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes the tcp configuration for external connectivity for this + /// network. + /// + public partial class TcpConfig + { + /// + /// Initializes a new instance of the TcpConfig class. + /// + public TcpConfig() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TcpConfig class. + /// + /// tcp gateway config name. + /// Specifies the port at which the service endpoint + /// below needs to be exposed. + /// Describes destination endpoint for + /// routing traffic. + public TcpConfig(string name, int port, GatewayDestination destination) + { + Name = name; + Port = port; + Destination = destination; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets tcp gateway config name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets specifies the port at which the service endpoint below + /// needs to be exposed. + /// + [JsonProperty(PropertyName = "port")] + public int Port { get; set; } + + /// + /// Gets or sets describes destination endpoint for routing traffic. + /// + [JsonProperty(PropertyName = "destination")] + public GatewayDestination Destination { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (Destination == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Destination"); + } + if (Destination != null) + { + Destination.Validate(); + } + } + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/TrackedResource.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/TrackedResource.cs new file mode 100644 index 000000000000..a379ed01de28 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/TrackedResource.cs @@ -0,0 +1,84 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The resource model definition for Azure Resource Manager tracked + /// top-level resource. + /// + public partial class TrackedResource : Resource + { + /// + /// Initializes a new instance of the TrackedResource class. + /// + public TrackedResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TrackedResource class. + /// + /// The geo-location where the resource + /// lives + /// Fully qualified identifier for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// Resource tags. + public TrackedResource(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary)) + : base(id, name, type) + { + Tags = tags; + Location = location; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Gets or sets the geo-location where the resource lives + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Location"); + } + } + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/VolumeProperties.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/VolumeProperties.cs new file mode 100644 index 000000000000..b1132e4ced9f --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/VolumeProperties.cs @@ -0,0 +1,109 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes properties of a volume resource. + /// + public partial class VolumeProperties + { + /// + /// Initializes a new instance of the VolumeProperties class. + /// + public VolumeProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VolumeProperties class. + /// + /// User readable description of the + /// volume. + /// Status of the volume. Possible values include: + /// 'Unknown', 'Ready', 'Upgrading', 'Creating', 'Deleting', + /// 'Failed' + /// Gives additional information about the + /// current status of the volume. + /// This type describes a volume + /// provided by an Azure Files file share. + public VolumeProperties(string description = default(string), string status = default(string), string statusDetails = default(string), VolumeProviderParametersAzureFile azureFileParameters = default(VolumeProviderParametersAzureFile)) + { + Description = description; + Status = status; + StatusDetails = statusDetails; + AzureFileParameters = azureFileParameters; + CustomInit(); + } + /// + /// Static constructor for VolumeProperties class. + /// + static VolumeProperties() + { + Provider = "SFAzureFile"; + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets user readable description of the volume. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// Gets status of the volume. Possible values include: 'Unknown', + /// 'Ready', 'Upgrading', 'Creating', 'Deleting', 'Failed' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; private set; } + + /// + /// Gets gives additional information about the current status of the + /// volume. + /// + [JsonProperty(PropertyName = "statusDetails")] + public string StatusDetails { get; private set; } + + /// + /// Gets or sets this type describes a volume provided by an Azure + /// Files file share. + /// + [JsonProperty(PropertyName = "azureFileParameters")] + public VolumeProviderParametersAzureFile AzureFileParameters { get; set; } + + /// + /// Provider of the volume. + /// + [JsonProperty(PropertyName = "provider")] + public static string Provider { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (AzureFileParameters != null) + { + AzureFileParameters.Validate(); + } + } + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/VolumeProvider.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/VolumeProvider.cs new file mode 100644 index 000000000000..57b83c387adf --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/VolumeProvider.cs @@ -0,0 +1,24 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + + /// + /// Defines values for VolumeProvider. + /// + public static class VolumeProvider + { + /// + /// Provides volumes that are backed by Azure Files. + /// + public const string SFAzureFile = "SFAzureFile"; + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/VolumeProviderParametersAzureFile.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/VolumeProviderParametersAzureFile.cs new file mode 100644 index 000000000000..19073da25c4e --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/VolumeProviderParametersAzureFile.cs @@ -0,0 +1,92 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// This type describes a volume provided by an Azure Files file share. + /// + public partial class VolumeProviderParametersAzureFile + { + /// + /// Initializes a new instance of the VolumeProviderParametersAzureFile + /// class. + /// + public VolumeProviderParametersAzureFile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VolumeProviderParametersAzureFile + /// class. + /// + /// Name of the Azure storage account for the + /// File Share. + /// Name of the Azure Files file share that + /// provides storage for the volume. + /// Access key of the Azure storage account + /// for the File Share. + public VolumeProviderParametersAzureFile(string accountName, string shareName, string accountKey = default(string)) + { + AccountName = accountName; + AccountKey = accountKey; + ShareName = shareName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets name of the Azure storage account for the File Share. + /// + [JsonProperty(PropertyName = "accountName")] + public string AccountName { get; set; } + + /// + /// Gets or sets access key of the Azure storage account for the File + /// Share. + /// + [JsonProperty(PropertyName = "accountKey")] + public string AccountKey { get; set; } + + /// + /// Gets or sets name of the Azure Files file share that provides + /// storage for the volume. + /// + [JsonProperty(PropertyName = "shareName")] + public string ShareName { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (AccountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "AccountName"); + } + if (ShareName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ShareName"); + } + } + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/VolumeReference.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/VolumeReference.cs new file mode 100644 index 000000000000..f84de3edb6a8 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/VolumeReference.cs @@ -0,0 +1,90 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes a reference to a volume resource. + /// + public partial class VolumeReference + { + /// + /// Initializes a new instance of the VolumeReference class. + /// + public VolumeReference() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VolumeReference class. + /// + /// Name of the volume being referenced. + /// The path within the container at + /// which the volume should be mounted. Only valid path characters are + /// allowed. + /// The flag indicating whether the + /// volume is read only. Default is 'false'. + public VolumeReference(string name, string destinationPath, bool? readOnlyProperty = default(bool?)) + { + Name = name; + ReadOnlyProperty = readOnlyProperty; + DestinationPath = destinationPath; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets name of the volume being referenced. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the flag indicating whether the volume is read only. + /// Default is 'false'. + /// + [JsonProperty(PropertyName = "readOnly")] + public bool? ReadOnlyProperty { get; set; } + + /// + /// Gets or sets the path within the container at which the volume + /// should be mounted. Only valid path characters are allowed. + /// + [JsonProperty(PropertyName = "destinationPath")] + public string DestinationPath { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (DestinationPath == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DestinationPath"); + } + } + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/VolumeResourceDescription.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/VolumeResourceDescription.cs new file mode 100644 index 000000000000..1bccb8e09cf0 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Models/VolumeResourceDescription.cs @@ -0,0 +1,133 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// This type describes a volume resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class VolumeResourceDescription : TrackedResource + { + /// + /// Initializes a new instance of the VolumeResourceDescription class. + /// + public VolumeResourceDescription() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VolumeResourceDescription class. + /// + /// The geo-location where the resource + /// lives + /// Fully qualified identifier for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// Resource tags. + /// State of the resource. + /// User readable description of the + /// volume. + /// Status of the volume. Possible values include: + /// 'Unknown', 'Ready', 'Upgrading', 'Creating', 'Deleting', + /// 'Failed' + /// Gives additional information about the + /// current status of the volume. + /// This type describes a volume + /// provided by an Azure Files file share. + public VolumeResourceDescription(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string provisioningState = default(string), string description = default(string), string status = default(string), string statusDetails = default(string), VolumeProviderParametersAzureFile azureFileParameters = default(VolumeProviderParametersAzureFile)) + : base(location, id, name, type, tags) + { + ProvisioningState = provisioningState; + Description = description; + Status = status; + StatusDetails = statusDetails; + AzureFileParameters = azureFileParameters; + CustomInit(); + } + /// + /// Static constructor for VolumeResourceDescription class. + /// + static VolumeResourceDescription() + { + Provider = "SFAzureFile"; + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets state of the resource. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets user readable description of the volume. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets status of the volume. Possible values include: 'Unknown', + /// 'Ready', 'Upgrading', 'Creating', 'Deleting', 'Failed' + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; private set; } + + /// + /// Gets gives additional information about the current status of the + /// volume. + /// + [JsonProperty(PropertyName = "properties.statusDetails")] + public string StatusDetails { get; private set; } + + /// + /// Gets or sets this type describes a volume provided by an Azure + /// Files file share. + /// + [JsonProperty(PropertyName = "properties.azureFileParameters")] + public VolumeProviderParametersAzureFile AzureFileParameters { get; set; } + + /// + /// Provider of the volume. + /// + [JsonProperty(PropertyName = "properties.provider")] + public static string Provider { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (AzureFileParameters != null) + { + AzureFileParameters.Validate(); + } + } + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/NetworkOperations.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/NetworkOperations.cs new file mode 100644 index 000000000000..fcb76f18e059 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/NetworkOperations.cs @@ -0,0 +1,1345 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// NetworkOperations operations. + /// + internal partial class NetworkOperations : IServiceOperations, INetworkOperations + { + /// + /// Initializes a new instance of the NetworkOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal NetworkOperations(ServiceFabricMeshManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ServiceFabricMeshManagementClient + /// + public ServiceFabricMeshManagementClient Client { get; private set; } + + /// + /// Creates or updates a network resource. + /// + /// + /// Creates a network resource with the specified name, description and + /// properties. If a network resource with the same name exists, then it is + /// updated with the specified description and properties. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the network. + /// + /// + /// Description for creating a Network resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateWithHttpMessagesAsync(string resourceGroupName, string networkResourceName, NetworkResourceDescription networkResourceDescription, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (networkResourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "networkResourceName"); + } + if (networkResourceDescription == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "networkResourceDescription"); + } + if (networkResourceDescription != null) + { + networkResourceDescription.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("networkResourceName", networkResourceName); + tracingParameters.Add("networkResourceDescription", networkResourceDescription); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh/networks/{networkResourceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{networkResourceName}", networkResourceName); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(networkResourceDescription != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(networkResourceDescription, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201 && (int)_statusCode != 202) + { + var ex = new ErrorModelException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorModel _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets the network resource with the given name. + /// + /// + /// Gets the information about the network resource with the given name. The + /// information include the description and other properties of the network. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the network. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string networkResourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (networkResourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "networkResourceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("networkResourceName", networkResourceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh/networks/{networkResourceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{networkResourceName}", networkResourceName); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorModelException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorModel _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes the network resource. + /// + /// + /// Deletes the network resource identified by the name. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the network. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string networkResourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (networkResourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "networkResourceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("networkResourceName", networkResourceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh/networks/{networkResourceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{networkResourceName}", networkResourceName); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorModelException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorModel _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets all the network resources in a given resource group. + /// + /// + /// Gets the information about all network resources in a given resource group. + /// The information include the description and other properties of the + /// Network. + /// + /// + /// Azure resource group name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh/networks").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorModelException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorModel _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets all the network resources in a given subscription. + /// + /// + /// Gets the information about all network resources in a given resource group. + /// The information include the description and other properties of the + /// network. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabricMesh/networks").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorModelException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorModel _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets all the network resources in a given resource group. + /// + /// + /// Gets the information about all network resources in a given resource group. + /// The information include the description and other properties of the + /// Network. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorModelException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorModel _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets all the network resources in a given subscription. + /// + /// + /// Gets the information about all network resources in a given resource group. + /// The information include the description and other properties of the + /// network. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListBySubscriptionNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorModelException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorModel _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/NetworkOperationsExtensions.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/NetworkOperationsExtensions.cs new file mode 100644 index 000000000000..03a79550693c --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/NetworkOperationsExtensions.cs @@ -0,0 +1,342 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for NetworkOperations. + /// + public static partial class NetworkOperationsExtensions + { + /// + /// Creates or updates a network resource. + /// + /// + /// Creates a network resource with the specified name, description and + /// properties. If a network resource with the same name exists, then it is + /// updated with the specified description and properties. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the network. + /// + /// + /// Description for creating a Network resource. + /// + public static NetworkResourceDescription Create(this INetworkOperations operations, string resourceGroupName, string networkResourceName, NetworkResourceDescription networkResourceDescription) + { + return operations.CreateAsync(resourceGroupName, networkResourceName, networkResourceDescription).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a network resource. + /// + /// + /// Creates a network resource with the specified name, description and + /// properties. If a network resource with the same name exists, then it is + /// updated with the specified description and properties. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the network. + /// + /// + /// Description for creating a Network resource. + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this INetworkOperations operations, string resourceGroupName, string networkResourceName, NetworkResourceDescription networkResourceDescription, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, networkResourceName, networkResourceDescription, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the network resource with the given name. + /// + /// + /// Gets the information about the network resource with the given name. The + /// information include the description and other properties of the network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the network. + /// + public static NetworkResourceDescription Get(this INetworkOperations operations, string resourceGroupName, string networkResourceName) + { + return operations.GetAsync(resourceGroupName, networkResourceName).GetAwaiter().GetResult(); + } + + /// + /// Gets the network resource with the given name. + /// + /// + /// Gets the information about the network resource with the given name. The + /// information include the description and other properties of the network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the network. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this INetworkOperations operations, string resourceGroupName, string networkResourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, networkResourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the network resource. + /// + /// + /// Deletes the network resource identified by the name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the network. + /// + public static void Delete(this INetworkOperations operations, string resourceGroupName, string networkResourceName) + { + operations.DeleteAsync(resourceGroupName, networkResourceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the network resource. + /// + /// + /// Deletes the network resource identified by the name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the network. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this INetworkOperations operations, string resourceGroupName, string networkResourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, networkResourceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets all the network resources in a given resource group. + /// + /// + /// Gets the information about all network resources in a given resource group. + /// The information include the description and other properties of the + /// Network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group name + /// + public static IPage ListByResourceGroup(this INetworkOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Gets all the network resources in a given resource group. + /// + /// + /// Gets the information about all network resources in a given resource group. + /// The information include the description and other properties of the + /// Network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group name + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this INetworkOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets all the network resources in a given subscription. + /// + /// + /// Gets the information about all network resources in a given resource group. + /// The information include the description and other properties of the + /// network. + /// + /// + /// The operations group for this extension method. + /// + public static IPage ListBySubscription(this INetworkOperations operations) + { + return operations.ListBySubscriptionAsync().GetAwaiter().GetResult(); + } + + /// + /// Gets all the network resources in a given subscription. + /// + /// + /// Gets the information about all network resources in a given resource group. + /// The information include the description and other properties of the + /// network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySubscriptionAsync(this INetworkOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets all the network resources in a given resource group. + /// + /// + /// Gets the information about all network resources in a given resource group. + /// The information include the description and other properties of the + /// Network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this INetworkOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets all the network resources in a given resource group. + /// + /// + /// Gets the information about all network resources in a given resource group. + /// The information include the description and other properties of the + /// Network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupNextAsync(this INetworkOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets all the network resources in a given subscription. + /// + /// + /// Gets the information about all network resources in a given resource group. + /// The information include the description and other properties of the + /// network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListBySubscriptionNext(this INetworkOperations operations, string nextPageLink) + { + return operations.ListBySubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets all the network resources in a given subscription. + /// + /// + /// Gets the information about all network resources in a given resource group. + /// The information include the description and other properties of the + /// network. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySubscriptionNextAsync(this INetworkOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Operations.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Operations.cs new file mode 100644 index 000000000000..91690b052a86 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/Operations.cs @@ -0,0 +1,388 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Operations operations. + /// + internal partial class Operations : IServiceOperations, IOperations + { + /// + /// Initializes a new instance of the Operations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal Operations(ServiceFabricMeshManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ServiceFabricMeshManagementClient + /// + public ServiceFabricMeshManagementClient Client { get; private set; } + + /// + /// Lists all of the available operations. + /// + /// + /// Lists all the available operations provided by Service Fabric SeaBreeze + /// resource provider. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.ServiceFabricMesh/operations").ToString(); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorModelException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorModel _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all of the available operations. + /// + /// + /// Lists all the available operations provided by Service Fabric SeaBreeze + /// resource provider. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorModelException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorModel _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/OperationsExtensions.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/OperationsExtensions.cs new file mode 100644 index 000000000000..0b69b35a9320 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/OperationsExtensions.cs @@ -0,0 +1,103 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for Operations. + /// + public static partial class OperationsExtensions + { + /// + /// Lists all of the available operations. + /// + /// + /// Lists all the available operations provided by Service Fabric SeaBreeze + /// resource provider. + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Lists all of the available operations. + /// + /// + /// Lists all the available operations provided by Service Fabric SeaBreeze + /// resource provider. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all of the available operations. + /// + /// + /// Lists all the available operations provided by Service Fabric SeaBreeze + /// resource provider. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all of the available operations. + /// + /// + /// Lists all the available operations provided by Service Fabric SeaBreeze + /// resource provider. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/SdkInfo_ServiceFabricMeshManagementClient.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/SdkInfo_ServiceFabricMeshManagementClient.cs new file mode 100644 index 000000000000..b51fe7b4b603 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/SdkInfo_ServiceFabricMeshManagementClient.cs @@ -0,0 +1,36 @@ + +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh +{ + using System; + using System.Collections.Generic; + using System.Linq; + + internal static partial class SdkInfo + { + public static IEnumerable> ApiInfo_ServiceFabricMeshManagementClient + { + get + { + return new Tuple[] + { + new Tuple("ServiceFabricMesh", "Application", "2018-09-01-preview"), + new Tuple("ServiceFabricMesh", "CodePackage", "2018-09-01-preview"), + new Tuple("ServiceFabricMesh", "Gateway", "2018-09-01-preview"), + new Tuple("ServiceFabricMesh", "Network", "2018-09-01-preview"), + new Tuple("ServiceFabricMesh", "Operations", "2018-09-01-preview"), + new Tuple("ServiceFabricMesh", "Secret", "2018-09-01-preview"), + new Tuple("ServiceFabricMesh", "SecretValue", "2018-09-01-preview"), + new Tuple("ServiceFabricMesh", "Service", "2018-09-01-preview"), + new Tuple("ServiceFabricMesh", "ServiceReplica", "2018-09-01-preview"), + new Tuple("ServiceFabricMesh", "Volume", "2018-09-01-preview"), + }.AsEnumerable(); + } + } + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/SecretOperations.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/SecretOperations.cs new file mode 100644 index 000000000000..061f721a497d --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/SecretOperations.cs @@ -0,0 +1,1341 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SecretOperations operations. + /// + internal partial class SecretOperations : IServiceOperations, ISecretOperations + { + /// + /// Initializes a new instance of the SecretOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal SecretOperations(ServiceFabricMeshManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ServiceFabricMeshManagementClient + /// + public ServiceFabricMeshManagementClient Client { get; private set; } + + /// + /// Creates or updates a secret resource. + /// + /// + /// Creates a secret resource with the specified name, description and + /// properties. If a secret resource with the same name exists, then it is + /// updated with the specified description and properties. + /// + /// + /// Azure resource group name + /// + /// + /// The name of the secret resource. + /// + /// + /// Description for creating a secret resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateWithHttpMessagesAsync(string resourceGroupName, string secretResourceName, SecretResourceDescription secretResourceDescription, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (secretResourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "secretResourceName"); + } + if (secretResourceDescription == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "secretResourceDescription"); + } + if (secretResourceDescription != null) + { + secretResourceDescription.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("secretResourceName", secretResourceName); + tracingParameters.Add("secretResourceDescription", secretResourceDescription); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh/secrets/{secretResourceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{secretResourceName}", secretResourceName); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(secretResourceDescription != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(secretResourceDescription, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201 && (int)_statusCode != 202) + { + var ex = new ErrorModelException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorModel _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets the secret resource with the given name. + /// + /// + /// Gets the information about the secret resource with the given name. The + /// information include the description and other properties of the secret. + /// + /// + /// Azure resource group name + /// + /// + /// The name of the secret resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string secretResourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (secretResourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "secretResourceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("secretResourceName", secretResourceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh/secrets/{secretResourceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{secretResourceName}", secretResourceName); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorModelException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorModel _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes the secret resource. + /// + /// + /// Deletes the secret resource identified by the name. + /// + /// + /// Azure resource group name + /// + /// + /// The name of the secret resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string secretResourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (secretResourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "secretResourceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("secretResourceName", secretResourceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh/secrets/{secretResourceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{secretResourceName}", secretResourceName); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorModelException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorModel _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets all the secret resources in a given resource group. + /// + /// + /// Gets the information about all secret resources in a given resource group. + /// The information include the description and other properties of the Secret. + /// + /// + /// Azure resource group name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh/secrets").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorModelException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorModel _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets all the secret resources in a given subscription. + /// + /// + /// Gets the information about all secret resources in a given resource group. + /// The information include the description and other properties of the secret. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabricMesh/secrets").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorModelException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorModel _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets all the secret resources in a given resource group. + /// + /// + /// Gets the information about all secret resources in a given resource group. + /// The information include the description and other properties of the Secret. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorModelException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorModel _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets all the secret resources in a given subscription. + /// + /// + /// Gets the information about all secret resources in a given resource group. + /// The information include the description and other properties of the secret. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListBySubscriptionNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorModelException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorModel _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/SecretOperationsExtensions.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/SecretOperationsExtensions.cs new file mode 100644 index 000000000000..35d95246226a --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/SecretOperationsExtensions.cs @@ -0,0 +1,334 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for SecretOperations. + /// + public static partial class SecretOperationsExtensions + { + /// + /// Creates or updates a secret resource. + /// + /// + /// Creates a secret resource with the specified name, description and + /// properties. If a secret resource with the same name exists, then it is + /// updated with the specified description and properties. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group name + /// + /// + /// The name of the secret resource. + /// + /// + /// Description for creating a secret resource. + /// + public static SecretResourceDescription Create(this ISecretOperations operations, string resourceGroupName, string secretResourceName, SecretResourceDescription secretResourceDescription) + { + return operations.CreateAsync(resourceGroupName, secretResourceName, secretResourceDescription).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a secret resource. + /// + /// + /// Creates a secret resource with the specified name, description and + /// properties. If a secret resource with the same name exists, then it is + /// updated with the specified description and properties. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group name + /// + /// + /// The name of the secret resource. + /// + /// + /// Description for creating a secret resource. + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this ISecretOperations operations, string resourceGroupName, string secretResourceName, SecretResourceDescription secretResourceDescription, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, secretResourceName, secretResourceDescription, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the secret resource with the given name. + /// + /// + /// Gets the information about the secret resource with the given name. The + /// information include the description and other properties of the secret. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group name + /// + /// + /// The name of the secret resource. + /// + public static SecretResourceDescription Get(this ISecretOperations operations, string resourceGroupName, string secretResourceName) + { + return operations.GetAsync(resourceGroupName, secretResourceName).GetAwaiter().GetResult(); + } + + /// + /// Gets the secret resource with the given name. + /// + /// + /// Gets the information about the secret resource with the given name. The + /// information include the description and other properties of the secret. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group name + /// + /// + /// The name of the secret resource. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ISecretOperations operations, string resourceGroupName, string secretResourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, secretResourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the secret resource. + /// + /// + /// Deletes the secret resource identified by the name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group name + /// + /// + /// The name of the secret resource. + /// + public static void Delete(this ISecretOperations operations, string resourceGroupName, string secretResourceName) + { + operations.DeleteAsync(resourceGroupName, secretResourceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the secret resource. + /// + /// + /// Deletes the secret resource identified by the name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group name + /// + /// + /// The name of the secret resource. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this ISecretOperations operations, string resourceGroupName, string secretResourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, secretResourceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets all the secret resources in a given resource group. + /// + /// + /// Gets the information about all secret resources in a given resource group. + /// The information include the description and other properties of the Secret. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group name + /// + public static IPage ListByResourceGroup(this ISecretOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Gets all the secret resources in a given resource group. + /// + /// + /// Gets the information about all secret resources in a given resource group. + /// The information include the description and other properties of the Secret. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group name + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this ISecretOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets all the secret resources in a given subscription. + /// + /// + /// Gets the information about all secret resources in a given resource group. + /// The information include the description and other properties of the secret. + /// + /// + /// The operations group for this extension method. + /// + public static IPage ListBySubscription(this ISecretOperations operations) + { + return operations.ListBySubscriptionAsync().GetAwaiter().GetResult(); + } + + /// + /// Gets all the secret resources in a given subscription. + /// + /// + /// Gets the information about all secret resources in a given resource group. + /// The information include the description and other properties of the secret. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySubscriptionAsync(this ISecretOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets all the secret resources in a given resource group. + /// + /// + /// Gets the information about all secret resources in a given resource group. + /// The information include the description and other properties of the Secret. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this ISecretOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets all the secret resources in a given resource group. + /// + /// + /// Gets the information about all secret resources in a given resource group. + /// The information include the description and other properties of the Secret. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupNextAsync(this ISecretOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets all the secret resources in a given subscription. + /// + /// + /// Gets the information about all secret resources in a given resource group. + /// The information include the description and other properties of the secret. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListBySubscriptionNext(this ISecretOperations operations, string nextPageLink) + { + return operations.ListBySubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets all the secret resources in a given subscription. + /// + /// + /// Gets the information about all secret resources in a given resource group. + /// The information include the description and other properties of the secret. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySubscriptionNextAsync(this ISecretOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/SecretValueOperations.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/SecretValueOperations.cs new file mode 100644 index 000000000000..9c4f6b423619 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/SecretValueOperations.cs @@ -0,0 +1,1240 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SecretValueOperations operations. + /// + internal partial class SecretValueOperations : IServiceOperations, ISecretValueOperations + { + /// + /// Initializes a new instance of the SecretValueOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal SecretValueOperations(ServiceFabricMeshManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ServiceFabricMeshManagementClient + /// + public ServiceFabricMeshManagementClient Client { get; private set; } + + /// + /// Adds the specified value as a new version of the specified secret resource. + /// + /// + /// Creates a new value of the specified secret resource. The name of the value + /// is typically the version identifier. Once created the value cannot be + /// changed. + /// + /// + /// Azure resource group name + /// + /// + /// The name of the secret resource. + /// + /// + /// The name of the secret resource value which is typically the version + /// identifier for the value. + /// + /// + /// Description for creating a value of a secret resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateWithHttpMessagesAsync(string resourceGroupName, string secretResourceName, string secretValueResourceName, SecretValueResourceDescription secretValueResourceDescription, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (secretResourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "secretResourceName"); + } + if (secretValueResourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "secretValueResourceName"); + } + if (secretValueResourceDescription == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "secretValueResourceDescription"); + } + if (secretValueResourceDescription != null) + { + secretValueResourceDescription.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("secretResourceName", secretResourceName); + tracingParameters.Add("secretValueResourceName", secretValueResourceName); + tracingParameters.Add("secretValueResourceDescription", secretValueResourceDescription); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh/secrets/{secretResourceName}/values/{secretValueResourceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{secretResourceName}", secretResourceName); + _url = _url.Replace("{secretValueResourceName}", secretValueResourceName); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(secretValueResourceDescription != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(secretValueResourceDescription, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201 && (int)_statusCode != 202) + { + var ex = new ErrorModelException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorModel _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets the specified secret value resource. + /// + /// + /// Get the information about the specified named secret value resources. The + /// information does not include the actual value of the secret. + /// + /// + /// Azure resource group name + /// + /// + /// The name of the secret resource. + /// + /// + /// The name of the secret resource value which is typically the version + /// identifier for the value. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string secretResourceName, string secretValueResourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (secretResourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "secretResourceName"); + } + if (secretValueResourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "secretValueResourceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("secretResourceName", secretResourceName); + tracingParameters.Add("secretValueResourceName", secretValueResourceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh/secrets/{secretResourceName}/values/{secretValueResourceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{secretResourceName}", secretResourceName); + _url = _url.Replace("{secretValueResourceName}", secretValueResourceName); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorModelException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorModel _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes the specified value of the named secret resource. + /// + /// + /// Deletes the secret value resource identified by the name. The name of the + /// resource is typically the version associated with that value. Deletion will + /// fail if the specified value is in use. + /// + /// + /// Azure resource group name + /// + /// + /// The name of the secret resource. + /// + /// + /// The name of the secret resource value which is typically the version + /// identifier for the value. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string secretResourceName, string secretValueResourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (secretResourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "secretResourceName"); + } + if (secretValueResourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "secretValueResourceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("secretResourceName", secretResourceName); + tracingParameters.Add("secretValueResourceName", secretValueResourceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh/secrets/{secretResourceName}/values/{secretValueResourceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{secretResourceName}", secretResourceName); + _url = _url.Replace("{secretValueResourceName}", secretValueResourceName); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorModelException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorModel _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List names of all values of the specified secret resource. + /// + /// + /// Gets information about all secret value resources of the specified secret + /// resource. The information includes the names of the secret value resources, + /// but not the actual values. + /// + /// + /// Azure resource group name + /// + /// + /// The name of the secret resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string secretResourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (secretResourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "secretResourceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("secretResourceName", secretResourceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh/secrets/{secretResourceName}/values").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{secretResourceName}", secretResourceName); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorModelException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorModel _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists the specified value of the secret resource. + /// + /// + /// Lists the decrypted value of the specified named value of the secret + /// resource. This is a privileged operation. + /// + /// + /// Azure resource group name + /// + /// + /// The name of the secret resource. + /// + /// + /// The name of the secret resource value which is typically the version + /// identifier for the value. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> ListValueWithHttpMessagesAsync(string resourceGroupName, string secretResourceName, string secretValueResourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (secretResourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "secretResourceName"); + } + if (secretValueResourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "secretValueResourceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("secretResourceName", secretResourceName); + tracingParameters.Add("secretValueResourceName", secretValueResourceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListValue", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh/secrets/{secretResourceName}/values/{secretValueResourceName}/list_value").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{secretResourceName}", secretResourceName); + _url = _url.Replace("{secretValueResourceName}", secretValueResourceName); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorModelException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorModel _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List names of all values of the specified secret resource. + /// + /// + /// Gets information about all secret value resources of the specified secret + /// resource. The information includes the names of the secret value resources, + /// but not the actual values. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorModelException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorModel _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/SecretValueOperationsExtensions.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/SecretValueOperationsExtensions.cs new file mode 100644 index 000000000000..0fcb48c33333 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/SecretValueOperationsExtensions.cs @@ -0,0 +1,350 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for SecretValueOperations. + /// + public static partial class SecretValueOperationsExtensions + { + /// + /// Adds the specified value as a new version of the specified secret resource. + /// + /// + /// Creates a new value of the specified secret resource. The name of the value + /// is typically the version identifier. Once created the value cannot be + /// changed. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group name + /// + /// + /// The name of the secret resource. + /// + /// + /// The name of the secret resource value which is typically the version + /// identifier for the value. + /// + /// + /// Description for creating a value of a secret resource. + /// + public static SecretValueResourceDescription Create(this ISecretValueOperations operations, string resourceGroupName, string secretResourceName, string secretValueResourceName, SecretValueResourceDescription secretValueResourceDescription) + { + return operations.CreateAsync(resourceGroupName, secretResourceName, secretValueResourceName, secretValueResourceDescription).GetAwaiter().GetResult(); + } + + /// + /// Adds the specified value as a new version of the specified secret resource. + /// + /// + /// Creates a new value of the specified secret resource. The name of the value + /// is typically the version identifier. Once created the value cannot be + /// changed. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group name + /// + /// + /// The name of the secret resource. + /// + /// + /// The name of the secret resource value which is typically the version + /// identifier for the value. + /// + /// + /// Description for creating a value of a secret resource. + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this ISecretValueOperations operations, string resourceGroupName, string secretResourceName, string secretValueResourceName, SecretValueResourceDescription secretValueResourceDescription, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, secretResourceName, secretValueResourceName, secretValueResourceDescription, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the specified secret value resource. + /// + /// + /// Get the information about the specified named secret value resources. The + /// information does not include the actual value of the secret. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group name + /// + /// + /// The name of the secret resource. + /// + /// + /// The name of the secret resource value which is typically the version + /// identifier for the value. + /// + public static SecretValueResourceDescription Get(this ISecretValueOperations operations, string resourceGroupName, string secretResourceName, string secretValueResourceName) + { + return operations.GetAsync(resourceGroupName, secretResourceName, secretValueResourceName).GetAwaiter().GetResult(); + } + + /// + /// Gets the specified secret value resource. + /// + /// + /// Get the information about the specified named secret value resources. The + /// information does not include the actual value of the secret. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group name + /// + /// + /// The name of the secret resource. + /// + /// + /// The name of the secret resource value which is typically the version + /// identifier for the value. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ISecretValueOperations operations, string resourceGroupName, string secretResourceName, string secretValueResourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, secretResourceName, secretValueResourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the specified value of the named secret resource. + /// + /// + /// Deletes the secret value resource identified by the name. The name of the + /// resource is typically the version associated with that value. Deletion will + /// fail if the specified value is in use. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group name + /// + /// + /// The name of the secret resource. + /// + /// + /// The name of the secret resource value which is typically the version + /// identifier for the value. + /// + public static void Delete(this ISecretValueOperations operations, string resourceGroupName, string secretResourceName, string secretValueResourceName) + { + operations.DeleteAsync(resourceGroupName, secretResourceName, secretValueResourceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the specified value of the named secret resource. + /// + /// + /// Deletes the secret value resource identified by the name. The name of the + /// resource is typically the version associated with that value. Deletion will + /// fail if the specified value is in use. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group name + /// + /// + /// The name of the secret resource. + /// + /// + /// The name of the secret resource value which is typically the version + /// identifier for the value. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this ISecretValueOperations operations, string resourceGroupName, string secretResourceName, string secretValueResourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, secretResourceName, secretValueResourceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List names of all values of the specified secret resource. + /// + /// + /// Gets information about all secret value resources of the specified secret + /// resource. The information includes the names of the secret value resources, + /// but not the actual values. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group name + /// + /// + /// The name of the secret resource. + /// + public static IPage List(this ISecretValueOperations operations, string resourceGroupName, string secretResourceName) + { + return operations.ListAsync(resourceGroupName, secretResourceName).GetAwaiter().GetResult(); + } + + /// + /// List names of all values of the specified secret resource. + /// + /// + /// Gets information about all secret value resources of the specified secret + /// resource. The information includes the names of the secret value resources, + /// but not the actual values. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group name + /// + /// + /// The name of the secret resource. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this ISecretValueOperations operations, string resourceGroupName, string secretResourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, secretResourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists the specified value of the secret resource. + /// + /// + /// Lists the decrypted value of the specified named value of the secret + /// resource. This is a privileged operation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group name + /// + /// + /// The name of the secret resource. + /// + /// + /// The name of the secret resource value which is typically the version + /// identifier for the value. + /// + public static SecretValue ListValue(this ISecretValueOperations operations, string resourceGroupName, string secretResourceName, string secretValueResourceName) + { + return operations.ListValueAsync(resourceGroupName, secretResourceName, secretValueResourceName).GetAwaiter().GetResult(); + } + + /// + /// Lists the specified value of the secret resource. + /// + /// + /// Lists the decrypted value of the specified named value of the secret + /// resource. This is a privileged operation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group name + /// + /// + /// The name of the secret resource. + /// + /// + /// The name of the secret resource value which is typically the version + /// identifier for the value. + /// + /// + /// The cancellation token. + /// + public static async Task ListValueAsync(this ISecretValueOperations operations, string resourceGroupName, string secretResourceName, string secretValueResourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListValueWithHttpMessagesAsync(resourceGroupName, secretResourceName, secretValueResourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List names of all values of the specified secret resource. + /// + /// + /// Gets information about all secret value resources of the specified secret + /// resource. The information includes the names of the secret value resources, + /// but not the actual values. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this ISecretValueOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List names of all values of the specified secret resource. + /// + /// + /// Gets information about all secret value resources of the specified secret + /// resource. The information includes the names of the secret value resources, + /// but not the actual values. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this ISecretValueOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/ServiceFabricMeshManagementClient.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/ServiceFabricMeshManagementClient.cs new file mode 100644 index 000000000000..15f4f462c03c --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/ServiceFabricMeshManagementClient.cs @@ -0,0 +1,429 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Serialization; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + + /// + /// Service Fabric Mesh Management Client + /// + public partial class ServiceFabricMeshManagementClient : ServiceClient, IServiceFabricMeshManagementClient, IAzureClient + { + /// + /// The base URI of the service. + /// + public System.Uri BaseUri { get; set; } + + /// + /// Gets or sets json serialization settings. + /// + public JsonSerializerSettings SerializationSettings { get; private set; } + + /// + /// Gets or sets json deserialization settings. + /// + public JsonSerializerSettings DeserializationSettings { get; private set; } + + /// + /// Credentials needed for the client to connect to Azure. + /// + public ServiceClientCredentials Credentials { get; private set; } + + /// + /// The version of the API. This parameter is required and its value must be + /// `2018-09-01-preview`. + /// + public string ApiVersion { get; private set; } + + /// + /// The customer subscription identifier + /// + public string SubscriptionId { get; set; } + + /// + /// The preferred language for the response. + /// + public string AcceptLanguage { get; set; } + + /// + /// The retry timeout in seconds for Long Running Operations. Default value is + /// 30. + /// + public int? LongRunningOperationRetryTimeout { get; set; } + + /// + /// Whether a unique x-ms-client-request-id should be generated. When set to + /// true a unique x-ms-client-request-id value is generated and included in + /// each request. Default is true. + /// + public bool? GenerateClientRequestId { get; set; } + + /// + /// Gets the IOperations. + /// + public virtual IOperations Operations { get; private set; } + + /// + /// Gets the ISecretOperations. + /// + public virtual ISecretOperations Secret { get; private set; } + + /// + /// Gets the ISecretValueOperations. + /// + public virtual ISecretValueOperations SecretValue { get; private set; } + + /// + /// Gets the IVolumeOperations. + /// + public virtual IVolumeOperations Volume { get; private set; } + + /// + /// Gets the INetworkOperations. + /// + public virtual INetworkOperations Network { get; private set; } + + /// + /// Gets the IGatewayOperations. + /// + public virtual IGatewayOperations Gateway { get; private set; } + + /// + /// Gets the IApplicationOperations. + /// + public virtual IApplicationOperations Application { get; private set; } + + /// + /// Gets the IServiceOperations. + /// + public virtual IServiceOperations Service { get; private set; } + + /// + /// Gets the IServiceReplicaOperations. + /// + public virtual IServiceReplicaOperations ServiceReplica { get; private set; } + + /// + /// Gets the ICodePackageOperations. + /// + public virtual ICodePackageOperations CodePackage { get; private set; } + + /// + /// Initializes a new instance of the ServiceFabricMeshManagementClient class. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling ServiceFabricMeshManagementClient.Dispose(). False: will not dispose provided httpClient + protected ServiceFabricMeshManagementClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) + { + Initialize(); + } + + /// + /// Initializes a new instance of the ServiceFabricMeshManagementClient class. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected ServiceFabricMeshManagementClient(params DelegatingHandler[] handlers) : base(handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the ServiceFabricMeshManagementClient class. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected ServiceFabricMeshManagementClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the ServiceFabricMeshManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + protected ServiceFabricMeshManagementClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + BaseUri = baseUri; + } + + /// + /// Initializes a new instance of the ServiceFabricMeshManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + protected ServiceFabricMeshManagementClient(System.Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + BaseUri = baseUri; + } + + /// + /// Initializes a new instance of the ServiceFabricMeshManagementClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public ServiceFabricMeshManagementClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the ServiceFabricMeshManagementClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling ServiceFabricMeshManagementClient.Dispose(). False: will not dispose provided httpClient + /// + /// Thrown when a required parameter is null + /// + public ServiceFabricMeshManagementClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the ServiceFabricMeshManagementClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public ServiceFabricMeshManagementClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the ServiceFabricMeshManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public ServiceFabricMeshManagementClient(System.Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + BaseUri = baseUri; + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the ServiceFabricMeshManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public ServiceFabricMeshManagementClient(System.Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + BaseUri = baseUri; + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// An optional partial-method to perform custom initialization. + /// + partial void CustomInitialize(); + /// + /// Initializes client properties. + /// + private void Initialize() + { + Operations = new Operations(this); + Secret = new SecretOperations(this); + SecretValue = new SecretValueOperations(this); + Volume = new VolumeOperations(this); + Network = new NetworkOperations(this); + Gateway = new GatewayOperations(this); + Application = new ApplicationOperations(this); + Service = new ServiceOperations(this); + ServiceReplica = new ServiceReplicaOperations(this); + CodePackage = new CodePackageOperations(this); + BaseUri = new System.Uri("https://management.azure.com"); + ApiVersion = "2018-09-01-preview"; + AcceptLanguage = "en-US"; + LongRunningOperationRetryTimeout = 30; + GenerateClientRequestId = true; + SerializationSettings = new JsonSerializerSettings + { + Formatting = Newtonsoft.Json.Formatting.Indented, + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new ReadOnlyJsonContractResolver(), + Converters = new List + { + new Iso8601TimeSpanConverter() + } + }; + SerializationSettings.Converters.Add(new TransformationJsonConverter()); + DeserializationSettings = new JsonSerializerSettings + { + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new ReadOnlyJsonContractResolver(), + Converters = new List + { + new Iso8601TimeSpanConverter() + } + }; + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("kind")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("kind")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("kind")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("kind")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("kind")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("kind")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("kind")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("kind")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("kind")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("kind")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("kind")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("kind")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("kind")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("kind")); + CustomInitialize(); + DeserializationSettings.Converters.Add(new TransformationJsonConverter()); + DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); + } + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/ServiceOperations.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/ServiceOperations.cs new file mode 100644 index 000000000000..8f0aef5b1fa1 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/ServiceOperations.cs @@ -0,0 +1,617 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ServiceOperations operations. + /// + internal partial class ServiceOperations : IServiceOperations, IServiceOperations + { + /// + /// Initializes a new instance of the ServiceOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ServiceOperations(ServiceFabricMeshManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ServiceFabricMeshManagementClient + /// + public ServiceFabricMeshManagementClient Client { get; private set; } + + /// + /// Gets the service resource with the given name. + /// + /// + /// Gets the information about the service resource with the given name. The + /// information include the description and other properties of the service. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the application. + /// + /// + /// The identity of the service. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string applicationResourceName, string serviceResourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (applicationResourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "applicationResourceName"); + } + if (serviceResourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serviceResourceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("applicationResourceName", applicationResourceName); + tracingParameters.Add("serviceResourceName", serviceResourceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh/applications/{applicationResourceName}/services/{serviceResourceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{applicationResourceName}", applicationResourceName); + _url = _url.Replace("{serviceResourceName}", serviceResourceName); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorModelException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorModel _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all the service resources. + /// + /// + /// Gets the information about all services of an application resource. The + /// information include the description and other properties of the Service. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the application. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string applicationResourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (applicationResourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "applicationResourceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("applicationResourceName", applicationResourceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh/applications/{applicationResourceName}/services").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{applicationResourceName}", applicationResourceName); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorModelException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorModel _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all the service resources. + /// + /// + /// Gets the information about all services of an application resource. The + /// information include the description and other properties of the Service. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorModelException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorModel _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/ServiceOperationsExtensions.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/ServiceOperationsExtensions.cs new file mode 100644 index 000000000000..2855ee3c5050 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/ServiceOperationsExtensions.cs @@ -0,0 +1,169 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ServiceOperations. + /// + public static partial class ServiceOperationsExtensions + { + /// + /// Gets the service resource with the given name. + /// + /// + /// Gets the information about the service resource with the given name. The + /// information include the description and other properties of the service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the application. + /// + /// + /// The identity of the service. + /// + public static ServiceResourceDescription Get(this IServiceOperations operations, string resourceGroupName, string applicationResourceName, string serviceResourceName) + { + return operations.GetAsync(resourceGroupName, applicationResourceName, serviceResourceName).GetAwaiter().GetResult(); + } + + /// + /// Gets the service resource with the given name. + /// + /// + /// Gets the information about the service resource with the given name. The + /// information include the description and other properties of the service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the application. + /// + /// + /// The identity of the service. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IServiceOperations operations, string resourceGroupName, string applicationResourceName, string serviceResourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, applicationResourceName, serviceResourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all the service resources. + /// + /// + /// Gets the information about all services of an application resource. The + /// information include the description and other properties of the Service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the application. + /// + public static IPage List(this IServiceOperations operations, string resourceGroupName, string applicationResourceName) + { + return operations.ListAsync(resourceGroupName, applicationResourceName).GetAwaiter().GetResult(); + } + + /// + /// Lists all the service resources. + /// + /// + /// Gets the information about all services of an application resource. The + /// information include the description and other properties of the Service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the application. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IServiceOperations operations, string resourceGroupName, string applicationResourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, applicationResourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all the service resources. + /// + /// + /// Gets the information about all services of an application resource. The + /// information include the description and other properties of the Service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IServiceOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all the service resources. + /// + /// + /// Gets the information about all services of an application resource. The + /// information include the description and other properties of the Service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IServiceOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/ServiceReplicaOperations.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/ServiceReplicaOperations.cs new file mode 100644 index 000000000000..5c581668e03e --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/ServiceReplicaOperations.cs @@ -0,0 +1,638 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ServiceReplicaOperations operations. + /// + internal partial class ServiceReplicaOperations : IServiceOperations, IServiceReplicaOperations + { + /// + /// Initializes a new instance of the ServiceReplicaOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ServiceReplicaOperations(ServiceFabricMeshManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ServiceFabricMeshManagementClient + /// + public ServiceFabricMeshManagementClient Client { get; private set; } + + /// + /// Gets the given replica of the service of an application. + /// + /// + /// Gets the information about the service replica with the given name. The + /// information include the description and other properties of the service + /// replica. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the application. + /// + /// + /// The identity of the service. + /// + /// + /// Service Fabric replica name. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string applicationResourceName, string serviceResourceName, string replicaName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (applicationResourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "applicationResourceName"); + } + if (serviceResourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serviceResourceName"); + } + if (replicaName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "replicaName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("applicationResourceName", applicationResourceName); + tracingParameters.Add("serviceResourceName", serviceResourceName); + tracingParameters.Add("replicaName", replicaName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh/applications/{applicationResourceName}/services/{serviceResourceName}/replicas/{replicaName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{applicationResourceName}", applicationResourceName); + _url = _url.Replace("{serviceResourceName}", serviceResourceName); + _url = _url.Replace("{replicaName}", replicaName); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorModelException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorModel _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets replicas of a given service. + /// + /// + /// Gets the information about all replicas of a given service of an + /// application. The information includes the runtime properties of the replica + /// instance. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the application. + /// + /// + /// The identity of the service. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string applicationResourceName, string serviceResourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (applicationResourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "applicationResourceName"); + } + if (serviceResourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serviceResourceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("applicationResourceName", applicationResourceName); + tracingParameters.Add("serviceResourceName", serviceResourceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh/applications/{applicationResourceName}/services/{serviceResourceName}/replicas").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{applicationResourceName}", applicationResourceName); + _url = _url.Replace("{serviceResourceName}", serviceResourceName); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorModelException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorModel _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets replicas of a given service. + /// + /// + /// Gets the information about all replicas of a given service of an + /// application. The information includes the runtime properties of the replica + /// instance. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorModelException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorModel _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/ServiceReplicaOperationsExtensions.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/ServiceReplicaOperationsExtensions.cs new file mode 100644 index 000000000000..2fd17f6ec987 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/ServiceReplicaOperationsExtensions.cs @@ -0,0 +1,187 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ServiceReplicaOperations. + /// + public static partial class ServiceReplicaOperationsExtensions + { + /// + /// Gets the given replica of the service of an application. + /// + /// + /// Gets the information about the service replica with the given name. The + /// information include the description and other properties of the service + /// replica. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the application. + /// + /// + /// The identity of the service. + /// + /// + /// Service Fabric replica name. + /// + public static ServiceReplicaDescription Get(this IServiceReplicaOperations operations, string resourceGroupName, string applicationResourceName, string serviceResourceName, string replicaName) + { + return operations.GetAsync(resourceGroupName, applicationResourceName, serviceResourceName, replicaName).GetAwaiter().GetResult(); + } + + /// + /// Gets the given replica of the service of an application. + /// + /// + /// Gets the information about the service replica with the given name. The + /// information include the description and other properties of the service + /// replica. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the application. + /// + /// + /// The identity of the service. + /// + /// + /// Service Fabric replica name. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IServiceReplicaOperations operations, string resourceGroupName, string applicationResourceName, string serviceResourceName, string replicaName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, applicationResourceName, serviceResourceName, replicaName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets replicas of a given service. + /// + /// + /// Gets the information about all replicas of a given service of an + /// application. The information includes the runtime properties of the replica + /// instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the application. + /// + /// + /// The identity of the service. + /// + public static IPage List(this IServiceReplicaOperations operations, string resourceGroupName, string applicationResourceName, string serviceResourceName) + { + return operations.ListAsync(resourceGroupName, applicationResourceName, serviceResourceName).GetAwaiter().GetResult(); + } + + /// + /// Gets replicas of a given service. + /// + /// + /// Gets the information about all replicas of a given service of an + /// application. The information includes the runtime properties of the replica + /// instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the application. + /// + /// + /// The identity of the service. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IServiceReplicaOperations operations, string resourceGroupName, string applicationResourceName, string serviceResourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, applicationResourceName, serviceResourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets replicas of a given service. + /// + /// + /// Gets the information about all replicas of a given service of an + /// application. The information includes the runtime properties of the replica + /// instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IServiceReplicaOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets replicas of a given service. + /// + /// + /// Gets the information about all replicas of a given service of an + /// application. The information includes the runtime properties of the replica + /// instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IServiceReplicaOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/VolumeOperations.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/VolumeOperations.cs new file mode 100644 index 000000000000..c196325f9a25 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/VolumeOperations.cs @@ -0,0 +1,1341 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// VolumeOperations operations. + /// + internal partial class VolumeOperations : IServiceOperations, IVolumeOperations + { + /// + /// Initializes a new instance of the VolumeOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal VolumeOperations(ServiceFabricMeshManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ServiceFabricMeshManagementClient + /// + public ServiceFabricMeshManagementClient Client { get; private set; } + + /// + /// Creates or updates a volume resource. + /// + /// + /// Creates a volume resource with the specified name, description and + /// properties. If a volume resource with the same name exists, then it is + /// updated with the specified description and properties. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the volume. + /// + /// + /// Description for creating a Volume resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateWithHttpMessagesAsync(string resourceGroupName, string volumeResourceName, VolumeResourceDescription volumeResourceDescription, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (volumeResourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "volumeResourceName"); + } + if (volumeResourceDescription == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "volumeResourceDescription"); + } + if (volumeResourceDescription != null) + { + volumeResourceDescription.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("volumeResourceName", volumeResourceName); + tracingParameters.Add("volumeResourceDescription", volumeResourceDescription); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh/volumes/{volumeResourceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{volumeResourceName}", volumeResourceName); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(volumeResourceDescription != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(volumeResourceDescription, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201 && (int)_statusCode != 202) + { + var ex = new ErrorModelException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorModel _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets the volume resource with the given name. + /// + /// + /// Gets the information about the volume resource with the given name. The + /// information include the description and other properties of the volume. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the volume. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string volumeResourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (volumeResourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "volumeResourceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("volumeResourceName", volumeResourceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh/volumes/{volumeResourceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{volumeResourceName}", volumeResourceName); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorModelException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorModel _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes the volume resource. + /// + /// + /// Deletes the volume resource identified by the name. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the volume. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string volumeResourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (volumeResourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "volumeResourceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("volumeResourceName", volumeResourceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh/volumes/{volumeResourceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{volumeResourceName}", volumeResourceName); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorModelException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorModel _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets all the volume resources in a given resource group. + /// + /// + /// Gets the information about all volume resources in a given resource group. + /// The information include the description and other properties of the Volume. + /// + /// + /// Azure resource group name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh/volumes").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorModelException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorModel _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets all the volume resources in a given subscription. + /// + /// + /// Gets the information about all volume resources in a given resource group. + /// The information include the description and other properties of the volume. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabricMesh/volumes").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorModelException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorModel _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets all the volume resources in a given resource group. + /// + /// + /// Gets the information about all volume resources in a given resource group. + /// The information include the description and other properties of the Volume. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorModelException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorModel _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets all the volume resources in a given subscription. + /// + /// + /// Gets the information about all volume resources in a given resource group. + /// The information include the description and other properties of the volume. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListBySubscriptionNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorModelException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorModel _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/VolumeOperationsExtensions.cs b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/VolumeOperationsExtensions.cs new file mode 100644 index 000000000000..481c53ce5ed6 --- /dev/null +++ b/sdk/servicefabric/Microsoft.Azure.Management.ServiceFabricMesh/src/Generated/VolumeOperationsExtensions.cs @@ -0,0 +1,334 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ServiceFabricMesh +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for VolumeOperations. + /// + public static partial class VolumeOperationsExtensions + { + /// + /// Creates or updates a volume resource. + /// + /// + /// Creates a volume resource with the specified name, description and + /// properties. If a volume resource with the same name exists, then it is + /// updated with the specified description and properties. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the volume. + /// + /// + /// Description for creating a Volume resource. + /// + public static VolumeResourceDescription Create(this IVolumeOperations operations, string resourceGroupName, string volumeResourceName, VolumeResourceDescription volumeResourceDescription) + { + return operations.CreateAsync(resourceGroupName, volumeResourceName, volumeResourceDescription).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a volume resource. + /// + /// + /// Creates a volume resource with the specified name, description and + /// properties. If a volume resource with the same name exists, then it is + /// updated with the specified description and properties. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the volume. + /// + /// + /// Description for creating a Volume resource. + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IVolumeOperations operations, string resourceGroupName, string volumeResourceName, VolumeResourceDescription volumeResourceDescription, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, volumeResourceName, volumeResourceDescription, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the volume resource with the given name. + /// + /// + /// Gets the information about the volume resource with the given name. The + /// information include the description and other properties of the volume. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the volume. + /// + public static VolumeResourceDescription Get(this IVolumeOperations operations, string resourceGroupName, string volumeResourceName) + { + return operations.GetAsync(resourceGroupName, volumeResourceName).GetAwaiter().GetResult(); + } + + /// + /// Gets the volume resource with the given name. + /// + /// + /// Gets the information about the volume resource with the given name. The + /// information include the description and other properties of the volume. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the volume. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IVolumeOperations operations, string resourceGroupName, string volumeResourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, volumeResourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the volume resource. + /// + /// + /// Deletes the volume resource identified by the name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the volume. + /// + public static void Delete(this IVolumeOperations operations, string resourceGroupName, string volumeResourceName) + { + operations.DeleteAsync(resourceGroupName, volumeResourceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the volume resource. + /// + /// + /// Deletes the volume resource identified by the name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group name + /// + /// + /// The identity of the volume. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IVolumeOperations operations, string resourceGroupName, string volumeResourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, volumeResourceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets all the volume resources in a given resource group. + /// + /// + /// Gets the information about all volume resources in a given resource group. + /// The information include the description and other properties of the Volume. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group name + /// + public static IPage ListByResourceGroup(this IVolumeOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Gets all the volume resources in a given resource group. + /// + /// + /// Gets the information about all volume resources in a given resource group. + /// The information include the description and other properties of the Volume. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group name + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this IVolumeOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets all the volume resources in a given subscription. + /// + /// + /// Gets the information about all volume resources in a given resource group. + /// The information include the description and other properties of the volume. + /// + /// + /// The operations group for this extension method. + /// + public static IPage ListBySubscription(this IVolumeOperations operations) + { + return operations.ListBySubscriptionAsync().GetAwaiter().GetResult(); + } + + /// + /// Gets all the volume resources in a given subscription. + /// + /// + /// Gets the information about all volume resources in a given resource group. + /// The information include the description and other properties of the volume. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySubscriptionAsync(this IVolumeOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets all the volume resources in a given resource group. + /// + /// + /// Gets the information about all volume resources in a given resource group. + /// The information include the description and other properties of the Volume. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this IVolumeOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets all the volume resources in a given resource group. + /// + /// + /// Gets the information about all volume resources in a given resource group. + /// The information include the description and other properties of the Volume. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupNextAsync(this IVolumeOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets all the volume resources in a given subscription. + /// + /// + /// Gets the information about all volume resources in a given resource group. + /// The information include the description and other properties of the volume. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListBySubscriptionNext(this IVolumeOperations operations, string nextPageLink) + { + return operations.ListBySubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets all the volume resources in a given subscription. + /// + /// + /// Gets the information about all volume resources in a given resource group. + /// The information include the description and other properties of the volume. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySubscriptionNextAsync(this IVolumeOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +}