From 76db4028cb2120cec7f8ff4885c1f3465bd8156e Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 4 Feb 2021 01:49:21 +0000 Subject: [PATCH] CodeGen from PR 12639 in Azure/azure-rest-api-specs [Service Fabric Managed Clusters] 2021-01-01-preview (#12639) * add servicefabricmanagedclusters folder with 2020-01-01-preview specs * update swagger with version 2021-01-01-preview * fix validation errors * add required systemData param in resources and add missing formats * fix formats * add ipv4Address, fix clusterCertificateThumbprints and descriptions * fix patch (only tags), remvoe clusterVersions, fix nsg * remove unnecessary example * fix patch descriptions and full arm resource id for type version * fix sdk profile name * fix lastModifiedAt description and python sdk path * add missing applicationTypeVersionsCleanupPolicy * fix location description and app example params * remove after_scripts for python sdk Co-authored-by: Alfredo Santamaria Gomez --- .../ApplicationTypeVersionsOperations.cs | 1365 +++++++++++ ...icationTypeVersionsOperationsExtensions.cs | 507 +++++ .../Generated/ApplicationTypesOperations.cs | 1257 +++++++++++ .../ApplicationTypesOperationsExtensions.cs | 399 ++++ .../src/Generated/ApplicationsOperations.cs | 1309 +++++++++++ .../ApplicationsOperationsExtensions.cs | 455 ++++ .../IApplicationTypeVersionsOperations.cs | 306 +++ .../Generated/IApplicationTypesOperations.cs | 247 ++ .../src/Generated/IApplicationsOperations.cs | 280 +++ .../Generated/IManagedClustersOperations.cs | 309 +++ .../src/Generated/INodeTypesOperations.cs | 470 ++++ .../src/Generated/IOperations.cs | 81 + ...ceFabricManagedClustersManagementClient.cs | 110 + .../src/Generated/IServicesOperations.cs | 305 +++ .../Generated/ManagedClustersOperations.cs | 1604 +++++++++++++ .../ManagedClustersOperationsExtensions.cs | 493 ++++ .../src/Generated/Models/Access.cs | 22 + ...crementalNamedPartitionScalingMechanism.cs | 86 + .../Models/ApplicationHealthPolicy.cs | 130 ++ .../Generated/Models/ApplicationResource.cs | 122 + .../Models/ApplicationTypeResource.cs | 65 + .../Models/ApplicationTypeUpdateParameters.cs | 55 + .../Models/ApplicationTypeVersionResource.cs | 90 + .../ApplicationTypeVersionUpdateParameters.cs | 56 + .../ApplicationTypeVersionsCleanupPolicy.cs | 69 + .../Models/ApplicationUpdateParameters.cs | 55 + .../Models/ApplicationUpgradePolicy.cs | 146 ++ .../Models/ApplicationUserAssignedIdentity.cs | 78 + .../Models/AvailableOperationDisplay.cs | 77 + .../AveragePartitionLoadScalingTrigger.cs | 107 + .../AverageServiceLoadScalingTrigger.cs | 107 + .../Generated/Models/AzureActiveDirectory.cs | 69 + .../src/Generated/Models/ClientCertificate.cs | 91 + .../src/Generated/Models/CreatedByType.cs | 24 + .../src/Generated/Models/Direction.cs | 22 + .../Models/EndpointRangeDescription.cs | 69 + .../src/Generated/Models/ErrorModel.cs | 51 + .../src/Generated/Models/ErrorModelError.cs | 59 + .../Generated/Models/ErrorModelException.cs | 61 + .../src/Generated/Models/FailureAction.cs | 31 + .../src/Generated/Models/LoadBalancingRule.cs | 132 ++ .../src/Generated/Models/ManagedCluster.cs | 348 +++ .../Models/ManagedClusterUpdateParameters.cs | 55 + .../src/Generated/Models/ManagedIdentity.cs | 84 + .../Generated/Models/ManagedIdentityType.cs | 87 + .../Generated/Models/ManagedProxyResource.cs | 85 + .../src/Generated/Models/MoveCost.cs | 36 + .../Generated/Models/NamedPartitionScheme.cs | 68 + .../Generated/Models/NetworkSecurityRule.cs | 179 ++ .../src/Generated/Models/NodeType.cs | 273 +++ .../Models/NodeTypeActionParameters.cs | 75 + .../Models/NodeTypeUpdateParameters.cs | 53 + .../src/Generated/Models/NsgProtocol.cs | 27 + .../src/Generated/Models/OperationResult.cs | 86 + .../src/Generated/Models/Page.cs | 53 + .../src/Generated/Models/Partition.cs | 35 + .../PartitionInstanceCountScaleMechanism.cs | 85 + .../src/Generated/Models/PartitionScheme.cs | 35 + .../src/Generated/Models/ProbeProtocol.cs | 23 + .../src/Generated/Models/Protocol.cs | 22 + .../src/Generated/Models/ProxyResource.cs | 94 + .../src/Generated/Models/Resource.cs | 114 + .../Generated/Models/RollingUpgradeMode.cs | 30 + .../Models/RollingUpgradeMonitoringPolicy.cs | 128 ++ .../src/Generated/Models/ScalingMechanism.cs | 35 + .../src/Generated/Models/ScalingPolicy.cs | 81 + .../src/Generated/Models/ScalingTrigger.cs | 35 + .../Generated/Models/ServiceCorrelation.cs | 85 + .../Models/ServiceCorrelationScheme.cs | 34 + .../src/Generated/Models/ServiceKind.cs | 30 + .../src/Generated/Models/ServiceLoadMetric.cs | 118 + .../Models/ServiceLoadMetricWeight.cs | 39 + .../Models/ServicePackageActivationMode.cs | 30 + .../ServicePlacementInvalidDomainPolicy.cs | 72 + ...PlacementNonPartiallyPlaceServicePolicy.cs | 39 + .../Models/ServicePlacementPolicy.cs | 36 + .../Models/ServicePlacementPolicyType.cs | 57 + ...rvicePlacementPreferPrimaryDomainPolicy.cs | 84 + ...lacementRequireDomainDistributionPolicy.cs | 86 + .../ServicePlacementRequiredDomainPolicy.cs | 72 + .../src/Generated/Models/ServiceResource.cs | 199 ++ .../Models/ServiceResourceProperties.cs | 118 + .../Models/ServiceResourcePropertiesBase.cs | 98 + .../Models/ServiceScalingMechanismKind.cs | 30 + .../Models/ServiceScalingTriggerKind.cs | 30 + .../Models/ServiceTypeHealthPolicy.cs | 176 ++ .../Models/ServiceUpdateParameters.cs | 53 + .../Models/SettingsParameterDescription.cs | 79 + .../Models/SettingsSectionDescription.cs | 90 + .../Models/SingletonPartitionScheme.cs | 38 + .../src/Generated/Models/Sku.cs | 66 + .../Models/StatefulServiceProperties.cs | 177 ++ .../Models/StatelessServiceProperties.cs | 172 ++ .../src/Generated/Models/SubResource.cs | 53 + .../src/Generated/Models/SystemData.cs | 103 + .../UniformInt64RangePartitionScheme.cs | 91 + .../Generated/Models/UserAssignedIdentity.cs | 58 + .../src/Generated/Models/VMSSExtension.cs | 177 ++ .../src/Generated/Models/VaultCertificate.cs | 110 + .../src/Generated/Models/VaultSecretGroup.cs | 94 + .../src/Generated/Models/VmManagedIdentity.cs | 59 + .../src/Generated/NodeTypesOperations.cs | 1988 +++++++++++++++++ .../NodeTypesOperationsExtensions.cs | 781 +++++++ .../src/Generated/Operations.cs | 400 ++++ .../src/Generated/OperationsExtensions.cs | 105 + ...ceFabricManagedClustersManagementClient.cs | 33 + ...ceFabricManagedClustersManagementClient.cs | 408 ++++ .../src/Generated/ServicesOperations.cs | 1364 +++++++++++ .../Generated/ServicesOperationsExtensions.cs | 505 +++++ 109 files changed, 22034 insertions(+) create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/ApplicationTypeVersionsOperations.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/ApplicationTypeVersionsOperationsExtensions.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/ApplicationTypesOperations.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/ApplicationTypesOperationsExtensions.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/ApplicationsOperations.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/ApplicationsOperationsExtensions.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/IApplicationTypeVersionsOperations.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/IApplicationTypesOperations.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/IApplicationsOperations.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/IManagedClustersOperations.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/INodeTypesOperations.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/IOperations.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/IServiceFabricManagedClustersManagementClient.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/IServicesOperations.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/ManagedClustersOperations.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/ManagedClustersOperationsExtensions.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/Access.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/AddRemoveIncrementalNamedPartitionScalingMechanism.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ApplicationHealthPolicy.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ApplicationResource.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ApplicationTypeResource.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ApplicationTypeUpdateParameters.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ApplicationTypeVersionResource.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ApplicationTypeVersionUpdateParameters.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ApplicationTypeVersionsCleanupPolicy.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ApplicationUpdateParameters.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ApplicationUpgradePolicy.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ApplicationUserAssignedIdentity.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/AvailableOperationDisplay.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/AveragePartitionLoadScalingTrigger.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/AverageServiceLoadScalingTrigger.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/AzureActiveDirectory.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ClientCertificate.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/CreatedByType.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/Direction.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/EndpointRangeDescription.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ErrorModel.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ErrorModelError.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ErrorModelException.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/FailureAction.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/LoadBalancingRule.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ManagedCluster.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ManagedClusterUpdateParameters.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ManagedIdentity.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ManagedIdentityType.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ManagedProxyResource.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/MoveCost.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/NamedPartitionScheme.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/NetworkSecurityRule.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/NodeType.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/NodeTypeActionParameters.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/NodeTypeUpdateParameters.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/NsgProtocol.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/OperationResult.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/Page.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/Partition.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/PartitionInstanceCountScaleMechanism.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/PartitionScheme.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ProbeProtocol.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/Protocol.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ProxyResource.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/Resource.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/RollingUpgradeMode.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/RollingUpgradeMonitoringPolicy.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ScalingMechanism.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ScalingPolicy.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ScalingTrigger.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServiceCorrelation.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServiceCorrelationScheme.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServiceKind.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServiceLoadMetric.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServiceLoadMetricWeight.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServicePackageActivationMode.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServicePlacementInvalidDomainPolicy.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServicePlacementNonPartiallyPlaceServicePolicy.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServicePlacementPolicy.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServicePlacementPolicyType.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServicePlacementPreferPrimaryDomainPolicy.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServicePlacementRequireDomainDistributionPolicy.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServicePlacementRequiredDomainPolicy.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServiceResource.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServiceResourceProperties.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServiceResourcePropertiesBase.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServiceScalingMechanismKind.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServiceScalingTriggerKind.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServiceTypeHealthPolicy.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServiceUpdateParameters.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/SettingsParameterDescription.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/SettingsSectionDescription.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/SingletonPartitionScheme.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/Sku.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/StatefulServiceProperties.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/StatelessServiceProperties.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/SubResource.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/SystemData.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/UniformInt64RangePartitionScheme.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/UserAssignedIdentity.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/VMSSExtension.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/VaultCertificate.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/VaultSecretGroup.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/VmManagedIdentity.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/NodeTypesOperations.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/NodeTypesOperationsExtensions.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Operations.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/OperationsExtensions.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/SdkInfo_ServiceFabricManagedClustersManagementClient.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/ServiceFabricManagedClustersManagementClient.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/ServicesOperations.cs create mode 100644 sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/ServicesOperationsExtensions.cs diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/ApplicationTypeVersionsOperations.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/ApplicationTypeVersionsOperations.cs new file mode 100644 index 0000000000000..706eea4f54048 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/ApplicationTypeVersionsOperations.cs @@ -0,0 +1,1365 @@ +// +// 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.ServiceFabricManagedClusters +{ + 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; + + /// + /// ApplicationTypeVersionsOperations operations. + /// + internal partial class ApplicationTypeVersionsOperations : IServiceOperations, IApplicationTypeVersionsOperations + { + /// + /// Initializes a new instance of the ApplicationTypeVersionsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ApplicationTypeVersionsOperations(ServiceFabricManagedClustersManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ServiceFabricManagedClustersManagementClient + /// + public ServiceFabricManagedClustersManagementClient Client { get; private set; } + + /// + /// Gets a Service Fabric managed application type version resource. + /// + /// + /// Get a Service Fabric managed application type version resource created or + /// in the process of being created in the Service Fabric managed application + /// type name resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application type name resource. + /// + /// + /// The application type version. + /// + /// + /// 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 clusterName, string applicationTypeName, string version, 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 (clusterName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "clusterName"); + } + if (applicationTypeName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "applicationTypeName"); + } + if (version == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "version"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("clusterName", clusterName); + tracingParameters.Add("applicationTypeName", applicationTypeName); + tracingParameters.Add("version", version); + 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.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{clusterName}", System.Uri.EscapeDataString(clusterName)); + _url = _url.Replace("{applicationTypeName}", System.Uri.EscapeDataString(applicationTypeName)); + _url = _url.Replace("{version}", System.Uri.EscapeDataString(version)); + 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; + } + + /// + /// Creates or updates a Service Fabric managed application type version + /// resource. + /// + /// + /// Create or update a Service Fabric managed application type version resource + /// with the specified name. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application type name resource. + /// + /// + /// The application type version. + /// + /// + /// The application type version resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateWithHttpMessagesAsync(string resourceGroupName, string clusterName, string applicationTypeName, string version, ApplicationTypeVersionResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateWithHttpMessagesAsync(resourceGroupName, clusterName, applicationTypeName, version, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates the tags of an application type version resource of a given managed + /// cluster. + /// + /// + /// Updates the tags of an application type version resource of a given managed + /// cluster. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application type name resource. + /// + /// + /// The application type version. + /// + /// + /// Application type version update parameters + /// + /// + /// 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string clusterName, string applicationTypeName, string version, IDictionary tags = default(IDictionary), 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 (clusterName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "clusterName"); + } + if (applicationTypeName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "applicationTypeName"); + } + if (version == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "version"); + } + ApplicationTypeVersionUpdateParameters parameters = new ApplicationTypeVersionUpdateParameters(); + if (tags != null) + { + parameters.Tags = tags; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("clusterName", clusterName); + tracingParameters.Add("applicationTypeName", applicationTypeName); + tracingParameters.Add("version", version); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", 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.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{clusterName}", System.Uri.EscapeDataString(clusterName)); + _url = _url.Replace("{applicationTypeName}", System.Uri.EscapeDataString(applicationTypeName)); + _url = _url.Replace("{version}", System.Uri.EscapeDataString(version)); + 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("PATCH"); + _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(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, 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) + { + 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 a Service Fabric managed application type version resource. + /// + /// + /// Delete a Service Fabric managed application type version resource with the + /// specified name. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application type name resource. + /// + /// + /// The application type version. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string clusterName, string applicationTypeName, string version, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, clusterName, applicationTypeName, version, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the list of application type version resources created in the + /// specified Service Fabric managed application type name resource. + /// + /// + /// Gets all application type version resources created or in the process of + /// being created in the Service Fabric managed application type name resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application type name 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>> ListByApplicationTypesWithHttpMessagesAsync(string resourceGroupName, string clusterName, string applicationTypeName, 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 (clusterName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "clusterName"); + } + if (applicationTypeName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "applicationTypeName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("clusterName", clusterName); + tracingParameters.Add("applicationTypeName", applicationTypeName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByApplicationTypes", 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.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}/versions").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{clusterName}", System.Uri.EscapeDataString(clusterName)); + _url = _url.Replace("{applicationTypeName}", System.Uri.EscapeDataString(applicationTypeName)); + 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; + } + + /// + /// Creates or updates a Service Fabric managed application type version + /// resource. + /// + /// + /// Create or update a Service Fabric managed application type version resource + /// with the specified name. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application type name resource. + /// + /// + /// The application type version. + /// + /// + /// The application type version 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> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string clusterName, string applicationTypeName, string version, ApplicationTypeVersionResource parameters, 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 (clusterName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "clusterName"); + } + if (applicationTypeName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "applicationTypeName"); + } + if (version == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "version"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.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("clusterName", clusterName); + tracingParameters.Add("applicationTypeName", applicationTypeName); + tracingParameters.Add("version", version); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreate", 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.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{clusterName}", System.Uri.EscapeDataString(clusterName)); + _url = _url.Replace("{applicationTypeName}", System.Uri.EscapeDataString(applicationTypeName)); + _url = _url.Replace("{version}", System.Uri.EscapeDataString(version)); + 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(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, 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 != 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 == 202) + { + _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 a Service Fabric managed application type version resource. + /// + /// + /// Delete a Service Fabric managed application type version resource with the + /// specified name. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application type name resource. + /// + /// + /// The application type version. + /// + /// + /// 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 BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string clusterName, string applicationTypeName, string version, 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 (clusterName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "clusterName"); + } + if (applicationTypeName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "applicationTypeName"); + } + if (version == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "version"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("clusterName", clusterName); + tracingParameters.Add("applicationTypeName", applicationTypeName); + tracingParameters.Add("version", version); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", 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.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{clusterName}", System.Uri.EscapeDataString(clusterName)); + _url = _url.Replace("{applicationTypeName}", System.Uri.EscapeDataString(applicationTypeName)); + _url = _url.Replace("{version}", System.Uri.EscapeDataString(version)); + 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 the list of application type version resources created in the + /// specified Service Fabric managed application type name resource. + /// + /// + /// Gets all application type version resources created or in the process of + /// being created in the Service Fabric managed application type name resource. + /// + /// + /// 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>> ListByApplicationTypesNextWithHttpMessagesAsync(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, "ListByApplicationTypesNext", 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/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/ApplicationTypeVersionsOperationsExtensions.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/ApplicationTypeVersionsOperationsExtensions.cs new file mode 100644 index 0000000000000..5b3108eea1451 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/ApplicationTypeVersionsOperationsExtensions.cs @@ -0,0 +1,507 @@ +// +// 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.ServiceFabricManagedClusters +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ApplicationTypeVersionsOperations. + /// + public static partial class ApplicationTypeVersionsOperationsExtensions + { + /// + /// Gets a Service Fabric managed application type version resource. + /// + /// + /// Get a Service Fabric managed application type version resource created or + /// in the process of being created in the Service Fabric managed application + /// type name resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application type name resource. + /// + /// + /// The application type version. + /// + public static ApplicationTypeVersionResource Get(this IApplicationTypeVersionsOperations operations, string resourceGroupName, string clusterName, string applicationTypeName, string version) + { + return operations.GetAsync(resourceGroupName, clusterName, applicationTypeName, version).GetAwaiter().GetResult(); + } + + /// + /// Gets a Service Fabric managed application type version resource. + /// + /// + /// Get a Service Fabric managed application type version resource created or + /// in the process of being created in the Service Fabric managed application + /// type name resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application type name resource. + /// + /// + /// The application type version. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IApplicationTypeVersionsOperations operations, string resourceGroupName, string clusterName, string applicationTypeName, string version, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, clusterName, applicationTypeName, version, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates a Service Fabric managed application type version + /// resource. + /// + /// + /// Create or update a Service Fabric managed application type version resource + /// with the specified name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application type name resource. + /// + /// + /// The application type version. + /// + /// + /// The application type version resource. + /// + public static ApplicationTypeVersionResource Create(this IApplicationTypeVersionsOperations operations, string resourceGroupName, string clusterName, string applicationTypeName, string version, ApplicationTypeVersionResource parameters) + { + return operations.CreateAsync(resourceGroupName, clusterName, applicationTypeName, version, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a Service Fabric managed application type version + /// resource. + /// + /// + /// Create or update a Service Fabric managed application type version resource + /// with the specified name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application type name resource. + /// + /// + /// The application type version. + /// + /// + /// The application type version resource. + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IApplicationTypeVersionsOperations operations, string resourceGroupName, string clusterName, string applicationTypeName, string version, ApplicationTypeVersionResource parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, clusterName, applicationTypeName, version, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates the tags of an application type version resource of a given managed + /// cluster. + /// + /// + /// Updates the tags of an application type version resource of a given managed + /// cluster. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application type name resource. + /// + /// + /// The application type version. + /// + /// + /// Application type version update parameters + /// + public static ApplicationTypeVersionResource Update(this IApplicationTypeVersionsOperations operations, string resourceGroupName, string clusterName, string applicationTypeName, string version, IDictionary tags = default(IDictionary)) + { + return operations.UpdateAsync(resourceGroupName, clusterName, applicationTypeName, version, tags).GetAwaiter().GetResult(); + } + + /// + /// Updates the tags of an application type version resource of a given managed + /// cluster. + /// + /// + /// Updates the tags of an application type version resource of a given managed + /// cluster. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application type name resource. + /// + /// + /// The application type version. + /// + /// + /// Application type version update parameters + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IApplicationTypeVersionsOperations operations, string resourceGroupName, string clusterName, string applicationTypeName, string version, IDictionary tags = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, clusterName, applicationTypeName, version, tags, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a Service Fabric managed application type version resource. + /// + /// + /// Delete a Service Fabric managed application type version resource with the + /// specified name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application type name resource. + /// + /// + /// The application type version. + /// + public static void Delete(this IApplicationTypeVersionsOperations operations, string resourceGroupName, string clusterName, string applicationTypeName, string version) + { + operations.DeleteAsync(resourceGroupName, clusterName, applicationTypeName, version).GetAwaiter().GetResult(); + } + + /// + /// Deletes a Service Fabric managed application type version resource. + /// + /// + /// Delete a Service Fabric managed application type version resource with the + /// specified name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application type name resource. + /// + /// + /// The application type version. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IApplicationTypeVersionsOperations operations, string resourceGroupName, string clusterName, string applicationTypeName, string version, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, clusterName, applicationTypeName, version, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets the list of application type version resources created in the + /// specified Service Fabric managed application type name resource. + /// + /// + /// Gets all application type version resources created or in the process of + /// being created in the Service Fabric managed application type name resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application type name resource. + /// + public static IPage ListByApplicationTypes(this IApplicationTypeVersionsOperations operations, string resourceGroupName, string clusterName, string applicationTypeName) + { + return operations.ListByApplicationTypesAsync(resourceGroupName, clusterName, applicationTypeName).GetAwaiter().GetResult(); + } + + /// + /// Gets the list of application type version resources created in the + /// specified Service Fabric managed application type name resource. + /// + /// + /// Gets all application type version resources created or in the process of + /// being created in the Service Fabric managed application type name resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application type name resource. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByApplicationTypesAsync(this IApplicationTypeVersionsOperations operations, string resourceGroupName, string clusterName, string applicationTypeName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByApplicationTypesWithHttpMessagesAsync(resourceGroupName, clusterName, applicationTypeName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates a Service Fabric managed application type version + /// resource. + /// + /// + /// Create or update a Service Fabric managed application type version resource + /// with the specified name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application type name resource. + /// + /// + /// The application type version. + /// + /// + /// The application type version resource. + /// + public static ApplicationTypeVersionResource BeginCreate(this IApplicationTypeVersionsOperations operations, string resourceGroupName, string clusterName, string applicationTypeName, string version, ApplicationTypeVersionResource parameters) + { + return operations.BeginCreateAsync(resourceGroupName, clusterName, applicationTypeName, version, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a Service Fabric managed application type version + /// resource. + /// + /// + /// Create or update a Service Fabric managed application type version resource + /// with the specified name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application type name resource. + /// + /// + /// The application type version. + /// + /// + /// The application type version resource. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateAsync(this IApplicationTypeVersionsOperations operations, string resourceGroupName, string clusterName, string applicationTypeName, string version, ApplicationTypeVersionResource parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateWithHttpMessagesAsync(resourceGroupName, clusterName, applicationTypeName, version, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a Service Fabric managed application type version resource. + /// + /// + /// Delete a Service Fabric managed application type version resource with the + /// specified name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application type name resource. + /// + /// + /// The application type version. + /// + public static void BeginDelete(this IApplicationTypeVersionsOperations operations, string resourceGroupName, string clusterName, string applicationTypeName, string version) + { + operations.BeginDeleteAsync(resourceGroupName, clusterName, applicationTypeName, version).GetAwaiter().GetResult(); + } + + /// + /// Deletes a Service Fabric managed application type version resource. + /// + /// + /// Delete a Service Fabric managed application type version resource with the + /// specified name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application type name resource. + /// + /// + /// The application type version. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IApplicationTypeVersionsOperations operations, string resourceGroupName, string clusterName, string applicationTypeName, string version, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, clusterName, applicationTypeName, version, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets the list of application type version resources created in the + /// specified Service Fabric managed application type name resource. + /// + /// + /// Gets all application type version resources created or in the process of + /// being created in the Service Fabric managed application type name resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByApplicationTypesNext(this IApplicationTypeVersionsOperations operations, string nextPageLink) + { + return operations.ListByApplicationTypesNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets the list of application type version resources created in the + /// specified Service Fabric managed application type name resource. + /// + /// + /// Gets all application type version resources created or in the process of + /// being created in the Service Fabric managed application type name resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByApplicationTypesNextAsync(this IApplicationTypeVersionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByApplicationTypesNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/ApplicationTypesOperations.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/ApplicationTypesOperations.cs new file mode 100644 index 0000000000000..d6b655b1430cf --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/ApplicationTypesOperations.cs @@ -0,0 +1,1257 @@ +// +// 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.ServiceFabricManagedClusters +{ + 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; + + /// + /// ApplicationTypesOperations operations. + /// + internal partial class ApplicationTypesOperations : IServiceOperations, IApplicationTypesOperations + { + /// + /// Initializes a new instance of the ApplicationTypesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ApplicationTypesOperations(ServiceFabricManagedClustersManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ServiceFabricManagedClustersManagementClient + /// + public ServiceFabricManagedClustersManagementClient Client { get; private set; } + + /// + /// Gets a Service Fabric managed application type name resource. + /// + /// + /// Get a Service Fabric application type name resource created or in the + /// process of being created in the Service Fabric managed cluster resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application type name 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 clusterName, string applicationTypeName, 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 (clusterName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "clusterName"); + } + if (applicationTypeName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "applicationTypeName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("clusterName", clusterName); + tracingParameters.Add("applicationTypeName", applicationTypeName); + 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.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{clusterName}", System.Uri.EscapeDataString(clusterName)); + _url = _url.Replace("{applicationTypeName}", System.Uri.EscapeDataString(applicationTypeName)); + 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; + } + + /// + /// Creates or updates a Service Fabric managed application type name resource. + /// + /// + /// Create or update a Service Fabric managed application type name resource + /// with the specified name. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application type name resource. + /// + /// + /// The application type name 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 clusterName, string applicationTypeName, ApplicationTypeResource parameters, 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 (clusterName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "clusterName"); + } + if (applicationTypeName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "applicationTypeName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("clusterName", clusterName); + tracingParameters.Add("applicationTypeName", applicationTypeName); + tracingParameters.Add("parameters", parameters); + 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.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{clusterName}", System.Uri.EscapeDataString(clusterName)); + _url = _url.Replace("{applicationTypeName}", System.Uri.EscapeDataString(applicationTypeName)); + 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(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, 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) + { + 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; + } + + /// + /// Updates the tags of an application type resource of a given managed + /// cluster. + /// + /// + /// Updates the tags of an application type resource of a given managed + /// cluster. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application type name resource. + /// + /// + /// Application type update parameters + /// + /// + /// 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string clusterName, string applicationTypeName, IDictionary tags = default(IDictionary), 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 (clusterName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "clusterName"); + } + if (applicationTypeName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "applicationTypeName"); + } + ApplicationTypeUpdateParameters parameters = new ApplicationTypeUpdateParameters(); + if (tags != null) + { + parameters.Tags = tags; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("clusterName", clusterName); + tracingParameters.Add("applicationTypeName", applicationTypeName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", 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.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{clusterName}", System.Uri.EscapeDataString(clusterName)); + _url = _url.Replace("{applicationTypeName}", System.Uri.EscapeDataString(applicationTypeName)); + 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("PATCH"); + _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(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, 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) + { + 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 a Service Fabric managed application type name resource. + /// + /// + /// Delete a Service Fabric managed application type name resource with the + /// specified name. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application type name resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string clusterName, string applicationTypeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, clusterName, applicationTypeName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the list of application type name resources created in the specified + /// Service Fabric managed cluster resource. + /// + /// + /// Gets all application type name resources created or in the process of being + /// created in the Service Fabric managed cluster resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster 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 clusterName, 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 (clusterName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "clusterName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("clusterName", clusterName); + 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.ServiceFabric/managedclusters/{clusterName}/applicationTypes").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{clusterName}", System.Uri.EscapeDataString(clusterName)); + 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 a Service Fabric managed application type name resource. + /// + /// + /// Delete a Service Fabric managed application type name resource with the + /// specified name. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application type name 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 BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string clusterName, string applicationTypeName, 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 (clusterName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "clusterName"); + } + if (applicationTypeName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "applicationTypeName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("clusterName", clusterName); + tracingParameters.Add("applicationTypeName", applicationTypeName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", 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.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{clusterName}", System.Uri.EscapeDataString(clusterName)); + _url = _url.Replace("{applicationTypeName}", System.Uri.EscapeDataString(applicationTypeName)); + 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 the list of application type name resources created in the specified + /// Service Fabric managed cluster resource. + /// + /// + /// Gets all application type name resources created or in the process of being + /// created in the Service Fabric managed cluster resource. + /// + /// + /// 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/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/ApplicationTypesOperationsExtensions.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/ApplicationTypesOperationsExtensions.cs new file mode 100644 index 0000000000000..c8239fe4f9331 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/ApplicationTypesOperationsExtensions.cs @@ -0,0 +1,399 @@ +// +// 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.ServiceFabricManagedClusters +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ApplicationTypesOperations. + /// + public static partial class ApplicationTypesOperationsExtensions + { + /// + /// Gets a Service Fabric managed application type name resource. + /// + /// + /// Get a Service Fabric application type name resource created or in the + /// process of being created in the Service Fabric managed cluster resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application type name resource. + /// + public static ApplicationTypeResource Get(this IApplicationTypesOperations operations, string resourceGroupName, string clusterName, string applicationTypeName) + { + return operations.GetAsync(resourceGroupName, clusterName, applicationTypeName).GetAwaiter().GetResult(); + } + + /// + /// Gets a Service Fabric managed application type name resource. + /// + /// + /// Get a Service Fabric application type name resource created or in the + /// process of being created in the Service Fabric managed cluster resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application type name resource. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IApplicationTypesOperations operations, string resourceGroupName, string clusterName, string applicationTypeName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, clusterName, applicationTypeName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates a Service Fabric managed application type name resource. + /// + /// + /// Create or update a Service Fabric managed application type name resource + /// with the specified name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application type name resource. + /// + /// + /// The application type name resource. + /// + public static ApplicationTypeResource Create(this IApplicationTypesOperations operations, string resourceGroupName, string clusterName, string applicationTypeName, ApplicationTypeResource parameters) + { + return operations.CreateAsync(resourceGroupName, clusterName, applicationTypeName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a Service Fabric managed application type name resource. + /// + /// + /// Create or update a Service Fabric managed application type name resource + /// with the specified name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application type name resource. + /// + /// + /// The application type name resource. + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IApplicationTypesOperations operations, string resourceGroupName, string clusterName, string applicationTypeName, ApplicationTypeResource parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, clusterName, applicationTypeName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates the tags of an application type resource of a given managed + /// cluster. + /// + /// + /// Updates the tags of an application type resource of a given managed + /// cluster. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application type name resource. + /// + /// + /// Application type update parameters + /// + public static ApplicationTypeResource Update(this IApplicationTypesOperations operations, string resourceGroupName, string clusterName, string applicationTypeName, IDictionary tags = default(IDictionary)) + { + return operations.UpdateAsync(resourceGroupName, clusterName, applicationTypeName, tags).GetAwaiter().GetResult(); + } + + /// + /// Updates the tags of an application type resource of a given managed + /// cluster. + /// + /// + /// Updates the tags of an application type resource of a given managed + /// cluster. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application type name resource. + /// + /// + /// Application type update parameters + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IApplicationTypesOperations operations, string resourceGroupName, string clusterName, string applicationTypeName, IDictionary tags = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, clusterName, applicationTypeName, tags, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a Service Fabric managed application type name resource. + /// + /// + /// Delete a Service Fabric managed application type name resource with the + /// specified name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application type name resource. + /// + public static void Delete(this IApplicationTypesOperations operations, string resourceGroupName, string clusterName, string applicationTypeName) + { + operations.DeleteAsync(resourceGroupName, clusterName, applicationTypeName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a Service Fabric managed application type name resource. + /// + /// + /// Delete a Service Fabric managed application type name resource with the + /// specified name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application type name resource. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IApplicationTypesOperations operations, string resourceGroupName, string clusterName, string applicationTypeName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, clusterName, applicationTypeName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets the list of application type name resources created in the specified + /// Service Fabric managed cluster resource. + /// + /// + /// Gets all application type name resources created or in the process of being + /// created in the Service Fabric managed cluster resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + public static IPage List(this IApplicationTypesOperations operations, string resourceGroupName, string clusterName) + { + return operations.ListAsync(resourceGroupName, clusterName).GetAwaiter().GetResult(); + } + + /// + /// Gets the list of application type name resources created in the specified + /// Service Fabric managed cluster resource. + /// + /// + /// Gets all application type name resources created or in the process of being + /// created in the Service Fabric managed cluster resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IApplicationTypesOperations operations, string resourceGroupName, string clusterName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, clusterName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a Service Fabric managed application type name resource. + /// + /// + /// Delete a Service Fabric managed application type name resource with the + /// specified name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application type name resource. + /// + public static void BeginDelete(this IApplicationTypesOperations operations, string resourceGroupName, string clusterName, string applicationTypeName) + { + operations.BeginDeleteAsync(resourceGroupName, clusterName, applicationTypeName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a Service Fabric managed application type name resource. + /// + /// + /// Delete a Service Fabric managed application type name resource with the + /// specified name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application type name resource. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IApplicationTypesOperations operations, string resourceGroupName, string clusterName, string applicationTypeName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, clusterName, applicationTypeName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets the list of application type name resources created in the specified + /// Service Fabric managed cluster resource. + /// + /// + /// Gets all application type name resources created or in the process of being + /// created in the Service Fabric managed cluster resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IApplicationTypesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets the list of application type name resources created in the specified + /// Service Fabric managed cluster resource. + /// + /// + /// Gets all application type name resources created or in the process of being + /// created in the Service Fabric managed cluster resource. + /// + /// + /// 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 IApplicationTypesOperations 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/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/ApplicationsOperations.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/ApplicationsOperations.cs new file mode 100644 index 0000000000000..54ba7f7ef9cb0 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/ApplicationsOperations.cs @@ -0,0 +1,1309 @@ +// +// 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.ServiceFabricManagedClusters +{ + 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; + + /// + /// ApplicationsOperations operations. + /// + internal partial class ApplicationsOperations : IServiceOperations, IApplicationsOperations + { + /// + /// Initializes a new instance of the ApplicationsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ApplicationsOperations(ServiceFabricManagedClustersManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ServiceFabricManagedClustersManagementClient + /// + public ServiceFabricManagedClustersManagementClient Client { get; private set; } + + /// + /// Gets a Service Fabric managed application resource. + /// + /// + /// Get a Service Fabric managed application resource created or in the process + /// of being created in the Service Fabric cluster resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the 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> GetWithHttpMessagesAsync(string resourceGroupName, string clusterName, string applicationName, 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 (clusterName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "clusterName"); + } + if (applicationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "applicationName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("clusterName", clusterName); + tracingParameters.Add("applicationName", applicationName); + 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.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{clusterName}", System.Uri.EscapeDataString(clusterName)); + _url = _url.Replace("{applicationName}", System.Uri.EscapeDataString(applicationName)); + 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; + } + + /// + /// Creates or updates a Service Fabric managed application resource. + /// + /// + /// Create or update a Service Fabric managed application resource with the + /// specified name. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application resource. + /// + /// + /// The application resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateWithHttpMessagesAsync(string resourceGroupName, string clusterName, string applicationName, ApplicationResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateWithHttpMessagesAsync(resourceGroupName, clusterName, applicationName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates the tags of an application resource of a given managed cluster. + /// + /// + /// Updates the tags of an application resource of a given managed cluster. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application resource. + /// + /// + /// Application update parameters + /// + /// + /// 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string clusterName, string applicationName, IDictionary tags = default(IDictionary), 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 (clusterName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "clusterName"); + } + if (applicationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "applicationName"); + } + ApplicationUpdateParameters parameters = new ApplicationUpdateParameters(); + if (tags != null) + { + parameters.Tags = tags; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("clusterName", clusterName); + tracingParameters.Add("applicationName", applicationName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", 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.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{clusterName}", System.Uri.EscapeDataString(clusterName)); + _url = _url.Replace("{applicationName}", System.Uri.EscapeDataString(applicationName)); + 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("PATCH"); + _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(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, 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) + { + 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 a Service Fabric managed application resource. + /// + /// + /// Delete a Service Fabric managed application resource with the specified + /// name. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string clusterName, string applicationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, clusterName, applicationName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the list of managed application resources created in the specified + /// Service Fabric cluster resource. + /// + /// + /// Gets all managed application resources created or in the process of being + /// created in the Service Fabric cluster resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster 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 clusterName, 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 (clusterName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "clusterName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("clusterName", clusterName); + 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.ServiceFabric/managedclusters/{clusterName}/applications").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{clusterName}", System.Uri.EscapeDataString(clusterName)); + 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; + } + + /// + /// Creates or updates a Service Fabric managed application resource. + /// + /// + /// Create or update a Service Fabric managed application resource with the + /// specified name. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application resource. + /// + /// + /// The 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> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string clusterName, string applicationName, ApplicationResource parameters, 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 (clusterName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "clusterName"); + } + if (applicationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "applicationName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.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("clusterName", clusterName); + tracingParameters.Add("applicationName", applicationName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreate", 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.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{clusterName}", System.Uri.EscapeDataString(clusterName)); + _url = _url.Replace("{applicationName}", System.Uri.EscapeDataString(applicationName)); + 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(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, 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 != 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 == 202) + { + _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 a Service Fabric managed application resource. + /// + /// + /// Delete a Service Fabric managed application resource with the specified + /// name. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application 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 BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string clusterName, string applicationName, 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 (clusterName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "clusterName"); + } + if (applicationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "applicationName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("clusterName", clusterName); + tracingParameters.Add("applicationName", applicationName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", 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.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{clusterName}", System.Uri.EscapeDataString(clusterName)); + _url = _url.Replace("{applicationName}", System.Uri.EscapeDataString(applicationName)); + 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 the list of managed application resources created in the specified + /// Service Fabric cluster resource. + /// + /// + /// Gets all managed application resources created or in the process of being + /// created in the Service Fabric cluster resource. + /// + /// + /// 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/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/ApplicationsOperationsExtensions.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/ApplicationsOperationsExtensions.cs new file mode 100644 index 0000000000000..58f613d54a726 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/ApplicationsOperationsExtensions.cs @@ -0,0 +1,455 @@ +// +// 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.ServiceFabricManagedClusters +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ApplicationsOperations. + /// + public static partial class ApplicationsOperationsExtensions + { + /// + /// Gets a Service Fabric managed application resource. + /// + /// + /// Get a Service Fabric managed application resource created or in the process + /// of being created in the Service Fabric cluster resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application resource. + /// + public static ApplicationResource Get(this IApplicationsOperations operations, string resourceGroupName, string clusterName, string applicationName) + { + return operations.GetAsync(resourceGroupName, clusterName, applicationName).GetAwaiter().GetResult(); + } + + /// + /// Gets a Service Fabric managed application resource. + /// + /// + /// Get a Service Fabric managed application resource created or in the process + /// of being created in the Service Fabric cluster resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application resource. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IApplicationsOperations operations, string resourceGroupName, string clusterName, string applicationName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, clusterName, applicationName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates a Service Fabric managed application resource. + /// + /// + /// Create or update a Service Fabric managed application resource with the + /// specified name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application resource. + /// + /// + /// The application resource. + /// + public static ApplicationResource Create(this IApplicationsOperations operations, string resourceGroupName, string clusterName, string applicationName, ApplicationResource parameters) + { + return operations.CreateAsync(resourceGroupName, clusterName, applicationName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a Service Fabric managed application resource. + /// + /// + /// Create or update a Service Fabric managed application resource with the + /// specified name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application resource. + /// + /// + /// The application resource. + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IApplicationsOperations operations, string resourceGroupName, string clusterName, string applicationName, ApplicationResource parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, clusterName, applicationName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates the tags of an application resource of a given managed cluster. + /// + /// + /// Updates the tags of an application resource of a given managed cluster. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application resource. + /// + /// + /// Application update parameters + /// + public static ApplicationResource Update(this IApplicationsOperations operations, string resourceGroupName, string clusterName, string applicationName, IDictionary tags = default(IDictionary)) + { + return operations.UpdateAsync(resourceGroupName, clusterName, applicationName, tags).GetAwaiter().GetResult(); + } + + /// + /// Updates the tags of an application resource of a given managed cluster. + /// + /// + /// Updates the tags of an application resource of a given managed cluster. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application resource. + /// + /// + /// Application update parameters + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IApplicationsOperations operations, string resourceGroupName, string clusterName, string applicationName, IDictionary tags = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, clusterName, applicationName, tags, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a Service Fabric managed application resource. + /// + /// + /// Delete a Service Fabric managed application resource with the specified + /// name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application resource. + /// + public static void Delete(this IApplicationsOperations operations, string resourceGroupName, string clusterName, string applicationName) + { + operations.DeleteAsync(resourceGroupName, clusterName, applicationName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a Service Fabric managed application resource. + /// + /// + /// Delete a Service Fabric managed application resource with the specified + /// name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application resource. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IApplicationsOperations operations, string resourceGroupName, string clusterName, string applicationName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, clusterName, applicationName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets the list of managed application resources created in the specified + /// Service Fabric cluster resource. + /// + /// + /// Gets all managed application resources created or in the process of being + /// created in the Service Fabric cluster resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + public static IPage List(this IApplicationsOperations operations, string resourceGroupName, string clusterName) + { + return operations.ListAsync(resourceGroupName, clusterName).GetAwaiter().GetResult(); + } + + /// + /// Gets the list of managed application resources created in the specified + /// Service Fabric cluster resource. + /// + /// + /// Gets all managed application resources created or in the process of being + /// created in the Service Fabric cluster resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IApplicationsOperations operations, string resourceGroupName, string clusterName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, clusterName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates a Service Fabric managed application resource. + /// + /// + /// Create or update a Service Fabric managed application resource with the + /// specified name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application resource. + /// + /// + /// The application resource. + /// + public static ApplicationResource BeginCreate(this IApplicationsOperations operations, string resourceGroupName, string clusterName, string applicationName, ApplicationResource parameters) + { + return operations.BeginCreateAsync(resourceGroupName, clusterName, applicationName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a Service Fabric managed application resource. + /// + /// + /// Create or update a Service Fabric managed application resource with the + /// specified name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application resource. + /// + /// + /// The application resource. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateAsync(this IApplicationsOperations operations, string resourceGroupName, string clusterName, string applicationName, ApplicationResource parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateWithHttpMessagesAsync(resourceGroupName, clusterName, applicationName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a Service Fabric managed application resource. + /// + /// + /// Delete a Service Fabric managed application resource with the specified + /// name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application resource. + /// + public static void BeginDelete(this IApplicationsOperations operations, string resourceGroupName, string clusterName, string applicationName) + { + operations.BeginDeleteAsync(resourceGroupName, clusterName, applicationName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a Service Fabric managed application resource. + /// + /// + /// Delete a Service Fabric managed application resource with the specified + /// name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application resource. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IApplicationsOperations operations, string resourceGroupName, string clusterName, string applicationName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, clusterName, applicationName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets the list of managed application resources created in the specified + /// Service Fabric cluster resource. + /// + /// + /// Gets all managed application resources created or in the process of being + /// created in the Service Fabric cluster resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IApplicationsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets the list of managed application resources created in the specified + /// Service Fabric cluster resource. + /// + /// + /// Gets all managed application resources created or in the process of being + /// created in the Service Fabric cluster resource. + /// + /// + /// 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 IApplicationsOperations 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/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/IApplicationTypeVersionsOperations.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/IApplicationTypeVersionsOperations.cs new file mode 100644 index 0000000000000..2e6a0b2418213 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/IApplicationTypeVersionsOperations.cs @@ -0,0 +1,306 @@ +// +// 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.ServiceFabricManagedClusters +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ApplicationTypeVersionsOperations operations. + /// + public partial interface IApplicationTypeVersionsOperations + { + /// + /// Gets a Service Fabric managed application type version resource. + /// + /// + /// Get a Service Fabric managed application type version resource + /// created or in the process of being created in the Service Fabric + /// managed application type name resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application type name resource. + /// + /// + /// The application type version. + /// + /// + /// 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 clusterName, string applicationTypeName, string version, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates a Service Fabric managed application type + /// version resource. + /// + /// + /// Create or update a Service Fabric managed application type version + /// resource with the specified name. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application type name resource. + /// + /// + /// The application type version. + /// + /// + /// The application type version 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 clusterName, string applicationTypeName, string version, ApplicationTypeVersionResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates the tags of an application type version resource of a given + /// managed cluster. + /// + /// + /// Updates the tags of an application type version resource of a given + /// managed cluster. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application type name resource. + /// + /// + /// The application type version. + /// + /// + /// Application type version update parameters + /// + /// + /// 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string clusterName, string applicationTypeName, string version, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a Service Fabric managed application type version resource. + /// + /// + /// Delete a Service Fabric managed application type version resource + /// with the specified name. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application type name resource. + /// + /// + /// The application type version. + /// + /// + /// 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 clusterName, string applicationTypeName, string version, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the list of application type version resources created in the + /// specified Service Fabric managed application type name resource. + /// + /// + /// Gets all application type version resources created or in the + /// process of being created in the Service Fabric managed application + /// type name resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application type name 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>> ListByApplicationTypesWithHttpMessagesAsync(string resourceGroupName, string clusterName, string applicationTypeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates a Service Fabric managed application type + /// version resource. + /// + /// + /// Create or update a Service Fabric managed application type version + /// resource with the specified name. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application type name resource. + /// + /// + /// The application type version. + /// + /// + /// The application type version 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> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string clusterName, string applicationTypeName, string version, ApplicationTypeVersionResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a Service Fabric managed application type version resource. + /// + /// + /// Delete a Service Fabric managed application type version resource + /// with the specified name. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application type name resource. + /// + /// + /// The application type version. + /// + /// + /// 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 BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string clusterName, string applicationTypeName, string version, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the list of application type version resources created in the + /// specified Service Fabric managed application type name resource. + /// + /// + /// Gets all application type version resources created or in the + /// process of being created in the Service Fabric managed application + /// type name resource. + /// + /// + /// 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>> ListByApplicationTypesNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/IApplicationTypesOperations.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/IApplicationTypesOperations.cs new file mode 100644 index 0000000000000..afa8769bcb6e2 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/IApplicationTypesOperations.cs @@ -0,0 +1,247 @@ +// +// 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.ServiceFabricManagedClusters +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ApplicationTypesOperations operations. + /// + public partial interface IApplicationTypesOperations + { + /// + /// Gets a Service Fabric managed application type name resource. + /// + /// + /// Get a Service Fabric application type name resource created or in + /// the process of being created in the Service Fabric managed cluster + /// resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application type name 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 clusterName, string applicationTypeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates a Service Fabric managed application type name + /// resource. + /// + /// + /// Create or update a Service Fabric managed application type name + /// resource with the specified name. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application type name resource. + /// + /// + /// The application type name 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 clusterName, string applicationTypeName, ApplicationTypeResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates the tags of an application type resource of a given managed + /// cluster. + /// + /// + /// Updates the tags of an application type resource of a given managed + /// cluster. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application type name resource. + /// + /// + /// Application type update parameters + /// + /// + /// 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string clusterName, string applicationTypeName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a Service Fabric managed application type name resource. + /// + /// + /// Delete a Service Fabric managed application type name resource with + /// the specified name. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application type name 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 clusterName, string applicationTypeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the list of application type name resources created in the + /// specified Service Fabric managed cluster resource. + /// + /// + /// Gets all application type name resources created or in the process + /// of being created in the Service Fabric managed cluster resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster 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 clusterName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a Service Fabric managed application type name resource. + /// + /// + /// Delete a Service Fabric managed application type name resource with + /// the specified name. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application type name 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 BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string clusterName, string applicationTypeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the list of application type name resources created in the + /// specified Service Fabric managed cluster resource. + /// + /// + /// Gets all application type name resources created or in the process + /// of being created in the Service Fabric managed cluster resource. + /// + /// + /// 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/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/IApplicationsOperations.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/IApplicationsOperations.cs new file mode 100644 index 0000000000000..13898eb90c114 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/IApplicationsOperations.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.ServiceFabricManagedClusters +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ApplicationsOperations operations. + /// + public partial interface IApplicationsOperations + { + /// + /// Gets a Service Fabric managed application resource. + /// + /// + /// Get a Service Fabric managed application resource created or in the + /// process of being created in the Service Fabric cluster resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the 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> GetWithHttpMessagesAsync(string resourceGroupName, string clusterName, string applicationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates a Service Fabric managed application resource. + /// + /// + /// Create or update a Service Fabric managed application resource with + /// the specified name. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application resource. + /// + /// + /// The 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 clusterName, string applicationName, ApplicationResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates the tags of an application resource of a given managed + /// cluster. + /// + /// + /// Updates the tags of an application resource of a given managed + /// cluster. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application resource. + /// + /// + /// Application update parameters + /// + /// + /// 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string clusterName, string applicationName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a Service Fabric managed application resource. + /// + /// + /// Delete a Service Fabric managed application resource with the + /// specified name. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application 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 clusterName, string applicationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the list of managed application resources created in the + /// specified Service Fabric cluster resource. + /// + /// + /// Gets all managed application resources created or in the process of + /// being created in the Service Fabric cluster resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster 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 clusterName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates a Service Fabric managed application resource. + /// + /// + /// Create or update a Service Fabric managed application resource with + /// the specified name. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application resource. + /// + /// + /// The 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> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string clusterName, string applicationName, ApplicationResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a Service Fabric managed application resource. + /// + /// + /// Delete a Service Fabric managed application resource with the + /// specified name. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application 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 BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string clusterName, string applicationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the list of managed application resources created in the + /// specified Service Fabric cluster resource. + /// + /// + /// Gets all managed application resources created or in the process of + /// being created in the Service Fabric cluster resource. + /// + /// + /// 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/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/IManagedClustersOperations.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/IManagedClustersOperations.cs new file mode 100644 index 0000000000000..41fa15a9cbd6c --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/IManagedClustersOperations.cs @@ -0,0 +1,309 @@ +// +// 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.ServiceFabricManagedClusters +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ManagedClustersOperations operations. + /// + public partial interface IManagedClustersOperations + { + /// + /// Gets the list of Service Fabric cluster resources created in the + /// specified resource group. + /// + /// + /// Gets all Service Fabric cluster resources created or in the process + /// of being created in the resource group. + /// + /// + /// The name of the resource group. + /// + /// + /// 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 the list of Service Fabric cluster resources created in the + /// specified subscription. + /// + /// + /// Gets all Service Fabric cluster resources created or in the process + /// of being created in the subscription. + /// + /// + /// 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 a Service Fabric managed cluster resource. + /// + /// + /// Get a Service Fabric managed cluster resource created or in the + /// process of being created in the specified resource group. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster 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 clusterName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates a Service Fabric managed cluster resource. + /// + /// + /// Create or update a Service Fabric managed cluster resource with the + /// specified name. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The cluster 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string clusterName, ManagedCluster parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates the tags of of a Service Fabric managed cluster resource. + /// + /// + /// Update the tags of of a Service Fabric managed cluster resource + /// with the specified name. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// Managed cluster update parameters + /// + /// + /// 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string clusterName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a Service Fabric managed cluster resource. + /// + /// + /// Delete a Service Fabric managed cluster resource with the specified + /// name. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster 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 clusterName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates a Service Fabric managed cluster resource. + /// + /// + /// Create or update a Service Fabric managed cluster resource with the + /// specified name. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The cluster 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string clusterName, ManagedCluster parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a Service Fabric managed cluster resource. + /// + /// + /// Delete a Service Fabric managed cluster resource with the specified + /// name. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster 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 BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string clusterName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the list of Service Fabric cluster resources created in the + /// specified resource group. + /// + /// + /// Gets all Service Fabric cluster resources created or in the process + /// of being created in the resource group. + /// + /// + /// 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 the list of Service Fabric cluster resources created in the + /// specified subscription. + /// + /// + /// Gets all Service Fabric cluster resources created or in the process + /// of being created in the subscription. + /// + /// + /// 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/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/INodeTypesOperations.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/INodeTypesOperations.cs new file mode 100644 index 0000000000000..08c0e874fcb99 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/INodeTypesOperations.cs @@ -0,0 +1,470 @@ +// +// 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.ServiceFabricManagedClusters +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// NodeTypesOperations operations. + /// + public partial interface INodeTypesOperations + { + /// + /// Gets the list of Node types of the specified managed cluster. + /// + /// + /// Gets all Node types of the specified managed cluster. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster 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>> ListByManagedClustersWithHttpMessagesAsync(string resourceGroupName, string clusterName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Restarts one or more nodes on the node type. + /// + /// + /// Restarts one or more nodes on the node type. It will disable the + /// fabric nodes, trigger a restart on the VMs and activate the nodes + /// back again. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the node type. + /// + /// + /// parameters for restart action. + /// + /// + /// 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 RestartWithHttpMessagesAsync(string resourceGroupName, string clusterName, string nodeTypeName, NodeTypeActionParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Reimages one or more nodes on the node type. + /// + /// + /// Reimages one or more nodes on the node type. It will disable the + /// fabric nodes, trigger a reimage on the VMs and activate the nodes + /// back again. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the node type. + /// + /// + /// parameters for reimage action. + /// + /// + /// 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 ReimageWithHttpMessagesAsync(string resourceGroupName, string clusterName, string nodeTypeName, NodeTypeActionParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes one or more nodes on the node type. + /// + /// + /// Deletes one or more nodes on the node type. It will disable the + /// fabric nodes, trigger a delete on the VMs and removes the state + /// from the cluster. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the node type. + /// + /// + /// parameters for delete action. + /// + /// + /// 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 DeleteNodeWithHttpMessagesAsync(string resourceGroupName, string clusterName, string nodeTypeName, NodeTypeActionParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a Service Fabric node type. + /// + /// + /// Get a Service Fabric node type of a given managed cluster. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the node type. + /// + /// + /// 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 clusterName, string nodeTypeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates a Service Fabric node type. + /// + /// + /// Create or update a Service Fabric node type of a given managed + /// cluster. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the node type. + /// + /// + /// The node type 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string clusterName, string nodeTypeName, NodeType parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update the tags of a node type resource of a given managed cluster. + /// + /// + /// Update the configuration of a node type of a given managed cluster, + /// only updating tags. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the node type. + /// + /// + /// Node type update parameters + /// + /// + /// 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string clusterName, string nodeTypeName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a Service Fabric node type. + /// + /// + /// Delete a Service Fabric node type of a given managed cluster. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the node type. + /// + /// + /// 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 clusterName, string nodeTypeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Restarts one or more nodes on the node type. + /// + /// + /// Restarts one or more nodes on the node type. It will disable the + /// fabric nodes, trigger a restart on the VMs and activate the nodes + /// back again. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the node type. + /// + /// + /// parameters for restart action. + /// + /// + /// 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 BeginRestartWithHttpMessagesAsync(string resourceGroupName, string clusterName, string nodeTypeName, NodeTypeActionParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Reimages one or more nodes on the node type. + /// + /// + /// Reimages one or more nodes on the node type. It will disable the + /// fabric nodes, trigger a reimage on the VMs and activate the nodes + /// back again. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the node type. + /// + /// + /// parameters for reimage action. + /// + /// + /// 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 BeginReimageWithHttpMessagesAsync(string resourceGroupName, string clusterName, string nodeTypeName, NodeTypeActionParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes one or more nodes on the node type. + /// + /// + /// Deletes one or more nodes on the node type. It will disable the + /// fabric nodes, trigger a delete on the VMs and removes the state + /// from the cluster. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the node type. + /// + /// + /// parameters for delete action. + /// + /// + /// 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 BeginDeleteNodeWithHttpMessagesAsync(string resourceGroupName, string clusterName, string nodeTypeName, NodeTypeActionParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates a Service Fabric node type. + /// + /// + /// Create or update a Service Fabric node type of a given managed + /// cluster. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the node type. + /// + /// + /// The node type 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string clusterName, string nodeTypeName, NodeType parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a Service Fabric node type. + /// + /// + /// Delete a Service Fabric node type of a given managed cluster. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the node type. + /// + /// + /// 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 BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string clusterName, string nodeTypeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the list of Node types of the specified managed cluster. + /// + /// + /// Gets all Node types of the specified managed cluster. + /// + /// + /// 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>> ListByManagedClustersNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/IOperations.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/IOperations.cs new file mode 100644 index 0000000000000..834b88e73ce10 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/IOperations.cs @@ -0,0 +1,81 @@ +// +// 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.ServiceFabricManagedClusters +{ + 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 Service Fabric resource provider API + /// operations. + /// + /// + /// Get the list of available Service Fabric resource provider API + /// operations. + /// + /// + /// The version of the Service Fabric resource provider API + /// + /// + /// 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 apiVersion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all of the available Service Fabric resource provider API + /// operations. + /// + /// + /// Get the list of available Service Fabric resource provider API + /// operations. + /// + /// + /// 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/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/IServiceFabricManagedClustersManagementClient.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/IServiceFabricManagedClustersManagementClient.cs new file mode 100644 index 0000000000000..eb22b8d7285c1 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/IServiceFabricManagedClustersManagementClient.cs @@ -0,0 +1,110 @@ +// +// 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.ServiceFabricManagedClusters +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + + /// + /// Service Fabric Managed Clusters Management Client + /// + public partial interface IServiceFabricManagedClustersManagementClient : 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 Service Fabric resource provider API. This is a + /// required parameter and it's value must be "2021-01-01-preview" for + /// this specification. + /// + 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 IApplicationTypesOperations. + /// + IApplicationTypesOperations ApplicationTypes { get; } + + /// + /// Gets the IApplicationTypeVersionsOperations. + /// + IApplicationTypeVersionsOperations ApplicationTypeVersions { get; } + + /// + /// Gets the IApplicationsOperations. + /// + IApplicationsOperations Applications { get; } + + /// + /// Gets the IServicesOperations. + /// + IServicesOperations Services { get; } + + /// + /// Gets the IManagedClustersOperations. + /// + IManagedClustersOperations ManagedClusters { get; } + + /// + /// Gets the INodeTypesOperations. + /// + INodeTypesOperations NodeTypes { get; } + + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/IServicesOperations.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/IServicesOperations.cs new file mode 100644 index 0000000000000..b0ed6351ad16f --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/IServicesOperations.cs @@ -0,0 +1,305 @@ +// +// 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.ServiceFabricManagedClusters +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ServicesOperations operations. + /// + public partial interface IServicesOperations + { + /// + /// Gets a Service Fabric managed service resource. + /// + /// + /// Get a Service Fabric service resource created or in the process of + /// being created in the Service Fabric managed application resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application resource. + /// + /// + /// The name of the service resource in the format of + /// {applicationName}~{serviceName}. + /// + /// + /// 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 clusterName, string applicationName, string serviceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates a Service Fabric managed service resource. + /// + /// + /// Create or update a Service Fabric managed service resource with the + /// specified name. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application resource. + /// + /// + /// The name of the service resource in the format of + /// {applicationName}~{serviceName}. + /// + /// + /// The service 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 clusterName, string applicationName, string serviceName, ServiceResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates the tags of a service resource of a given managed cluster. + /// + /// + /// Updates the tags of a service resource of a given managed cluster. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application resource. + /// + /// + /// The name of the service resource in the format of + /// {applicationName}~{serviceName}. + /// + /// + /// Service update parameters + /// + /// + /// 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string clusterName, string applicationName, string serviceName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a Service Fabric managed service resource. + /// + /// + /// Delete a Service Fabric managed service resource with the specified + /// name. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application resource. + /// + /// + /// The name of the service resource in the format of + /// {applicationName}~{serviceName}. + /// + /// + /// 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 clusterName, string applicationName, string serviceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the list of service resources created in the specified Service + /// Fabric managed application resource. + /// + /// + /// Gets all service resources created or in the process of being + /// created in the Service Fabric managed application resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the 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>> ListByApplicationsWithHttpMessagesAsync(string resourceGroupName, string clusterName, string applicationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates a Service Fabric managed service resource. + /// + /// + /// Create or update a Service Fabric managed service resource with the + /// specified name. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application resource. + /// + /// + /// The name of the service resource in the format of + /// {applicationName}~{serviceName}. + /// + /// + /// The service 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> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string clusterName, string applicationName, string serviceName, ServiceResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a Service Fabric managed service resource. + /// + /// + /// Delete a Service Fabric managed service resource with the specified + /// name. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application resource. + /// + /// + /// The name of the service resource in the format of + /// {applicationName}~{serviceName}. + /// + /// + /// 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 BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string clusterName, string applicationName, string serviceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the list of service resources created in the specified Service + /// Fabric managed application resource. + /// + /// + /// Gets all service resources created or in the process of being + /// created in the Service Fabric managed application resource. + /// + /// + /// 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>> ListByApplicationsNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/ManagedClustersOperations.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/ManagedClustersOperations.cs new file mode 100644 index 0000000000000..9ce07ec0d0d72 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/ManagedClustersOperations.cs @@ -0,0 +1,1604 @@ +// +// 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.ServiceFabricManagedClusters +{ + 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; + + /// + /// ManagedClustersOperations operations. + /// + internal partial class ManagedClustersOperations : IServiceOperations, IManagedClustersOperations + { + /// + /// Initializes a new instance of the ManagedClustersOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ManagedClustersOperations(ServiceFabricManagedClustersManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ServiceFabricManagedClustersManagementClient + /// + public ServiceFabricManagedClustersManagementClient Client { get; private set; } + + /// + /// Gets the list of Service Fabric cluster resources created in the specified + /// resource group. + /// + /// + /// Gets all Service Fabric cluster resources created or in the process of + /// being created in the resource group. + /// + /// + /// The name of the resource group. + /// + /// + /// 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 (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + 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("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.ServiceFabric/managedClusters").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _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 the list of Service Fabric cluster resources created in the specified + /// subscription. + /// + /// + /// Gets all Service Fabric cluster resources created or in the process of + /// being created in the subscription. + /// + /// + /// 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.ServiceFabric/managedClusters").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 a Service Fabric managed cluster resource. + /// + /// + /// Get a Service Fabric managed cluster resource created or in the process of + /// being created in the specified resource group. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster 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 clusterName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (clusterName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "clusterName"); + } + 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("resourceGroupName", resourceGroupName); + tracingParameters.Add("clusterName", clusterName); + 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.ServiceFabric/managedClusters/{clusterName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{clusterName}", System.Uri.EscapeDataString(clusterName)); + _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; + } + + /// + /// Creates or updates a Service Fabric managed cluster resource. + /// + /// + /// Create or update a Service Fabric managed cluster resource with the + /// specified name. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The cluster resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string clusterName, ManagedCluster parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, clusterName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates the tags of of a Service Fabric managed cluster resource. + /// + /// + /// Update the tags of of a Service Fabric managed cluster resource with the + /// specified name. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// Managed cluster update parameters + /// + /// + /// 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string clusterName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (clusterName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "clusterName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + ManagedClusterUpdateParameters parameters = new ManagedClusterUpdateParameters(); + if (tags != null) + { + parameters.Tags = tags; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("clusterName", clusterName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", 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.ServiceFabric/managedClusters/{clusterName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{clusterName}", System.Uri.EscapeDataString(clusterName)); + _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("PATCH"); + _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(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, 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) + { + 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 a Service Fabric managed cluster resource. + /// + /// + /// Delete a Service Fabric managed cluster resource with the specified name. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string clusterName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, clusterName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates or updates a Service Fabric managed cluster resource. + /// + /// + /// Create or update a Service Fabric managed cluster resource with the + /// specified name. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The cluster 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string clusterName, ManagedCluster parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (clusterName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "clusterName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.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("clusterName", clusterName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", 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.ServiceFabric/managedClusters/{clusterName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{clusterName}", System.Uri.EscapeDataString(clusterName)); + _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("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(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, 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 != 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 == 202) + { + _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 a Service Fabric managed cluster resource. + /// + /// + /// Delete a Service Fabric managed cluster resource with the specified name. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster 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 BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string clusterName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (clusterName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "clusterName"); + } + 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("resourceGroupName", resourceGroupName); + tracingParameters.Add("clusterName", clusterName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", 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.ServiceFabric/managedClusters/{clusterName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{clusterName}", System.Uri.EscapeDataString(clusterName)); + _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("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 the list of Service Fabric cluster resources created in the specified + /// resource group. + /// + /// + /// Gets all Service Fabric cluster resources created or in the process of + /// being created in the resource group. + /// + /// + /// 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 the list of Service Fabric cluster resources created in the specified + /// subscription. + /// + /// + /// Gets all Service Fabric cluster resources created or in the process of + /// being created in the subscription. + /// + /// + /// 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/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/ManagedClustersOperationsExtensions.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/ManagedClustersOperationsExtensions.cs new file mode 100644 index 0000000000000..40faae018c9d0 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/ManagedClustersOperationsExtensions.cs @@ -0,0 +1,493 @@ +// +// 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.ServiceFabricManagedClusters +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ManagedClustersOperations. + /// + public static partial class ManagedClustersOperationsExtensions + { + /// + /// Gets the list of Service Fabric cluster resources created in the specified + /// resource group. + /// + /// + /// Gets all Service Fabric cluster resources created or in the process of + /// being created in the resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + public static IPage ListByResourceGroup(this IManagedClustersOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Gets the list of Service Fabric cluster resources created in the specified + /// resource group. + /// + /// + /// Gets all Service Fabric cluster resources created or in the process of + /// being created in the resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this IManagedClustersOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the list of Service Fabric cluster resources created in the specified + /// subscription. + /// + /// + /// Gets all Service Fabric cluster resources created or in the process of + /// being created in the subscription. + /// + /// + /// The operations group for this extension method. + /// + public static IPage ListBySubscription(this IManagedClustersOperations operations) + { + return operations.ListBySubscriptionAsync().GetAwaiter().GetResult(); + } + + /// + /// Gets the list of Service Fabric cluster resources created in the specified + /// subscription. + /// + /// + /// Gets all Service Fabric cluster resources created or in the process of + /// being created in the subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySubscriptionAsync(this IManagedClustersOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a Service Fabric managed cluster resource. + /// + /// + /// Get a Service Fabric managed cluster resource created or in the process of + /// being created in the specified resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + public static ManagedCluster Get(this IManagedClustersOperations operations, string resourceGroupName, string clusterName) + { + return operations.GetAsync(resourceGroupName, clusterName).GetAwaiter().GetResult(); + } + + /// + /// Gets a Service Fabric managed cluster resource. + /// + /// + /// Get a Service Fabric managed cluster resource created or in the process of + /// being created in the specified resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IManagedClustersOperations operations, string resourceGroupName, string clusterName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, clusterName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates a Service Fabric managed cluster resource. + /// + /// + /// Create or update a Service Fabric managed cluster resource with the + /// specified name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The cluster resource. + /// + public static ManagedCluster CreateOrUpdate(this IManagedClustersOperations operations, string resourceGroupName, string clusterName, ManagedCluster parameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, clusterName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a Service Fabric managed cluster resource. + /// + /// + /// Create or update a Service Fabric managed cluster resource with the + /// specified name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The cluster resource. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IManagedClustersOperations operations, string resourceGroupName, string clusterName, ManagedCluster parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, clusterName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates the tags of of a Service Fabric managed cluster resource. + /// + /// + /// Update the tags of of a Service Fabric managed cluster resource with the + /// specified name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// Managed cluster update parameters + /// + public static ManagedCluster Update(this IManagedClustersOperations operations, string resourceGroupName, string clusterName, IDictionary tags = default(IDictionary)) + { + return operations.UpdateAsync(resourceGroupName, clusterName, tags).GetAwaiter().GetResult(); + } + + /// + /// Updates the tags of of a Service Fabric managed cluster resource. + /// + /// + /// Update the tags of of a Service Fabric managed cluster resource with the + /// specified name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// Managed cluster update parameters + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IManagedClustersOperations operations, string resourceGroupName, string clusterName, IDictionary tags = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, clusterName, tags, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a Service Fabric managed cluster resource. + /// + /// + /// Delete a Service Fabric managed cluster resource with the specified name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + public static void Delete(this IManagedClustersOperations operations, string resourceGroupName, string clusterName) + { + operations.DeleteAsync(resourceGroupName, clusterName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a Service Fabric managed cluster resource. + /// + /// + /// Delete a Service Fabric managed cluster resource with the specified name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IManagedClustersOperations operations, string resourceGroupName, string clusterName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, clusterName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Creates or updates a Service Fabric managed cluster resource. + /// + /// + /// Create or update a Service Fabric managed cluster resource with the + /// specified name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The cluster resource. + /// + public static ManagedCluster BeginCreateOrUpdate(this IManagedClustersOperations operations, string resourceGroupName, string clusterName, ManagedCluster parameters) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, clusterName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a Service Fabric managed cluster resource. + /// + /// + /// Create or update a Service Fabric managed cluster resource with the + /// specified name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The cluster resource. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IManagedClustersOperations operations, string resourceGroupName, string clusterName, ManagedCluster parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, clusterName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a Service Fabric managed cluster resource. + /// + /// + /// Delete a Service Fabric managed cluster resource with the specified name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + public static void BeginDelete(this IManagedClustersOperations operations, string resourceGroupName, string clusterName) + { + operations.BeginDeleteAsync(resourceGroupName, clusterName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a Service Fabric managed cluster resource. + /// + /// + /// Delete a Service Fabric managed cluster resource with the specified name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IManagedClustersOperations operations, string resourceGroupName, string clusterName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, clusterName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets the list of Service Fabric cluster resources created in the specified + /// resource group. + /// + /// + /// Gets all Service Fabric cluster resources created or in the process of + /// being created in the resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this IManagedClustersOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets the list of Service Fabric cluster resources created in the specified + /// resource group. + /// + /// + /// Gets all Service Fabric cluster resources created or in the process of + /// being created in the resource group. + /// + /// + /// 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 IManagedClustersOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the list of Service Fabric cluster resources created in the specified + /// subscription. + /// + /// + /// Gets all Service Fabric cluster resources created or in the process of + /// being created in the subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListBySubscriptionNext(this IManagedClustersOperations operations, string nextPageLink) + { + return operations.ListBySubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets the list of Service Fabric cluster resources created in the specified + /// subscription. + /// + /// + /// Gets all Service Fabric cluster resources created or in the process of + /// being created in the subscription. + /// + /// + /// 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 IManagedClustersOperations 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/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/Access.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/Access.cs new file mode 100644 index 0000000000000..887d761752e6d --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/Access.cs @@ -0,0 +1,22 @@ +// +// 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.ServiceFabricManagedClusters.Models +{ + + /// + /// Defines values for Access. + /// + public static class Access + { + public const string Allow = "allow"; + public const string Deny = "deny"; + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/AddRemoveIncrementalNamedPartitionScalingMechanism.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/AddRemoveIncrementalNamedPartitionScalingMechanism.cs new file mode 100644 index 0000000000000..86bfdead195a3 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/AddRemoveIncrementalNamedPartitionScalingMechanism.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.ServiceFabricManagedClusters.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents a scaling mechanism for adding or removing named partitions + /// of a stateless service. Partition names are in the format + /// '0','1'...'N-1'. + /// + [Newtonsoft.Json.JsonObject("AddRemoveIncrementalNamedPartition")] + public partial class AddRemoveIncrementalNamedPartitionScalingMechanism : ScalingMechanism + { + /// + /// Initializes a new instance of the + /// AddRemoveIncrementalNamedPartitionScalingMechanism class. + /// + public AddRemoveIncrementalNamedPartitionScalingMechanism() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// AddRemoveIncrementalNamedPartitionScalingMechanism class. + /// + /// Minimum number of named partitions + /// of the service. + /// Maximum number of named partitions + /// of the service. + /// The number of instances to add or + /// remove during a scaling operation. + public AddRemoveIncrementalNamedPartitionScalingMechanism(int minPartitionCount, int maxPartitionCount, int scaleIncrement) + { + MinPartitionCount = minPartitionCount; + MaxPartitionCount = maxPartitionCount; + ScaleIncrement = scaleIncrement; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets minimum number of named partitions of the service. + /// + [JsonProperty(PropertyName = "minPartitionCount")] + public int MinPartitionCount { get; set; } + + /// + /// Gets or sets maximum number of named partitions of the service. + /// + [JsonProperty(PropertyName = "maxPartitionCount")] + public int MaxPartitionCount { get; set; } + + /// + /// Gets or sets the number of instances to add or remove during a + /// scaling operation. + /// + [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/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ApplicationHealthPolicy.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ApplicationHealthPolicy.cs new file mode 100644 index 0000000000000..19f5bddc51d81 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ApplicationHealthPolicy.cs @@ -0,0 +1,130 @@ +// +// 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.ServiceFabricManagedClusters.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Defines a health policy used to evaluate the health of an application + /// or one of its children entities. + /// + /// + public partial class ApplicationHealthPolicy + { + /// + /// Initializes a new instance of the ApplicationHealthPolicy class. + /// + public ApplicationHealthPolicy() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ApplicationHealthPolicy class. + /// + /// Indicates whether warnings are + /// treated with the same severity as errors. + /// The maximum + /// allowed percentage of unhealthy deployed applications. Allowed + /// values are Byte values from zero to 100. + /// The percentage represents the maximum tolerated percentage of + /// deployed applications that can be unhealthy before the application + /// is considered in error. + /// This is calculated by dividing the number of unhealthy deployed + /// applications over the number of nodes where the application is + /// currently deployed on in the cluster. + /// The computation rounds up to tolerate one failure on small numbers + /// of nodes. Default percentage is zero. + /// + /// The health policy used + /// by default to evaluate the health of a service type. + /// The map with service type + /// health policy per service type name. The map is empty by + /// default. + public ApplicationHealthPolicy(bool considerWarningAsError, int maxPercentUnhealthyDeployedApplications, ServiceTypeHealthPolicy defaultServiceTypeHealthPolicy = default(ServiceTypeHealthPolicy), IDictionary serviceTypeHealthPolicyMap = default(IDictionary)) + { + ConsiderWarningAsError = considerWarningAsError; + MaxPercentUnhealthyDeployedApplications = maxPercentUnhealthyDeployedApplications; + DefaultServiceTypeHealthPolicy = defaultServiceTypeHealthPolicy; + ServiceTypeHealthPolicyMap = serviceTypeHealthPolicyMap; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets indicates whether warnings are treated with the same + /// severity as errors. + /// + [JsonProperty(PropertyName = "considerWarningAsError")] + public bool ConsiderWarningAsError { get; set; } + + /// + /// Gets or sets the maximum allowed percentage of unhealthy deployed + /// applications. Allowed values are Byte values from zero to 100. + /// The percentage represents the maximum tolerated percentage of + /// deployed applications that can be unhealthy before the application + /// is considered in error. + /// This is calculated by dividing the number of unhealthy deployed + /// applications over the number of nodes where the application is + /// currently deployed on in the cluster. + /// The computation rounds up to tolerate one failure on small numbers + /// of nodes. Default percentage is zero. + /// + /// + [JsonProperty(PropertyName = "maxPercentUnhealthyDeployedApplications")] + public int MaxPercentUnhealthyDeployedApplications { get; set; } + + /// + /// Gets or sets the health policy used by default to evaluate the + /// health of a service type. + /// + [JsonProperty(PropertyName = "defaultServiceTypeHealthPolicy")] + public ServiceTypeHealthPolicy DefaultServiceTypeHealthPolicy { get; set; } + + /// + /// Gets or sets the map with service type health policy per service + /// type name. The map is empty by default. + /// + [JsonProperty(PropertyName = "serviceTypeHealthPolicyMap")] + public IDictionary ServiceTypeHealthPolicyMap { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (DefaultServiceTypeHealthPolicy != null) + { + DefaultServiceTypeHealthPolicy.Validate(); + } + if (ServiceTypeHealthPolicyMap != null) + { + foreach (var valueElement in ServiceTypeHealthPolicyMap.Values) + { + if (valueElement != null) + { + valueElement.Validate(); + } + } + } + } + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ApplicationResource.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ApplicationResource.cs new file mode 100644 index 0000000000000..75f82f736d634 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ApplicationResource.cs @@ -0,0 +1,122 @@ +// +// 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.ServiceFabricManagedClusters.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The application resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class ApplicationResource : ProxyResource + { + /// + /// Initializes a new instance of the ApplicationResource class. + /// + public ApplicationResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ApplicationResource class. + /// + /// Azure resource identifier. + /// Azure resource name. + /// Azure resource type. + /// Resource location depends on the parent + /// resource. + /// Azure resource tags. + /// The current deployment or + /// provisioning state, which only appears in the response + /// List of user assigned identities + /// for the application, each mapped to a friendly name. + public ApplicationResource(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), SystemData systemData = default(SystemData), ManagedIdentity identity = default(ManagedIdentity), string provisioningState = default(string), string version = default(string), IDictionary parameters = default(IDictionary), ApplicationUpgradePolicy upgradePolicy = default(ApplicationUpgradePolicy), IList managedIdentities = default(IList)) + : base(id, name, type, location, tags, systemData) + { + Identity = identity; + ProvisioningState = provisioningState; + Version = version; + Parameters = parameters; + UpgradePolicy = upgradePolicy; + ManagedIdentities = managedIdentities; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "identity")] + public ManagedIdentity Identity { get; set; } + + /// + /// Gets the current deployment or provisioning state, which only + /// appears in the response + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "properties.version")] + public string Version { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.parameters")] + public IDictionary Parameters { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.upgradePolicy")] + public ApplicationUpgradePolicy UpgradePolicy { get; set; } + + /// + /// Gets or sets list of user assigned identities for the application, + /// each mapped to a friendly name. + /// + [JsonProperty(PropertyName = "properties.managedIdentities")] + public IList ManagedIdentities { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (UpgradePolicy != null) + { + UpgradePolicy.Validate(); + } + if (ManagedIdentities != null) + { + foreach (var element in ManagedIdentities) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ApplicationTypeResource.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ApplicationTypeResource.cs new file mode 100644 index 0000000000000..3c0c436a7a603 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ApplicationTypeResource.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.ServiceFabricManagedClusters.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The application type name resource + /// + [Rest.Serialization.JsonTransformation] + public partial class ApplicationTypeResource : ProxyResource + { + /// + /// Initializes a new instance of the ApplicationTypeResource class. + /// + public ApplicationTypeResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ApplicationTypeResource class. + /// + /// Azure resource identifier. + /// Azure resource name. + /// Azure resource type. + /// Resource location depends on the parent + /// resource. + /// Azure resource tags. + /// The current deployment or + /// provisioning state, which only appears in the response. + public ApplicationTypeResource(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), SystemData systemData = default(SystemData), string provisioningState = default(string)) + : base(id, name, type, location, tags, systemData) + { + ProvisioningState = provisioningState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the current deployment or provisioning state, which only + /// appears in the response. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ApplicationTypeUpdateParameters.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ApplicationTypeUpdateParameters.cs new file mode 100644 index 0000000000000..2526e0ad57232 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ApplicationTypeUpdateParameters.cs @@ -0,0 +1,55 @@ +// +// 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.ServiceFabricManagedClusters.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Application type update request + /// + public partial class ApplicationTypeUpdateParameters + { + /// + /// Initializes a new instance of the ApplicationTypeUpdateParameters + /// class. + /// + public ApplicationTypeUpdateParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ApplicationTypeUpdateParameters + /// class. + /// + /// Application type update parameters + public ApplicationTypeUpdateParameters(IDictionary tags = default(IDictionary)) + { + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets application type update parameters + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ApplicationTypeVersionResource.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ApplicationTypeVersionResource.cs new file mode 100644 index 0000000000000..61f4ef73c3cad --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ApplicationTypeVersionResource.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.ServiceFabricManagedClusters.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// An application type version resource for the specified application type + /// name resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class ApplicationTypeVersionResource : ProxyResource + { + /// + /// Initializes a new instance of the ApplicationTypeVersionResource + /// class. + /// + public ApplicationTypeVersionResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ApplicationTypeVersionResource + /// class. + /// + /// The URL to the application + /// package + /// Azure resource identifier. + /// Azure resource name. + /// Azure resource type. + /// Resource location depends on the parent + /// resource. + /// Azure resource tags. + /// The current deployment or + /// provisioning state, which only appears in the response + public ApplicationTypeVersionResource(string appPackageUrl, string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), SystemData systemData = default(SystemData), string provisioningState = default(string)) + : base(id, name, type, location, tags, systemData) + { + ProvisioningState = provisioningState; + AppPackageUrl = appPackageUrl; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the current deployment or provisioning state, which only + /// appears in the response + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets the URL to the application package + /// + [JsonProperty(PropertyName = "properties.appPackageUrl")] + public string AppPackageUrl { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (AppPackageUrl == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "AppPackageUrl"); + } + } + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ApplicationTypeVersionUpdateParameters.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ApplicationTypeVersionUpdateParameters.cs new file mode 100644 index 0000000000000..acdc4e2f9c39c --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ApplicationTypeVersionUpdateParameters.cs @@ -0,0 +1,56 @@ +// +// 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.ServiceFabricManagedClusters.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Application type version update request + /// + public partial class ApplicationTypeVersionUpdateParameters + { + /// + /// Initializes a new instance of the + /// ApplicationTypeVersionUpdateParameters class. + /// + public ApplicationTypeVersionUpdateParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ApplicationTypeVersionUpdateParameters class. + /// + /// Application type version update + /// parameters + public ApplicationTypeVersionUpdateParameters(IDictionary tags = default(IDictionary)) + { + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets application type version update parameters + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ApplicationTypeVersionsCleanupPolicy.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ApplicationTypeVersionsCleanupPolicy.cs new file mode 100644 index 0000000000000..83c724d3e6a02 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ApplicationTypeVersionsCleanupPolicy.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.ServiceFabricManagedClusters.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The policy used to clean up unused versions. + /// + public partial class ApplicationTypeVersionsCleanupPolicy + { + /// + /// Initializes a new instance of the + /// ApplicationTypeVersionsCleanupPolicy class. + /// + public ApplicationTypeVersionsCleanupPolicy() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ApplicationTypeVersionsCleanupPolicy class. + /// + /// Number of unused versions per + /// application type to keep. + public ApplicationTypeVersionsCleanupPolicy(int maxUnusedVersionsToKeep) + { + MaxUnusedVersionsToKeep = maxUnusedVersionsToKeep; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets number of unused versions per application type to + /// keep. + /// + [JsonProperty(PropertyName = "maxUnusedVersionsToKeep")] + public int MaxUnusedVersionsToKeep { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (MaxUnusedVersionsToKeep < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "MaxUnusedVersionsToKeep", 0); + } + } + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ApplicationUpdateParameters.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ApplicationUpdateParameters.cs new file mode 100644 index 0000000000000..e487e43a86829 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ApplicationUpdateParameters.cs @@ -0,0 +1,55 @@ +// +// 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.ServiceFabricManagedClusters.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Application update request + /// + public partial class ApplicationUpdateParameters + { + /// + /// Initializes a new instance of the ApplicationUpdateParameters + /// class. + /// + public ApplicationUpdateParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ApplicationUpdateParameters + /// class. + /// + /// Application update parameters + public ApplicationUpdateParameters(IDictionary tags = default(IDictionary)) + { + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets application update parameters + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ApplicationUpgradePolicy.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ApplicationUpgradePolicy.cs new file mode 100644 index 0000000000000..c55e6da39d946 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ApplicationUpgradePolicy.cs @@ -0,0 +1,146 @@ +// +// 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.ServiceFabricManagedClusters.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes the policy for a monitored application upgrade. + /// + public partial class ApplicationUpgradePolicy + { + /// + /// Initializes a new instance of the ApplicationUpgradePolicy class. + /// + public ApplicationUpgradePolicy() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ApplicationUpgradePolicy class. + /// + /// Duration in seconds, to + /// wait before a stateless instance is closed, to allow the active + /// requests to drain gracefully. This would be effective when the + /// instance is closing during the application/cluster upgrade, only + /// for those instances which have a non-zero delay duration configured + /// in the service description. See InstanceCloseDelayDurationSeconds + /// property in StatelessServiceDescription for details. Note, the + /// default value of InstanceCloseDelayDurationInSeconds is 4294967295, + /// which indicates that the behavior will entirely depend on the delay + /// configured in the stateless service description. + /// Possible values include: 'Monitored', + /// 'UnmonitoredAuto' + /// The maximum amount of + /// time to block processing of an upgrade domain and prevent loss of + /// availability when there are unexpected issues. When this timeout + /// expires, processing of the upgrade domain will proceed regardless + /// of availability loss issues. The timeout is reset at the start of + /// each upgrade domain. Valid values are between 0 and 42949672925 + /// inclusive. (unsigned 32-bit integer). + /// Determines whether the + /// application should be recreated on update. If value=true, the rest + /// of the upgrade policy parameters are not allowed. + public ApplicationUpgradePolicy(ApplicationHealthPolicy applicationHealthPolicy = default(ApplicationHealthPolicy), bool? forceRestart = default(bool?), RollingUpgradeMonitoringPolicy rollingUpgradeMonitoringPolicy = default(RollingUpgradeMonitoringPolicy), long? instanceCloseDelayDuration = default(long?), string upgradeMode = default(string), long? upgradeReplicaSetCheckTimeout = default(long?), bool? recreateApplication = default(bool?)) + { + ApplicationHealthPolicy = applicationHealthPolicy; + ForceRestart = forceRestart; + RollingUpgradeMonitoringPolicy = rollingUpgradeMonitoringPolicy; + InstanceCloseDelayDuration = instanceCloseDelayDuration; + UpgradeMode = upgradeMode; + UpgradeReplicaSetCheckTimeout = upgradeReplicaSetCheckTimeout; + RecreateApplication = recreateApplication; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "applicationHealthPolicy")] + public ApplicationHealthPolicy ApplicationHealthPolicy { get; set; } + + /// + /// + [JsonProperty(PropertyName = "forceRestart")] + public bool? ForceRestart { get; set; } + + /// + /// + [JsonProperty(PropertyName = "rollingUpgradeMonitoringPolicy")] + public RollingUpgradeMonitoringPolicy RollingUpgradeMonitoringPolicy { get; set; } + + /// + /// Gets or sets duration in seconds, to wait before a stateless + /// instance is closed, to allow the active requests to drain + /// gracefully. This would be effective when the instance is closing + /// during the application/cluster upgrade, only for those instances + /// which have a non-zero delay duration configured in the service + /// description. See InstanceCloseDelayDurationSeconds property in + /// StatelessServiceDescription for details. Note, the default value of + /// InstanceCloseDelayDurationInSeconds is 4294967295, which indicates + /// that the behavior will entirely depend on the delay configured in + /// the stateless service description. + /// + [JsonProperty(PropertyName = "instanceCloseDelayDuration")] + public long? InstanceCloseDelayDuration { get; set; } + + /// + /// Gets or sets possible values include: 'Monitored', + /// 'UnmonitoredAuto' + /// + [JsonProperty(PropertyName = "upgradeMode")] + public string UpgradeMode { get; set; } + + /// + /// Gets or sets the maximum amount of time to block processing of an + /// upgrade domain and prevent loss of availability when there are + /// unexpected issues. When this timeout expires, processing of the + /// upgrade domain will proceed regardless of availability loss issues. + /// The timeout is reset at the start of each upgrade domain. Valid + /// values are between 0 and 42949672925 inclusive. (unsigned 32-bit + /// integer). + /// + [JsonProperty(PropertyName = "upgradeReplicaSetCheckTimeout")] + public long? UpgradeReplicaSetCheckTimeout { get; set; } + + /// + /// Gets or sets determines whether the application should be recreated + /// on update. If value=true, the rest of the upgrade policy parameters + /// are not allowed. + /// + [JsonProperty(PropertyName = "recreateApplication")] + public bool? RecreateApplication { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ApplicationHealthPolicy != null) + { + ApplicationHealthPolicy.Validate(); + } + if (RollingUpgradeMonitoringPolicy != null) + { + RollingUpgradeMonitoringPolicy.Validate(); + } + } + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ApplicationUserAssignedIdentity.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ApplicationUserAssignedIdentity.cs new file mode 100644 index 0000000000000..0d6d34047dbd4 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ApplicationUserAssignedIdentity.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.ServiceFabricManagedClusters.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + public partial class ApplicationUserAssignedIdentity + { + /// + /// Initializes a new instance of the ApplicationUserAssignedIdentity + /// class. + /// + public ApplicationUserAssignedIdentity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ApplicationUserAssignedIdentity + /// class. + /// + /// The friendly name of user assigned + /// identity. + /// The principal id of user assigned + /// identity. + public ApplicationUserAssignedIdentity(string name, string principalId) + { + Name = name; + PrincipalId = principalId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the friendly name of user assigned identity. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the principal id of user assigned identity. + /// + [JsonProperty(PropertyName = "principalId")] + public string PrincipalId { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (PrincipalId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "PrincipalId"); + } + } + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/AvailableOperationDisplay.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/AvailableOperationDisplay.cs new file mode 100644 index 0000000000000..535572d447412 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/AvailableOperationDisplay.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.ServiceFabricManagedClusters.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Operation supported by the Service Fabric 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. + /// + /// The name of the provider. + /// The resource on which the operation is + /// performed + /// The operation that can be + /// performed. + /// Operation description + 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 the name of the provider. + /// + [JsonProperty(PropertyName = "provider")] + public string Provider { get; set; } + + /// + /// Gets or sets the resource on which the operation is performed + /// + [JsonProperty(PropertyName = "resource")] + public string Resource { get; set; } + + /// + /// Gets or sets the operation that can be performed. + /// + [JsonProperty(PropertyName = "operation")] + public string Operation { get; set; } + + /// + /// Gets or sets operation description + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/AveragePartitionLoadScalingTrigger.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/AveragePartitionLoadScalingTrigger.cs new file mode 100644 index 0000000000000..f749f28834cb3 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/AveragePartitionLoadScalingTrigger.cs @@ -0,0 +1,107 @@ +// +// 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.ServiceFabricManagedClusters.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents a scaling trigger related to an average load of a + /// metric/resource of a partition. + /// + [Newtonsoft.Json.JsonObject("AveragePartitionLoadTrigger")] + public partial class AveragePartitionLoadScalingTrigger : ScalingTrigger + { + /// + /// Initializes a new instance of the + /// AveragePartitionLoadScalingTrigger class. + /// + public AveragePartitionLoadScalingTrigger() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// AveragePartitionLoadScalingTrigger class. + /// + /// The name of the metric for which usage + /// should be tracked. + /// The lower limit of the load below + /// which a scale in operation should be performed. + /// The upper limit of the load beyond + /// which a scale out operation should be performed. + /// The period in seconds on which a + /// decision is made whether to scale or not. This property should come + /// in ISO 8601 format "hh:mm:ss". + public AveragePartitionLoadScalingTrigger(string metricName, double lowerLoadThreshold, double upperLoadThreshold, string scaleInterval) + { + MetricName = metricName; + LowerLoadThreshold = lowerLoadThreshold; + UpperLoadThreshold = upperLoadThreshold; + ScaleInterval = scaleInterval; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the metric for which usage should be + /// tracked. + /// + [JsonProperty(PropertyName = "metricName")] + public string MetricName { get; set; } + + /// + /// Gets or sets the lower limit of the load below which a scale in + /// operation should be performed. + /// + [JsonProperty(PropertyName = "lowerLoadThreshold")] + public double LowerLoadThreshold { get; set; } + + /// + /// Gets or sets the upper limit of the load beyond which a scale out + /// operation should be performed. + /// + [JsonProperty(PropertyName = "upperLoadThreshold")] + public double UpperLoadThreshold { get; set; } + + /// + /// Gets or sets the period in seconds on which a decision is made + /// whether to scale or not. This property should come in ISO 8601 + /// format "hh:mm:ss". + /// + [JsonProperty(PropertyName = "scaleInterval")] + public string ScaleInterval { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (MetricName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "MetricName"); + } + if (ScaleInterval == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ScaleInterval"); + } + } + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/AverageServiceLoadScalingTrigger.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/AverageServiceLoadScalingTrigger.cs new file mode 100644 index 0000000000000..0a7502597e043 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/AverageServiceLoadScalingTrigger.cs @@ -0,0 +1,107 @@ +// +// 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.ServiceFabricManagedClusters.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents a scaling policy related to an average load of a + /// metric/resource of a service. + /// + [Newtonsoft.Json.JsonObject("AverageServiceLoadTrigger")] + public partial class AverageServiceLoadScalingTrigger : ScalingTrigger + { + /// + /// Initializes a new instance of the AverageServiceLoadScalingTrigger + /// class. + /// + public AverageServiceLoadScalingTrigger() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AverageServiceLoadScalingTrigger + /// class. + /// + /// The name of the metric for which usage + /// should be tracked. + /// The lower limit of the load below + /// which a scale in operation should be performed. + /// The upper limit of the load beyond + /// which a scale out operation should be performed. + /// The period in seconds on which a + /// decision is made whether to scale or not. This property should come + /// in ISO 8601 format "hh:mm:ss". + public AverageServiceLoadScalingTrigger(string metricName, double lowerLoadThreshold, double upperLoadThreshold, string scaleInterval) + { + MetricName = metricName; + LowerLoadThreshold = lowerLoadThreshold; + UpperLoadThreshold = upperLoadThreshold; + ScaleInterval = scaleInterval; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the metric for which usage should be + /// tracked. + /// + [JsonProperty(PropertyName = "metricName")] + public string MetricName { get; set; } + + /// + /// Gets or sets the lower limit of the load below which a scale in + /// operation should be performed. + /// + [JsonProperty(PropertyName = "lowerLoadThreshold")] + public double LowerLoadThreshold { get; set; } + + /// + /// Gets or sets the upper limit of the load beyond which a scale out + /// operation should be performed. + /// + [JsonProperty(PropertyName = "upperLoadThreshold")] + public double UpperLoadThreshold { get; set; } + + /// + /// Gets or sets the period in seconds on which a decision is made + /// whether to scale or not. This property should come in ISO 8601 + /// format "hh:mm:ss". + /// + [JsonProperty(PropertyName = "scaleInterval")] + public string ScaleInterval { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (MetricName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "MetricName"); + } + if (ScaleInterval == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ScaleInterval"); + } + } + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/AzureActiveDirectory.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/AzureActiveDirectory.cs new file mode 100644 index 0000000000000..6017797364a41 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/AzureActiveDirectory.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.ServiceFabricManagedClusters.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The settings to enable AAD authentication on the cluster. + /// + public partial class AzureActiveDirectory + { + /// + /// Initializes a new instance of the AzureActiveDirectory class. + /// + public AzureActiveDirectory() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AzureActiveDirectory class. + /// + /// Azure active directory tenant id. + /// Azure active directory cluster + /// application id. + /// Azure active directory client + /// application id. + public AzureActiveDirectory(string tenantId = default(string), string clusterApplication = default(string), string clientApplication = default(string)) + { + TenantId = tenantId; + ClusterApplication = clusterApplication; + ClientApplication = clientApplication; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets azure active directory tenant id. + /// + [JsonProperty(PropertyName = "tenantId")] + public string TenantId { get; set; } + + /// + /// Gets or sets azure active directory cluster application id. + /// + [JsonProperty(PropertyName = "clusterApplication")] + public string ClusterApplication { get; set; } + + /// + /// Gets or sets azure active directory client application id. + /// + [JsonProperty(PropertyName = "clientApplication")] + public string ClientApplication { get; set; } + + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ClientCertificate.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ClientCertificate.cs new file mode 100644 index 0000000000000..d318fc6b72427 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ClientCertificate.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.ServiceFabricManagedClusters.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Client certificate definition. + /// + public partial class ClientCertificate + { + /// + /// Initializes a new instance of the ClientCertificate class. + /// + public ClientCertificate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ClientCertificate class. + /// + /// Indicates if the client certificate has admin + /// access to the cluster. Non admin clients can perform only read only + /// operations on the cluster. + /// Certificate thumbprint. + /// Certificate common name. + /// Issuer thumbprint for the + /// certificate. Only used together with CommonName. + public ClientCertificate(bool isAdmin, string thumbprint = default(string), string commonName = default(string), string issuerThumbprint = default(string)) + { + IsAdmin = isAdmin; + Thumbprint = thumbprint; + CommonName = commonName; + IssuerThumbprint = issuerThumbprint; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets indicates if the client certificate has admin access + /// to the cluster. Non admin clients can perform only read only + /// operations on the cluster. + /// + [JsonProperty(PropertyName = "isAdmin")] + public bool IsAdmin { get; set; } + + /// + /// Gets or sets certificate thumbprint. + /// + [JsonProperty(PropertyName = "thumbprint")] + public string Thumbprint { get; set; } + + /// + /// Gets or sets certificate common name. + /// + [JsonProperty(PropertyName = "commonName")] + public string CommonName { get; set; } + + /// + /// Gets or sets issuer thumbprint for the certificate. Only used + /// together with CommonName. + /// + [JsonProperty(PropertyName = "issuerThumbprint")] + public string IssuerThumbprint { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + //Nothing to validate + } + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/CreatedByType.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/CreatedByType.cs new file mode 100644 index 0000000000000..4a733e643f6e4 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/CreatedByType.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.ServiceFabricManagedClusters.Models +{ + + /// + /// Defines values for CreatedByType. + /// + public static class CreatedByType + { + public const string User = "User"; + public const string Application = "Application"; + public const string ManagedIdentity = "ManagedIdentity"; + public const string Key = "Key"; + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/Direction.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/Direction.cs new file mode 100644 index 0000000000000..ca34f5acced1b --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/Direction.cs @@ -0,0 +1,22 @@ +// +// 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.ServiceFabricManagedClusters.Models +{ + + /// + /// Defines values for Direction. + /// + public static class Direction + { + public const string Inbound = "inbound"; + public const string Outbound = "outbound"; + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/EndpointRangeDescription.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/EndpointRangeDescription.cs new file mode 100644 index 0000000000000..60b2adb6f3c7c --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/EndpointRangeDescription.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.ServiceFabricManagedClusters.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Port range details + /// + public partial class EndpointRangeDescription + { + /// + /// Initializes a new instance of the EndpointRangeDescription class. + /// + public EndpointRangeDescription() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EndpointRangeDescription class. + /// + /// Starting port of a range of ports + /// End port of a range of ports + public EndpointRangeDescription(int startPort, int endPort) + { + StartPort = startPort; + EndPort = endPort; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets starting port of a range of ports + /// + [JsonProperty(PropertyName = "startPort")] + public int StartPort { get; set; } + + /// + /// Gets or sets end port of a range of ports + /// + [JsonProperty(PropertyName = "endPort")] + public int EndPort { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + //Nothing to validate + } + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ErrorModel.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ErrorModel.cs new file mode 100644 index 0000000000000..4cb1a35839145 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ErrorModel.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.ServiceFabricManagedClusters.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The structure of the error. + /// + public partial class ErrorModel + { + /// + /// Initializes a new instance of the ErrorModel class. + /// + public ErrorModel() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorModel class. + /// + /// The error details. + public ErrorModel(ErrorModelError error = default(ErrorModelError)) + { + Error = error; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the error details. + /// + [JsonProperty(PropertyName = "error")] + public ErrorModelError Error { get; set; } + + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ErrorModelError.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ErrorModelError.cs new file mode 100644 index 0000000000000..27ca8c7a1b53c --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ErrorModelError.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.ServiceFabricManagedClusters.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The error details. + /// + public partial class ErrorModelError + { + /// + /// Initializes a new instance of the ErrorModelError class. + /// + public ErrorModelError() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorModelError class. + /// + /// The error code. + /// The error message. + public ErrorModelError(string code = default(string), string message = default(string)) + { + Code = code; + Message = message; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the error code. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; set; } + + /// + /// Gets or sets the error message. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ErrorModelException.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ErrorModelException.cs new file mode 100644 index 0000000000000..5615deadcede7 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/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.ServiceFabricManagedClusters.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/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/FailureAction.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/FailureAction.cs new file mode 100644 index 0000000000000..da1dd6a9d0e47 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/FailureAction.cs @@ -0,0 +1,31 @@ +// +// 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.ServiceFabricManagedClusters.Models +{ + + /// + /// Defines values for FailureAction. + /// + public static class FailureAction + { + /// + /// Indicates that a rollback of the upgrade will be performed by + /// Service Fabric if the upgrade fails. + /// + public const string Rollback = "Rollback"; + /// + /// Indicates that a manual repair will need to be performed by the + /// administrator if the upgrade fails. Service Fabric will not proceed + /// to the next upgrade domain automatically. + /// + public const string Manual = "Manual"; + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/LoadBalancingRule.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/LoadBalancingRule.cs new file mode 100644 index 0000000000000..23e4b94fc9be3 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/LoadBalancingRule.cs @@ -0,0 +1,132 @@ +// +// 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.ServiceFabricManagedClusters.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes a load balancing rule. + /// + public partial class LoadBalancingRule + { + /// + /// Initializes a new instance of the LoadBalancingRule class. + /// + public LoadBalancingRule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LoadBalancingRule class. + /// + /// The port for the external endpoint. Port + /// numbers for each rule must be unique within the Load Balancer. + /// Acceptable values are between 1 and 65534. + /// The port used for internal connections on + /// the endpoint. Acceptable values are between 1 and 65535. + /// The reference to the transport protocol used + /// by the load balancing rule. Possible values include: 'tcp', + /// 'udp' + /// the reference to the load balancer + /// probe used by the load balancing rule. Possible values include: + /// 'tcp', 'http', 'https' + /// The probe request path. Only + /// supported for HTTP/HTTPS probes. + public LoadBalancingRule(int frontendPort, int backendPort, string protocol, string probeProtocol, string probeRequestPath = default(string)) + { + FrontendPort = frontendPort; + BackendPort = backendPort; + Protocol = protocol; + ProbeProtocol = probeProtocol; + ProbeRequestPath = probeRequestPath; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the port for the external endpoint. Port numbers for + /// each rule must be unique within the Load Balancer. Acceptable + /// values are between 1 and 65534. + /// + [JsonProperty(PropertyName = "frontendPort")] + public int FrontendPort { get; set; } + + /// + /// Gets or sets the port used for internal connections on the + /// endpoint. Acceptable values are between 1 and 65535. + /// + [JsonProperty(PropertyName = "backendPort")] + public int BackendPort { get; set; } + + /// + /// Gets or sets the reference to the transport protocol used by the + /// load balancing rule. Possible values include: 'tcp', 'udp' + /// + [JsonProperty(PropertyName = "protocol")] + public string Protocol { get; set; } + + /// + /// Gets or sets the reference to the load balancer probe used by the + /// load balancing rule. Possible values include: 'tcp', 'http', + /// 'https' + /// + [JsonProperty(PropertyName = "probeProtocol")] + public string ProbeProtocol { get; set; } + + /// + /// Gets or sets the probe request path. Only supported for HTTP/HTTPS + /// probes. + /// + [JsonProperty(PropertyName = "probeRequestPath")] + public string ProbeRequestPath { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Protocol == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Protocol"); + } + if (ProbeProtocol == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ProbeProtocol"); + } + if (FrontendPort > 65534) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "FrontendPort", 65534); + } + if (FrontendPort < 1) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "FrontendPort", 1); + } + if (BackendPort > 65534) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "BackendPort", 65534); + } + if (BackendPort < 1) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "BackendPort", 1); + } + } + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ManagedCluster.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ManagedCluster.cs new file mode 100644 index 0000000000000..6fdf75c655c1d --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ManagedCluster.cs @@ -0,0 +1,348 @@ +// +// 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.ServiceFabricManagedClusters.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The manged cluster resource + /// + /// + [Rest.Serialization.JsonTransformation] + public partial class ManagedCluster : Resource + { + /// + /// Initializes a new instance of the ManagedCluster class. + /// + public ManagedCluster() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagedCluster class. + /// + /// Azure resource location. + /// The cluster dns name. + /// VM admin user name. + /// Azure resource identifier. + /// Azure resource name. + /// Azure resource type. + /// Azure resource tags. + /// Azure resource etag. + /// The fully qualified domain name associated with + /// the public load balancer of the cluster. + /// The IPv4 address associated with the + /// public load balancer of the cluster. + /// A service generated unique identifier for + /// the cluster resource. + /// The current state of the cluster. + /// Possible values include: 'WaitingForNodes', 'Deploying', + /// 'BaselineUpgrade', 'Upgrading', 'UpgradeFailed', 'Ready' + /// List of thumbprints of + /// the cluster certificates. + /// The port used for client + /// connections to the cluster. + /// The port used for HTTP + /// connections to the cluster. + /// VM admin user password. + /// Load balancing rules that are + /// applied to the public load balancer of the cluster. + /// Setting this to true enables RDP + /// access to the VM. The default NSG rule opens RDP port to internet + /// which can be overridden with custom Network Security Rules. The + /// default value for this setting is false. + /// Custom Network Security Rules + /// that are applied to the virtual network of the cluster. + /// Client certificates that are allowed to + /// manage the cluster. + /// The AAD authentication settings + /// of the cluster. + /// The list of custom fabric settings to + /// configure the cluster. + /// The provisioning state of the + /// managed cluster resource. Possible values include: 'None', + /// 'Creating', 'Created', 'Updating', 'Succeeded', 'Failed', + /// 'Canceled', 'Deleting', 'Deleted', 'Other' + /// The Service Fabric runtime version + /// of the cluster. This property can only by set the user when + /// **upgradeMode** is set to 'Manual'. To get list of available + /// Service Fabric versions for new clusters use [ClusterVersion + /// API](./ClusterVersion.md). To get the list of available version for + /// existing clusters use **availableClusterVersions**. + /// List of add-on features to enable on + /// the cluster. + /// Setting this to true enables + /// automatic OS upgrade for the node types that are created using any + /// platform OS image with version 'latest'. The default value for this + /// setting is false. + /// The policy used + /// to clean up unused versions. + /// The sku of the managed cluster + public ManagedCluster(string location, string dnsName, string adminUserName, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string etag = default(string), SystemData systemData = default(SystemData), string fqdn = default(string), string ipv4Address = default(string), string clusterId = default(string), string clusterState = default(string), IList clusterCertificateThumbprints = default(IList), int? clientConnectionPort = default(int?), int? httpGatewayConnectionPort = default(int?), string adminPassword = default(string), IList loadBalancingRules = default(IList), bool? allowRdpAccess = default(bool?), IList networkSecurityRules = default(IList), IList clients = default(IList), AzureActiveDirectory azureActiveDirectory = default(AzureActiveDirectory), IList fabricSettings = default(IList), string provisioningState = default(string), string clusterCodeVersion = default(string), IList addonFeatures = default(IList), bool? enableAutoOSUpgrade = default(bool?), ApplicationTypeVersionsCleanupPolicy applicationTypeVersionsCleanupPolicy = default(ApplicationTypeVersionsCleanupPolicy), Sku sku = default(Sku)) + : base(location, id, name, type, tags, etag, systemData) + { + DnsName = dnsName; + Fqdn = fqdn; + Ipv4Address = ipv4Address; + ClusterId = clusterId; + ClusterState = clusterState; + ClusterCertificateThumbprints = clusterCertificateThumbprints; + ClientConnectionPort = clientConnectionPort; + HttpGatewayConnectionPort = httpGatewayConnectionPort; + AdminUserName = adminUserName; + AdminPassword = adminPassword; + LoadBalancingRules = loadBalancingRules; + AllowRdpAccess = allowRdpAccess; + NetworkSecurityRules = networkSecurityRules; + Clients = clients; + AzureActiveDirectory = azureActiveDirectory; + FabricSettings = fabricSettings; + ProvisioningState = provisioningState; + ClusterCodeVersion = clusterCodeVersion; + AddonFeatures = addonFeatures; + EnableAutoOSUpgrade = enableAutoOSUpgrade; + ApplicationTypeVersionsCleanupPolicy = applicationTypeVersionsCleanupPolicy; + Sku = sku; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the cluster dns name. + /// + [JsonProperty(PropertyName = "properties.dnsName")] + public string DnsName { get; set; } + + /// + /// Gets the fully qualified domain name associated with the public + /// load balancer of the cluster. + /// + [JsonProperty(PropertyName = "properties.fqdn")] + public string Fqdn { get; private set; } + + /// + /// Gets the IPv4 address associated with the public load balancer of + /// the cluster. + /// + [JsonProperty(PropertyName = "properties.ipv4Address")] + public string Ipv4Address { get; private set; } + + /// + /// Gets a service generated unique identifier for the cluster + /// resource. + /// + [JsonProperty(PropertyName = "properties.clusterId")] + public string ClusterId { get; private set; } + + /// + /// Gets the current state of the cluster. Possible values include: + /// 'WaitingForNodes', 'Deploying', 'BaselineUpgrade', 'Upgrading', + /// 'UpgradeFailed', 'Ready' + /// + [JsonProperty(PropertyName = "properties.clusterState")] + public string ClusterState { get; private set; } + + /// + /// Gets list of thumbprints of the cluster certificates. + /// + [JsonProperty(PropertyName = "properties.clusterCertificateThumbprints")] + public IList ClusterCertificateThumbprints { get; private set; } + + /// + /// Gets or sets the port used for client connections to the cluster. + /// + [JsonProperty(PropertyName = "properties.clientConnectionPort")] + public int? ClientConnectionPort { get; set; } + + /// + /// Gets or sets the port used for HTTP connections to the cluster. + /// + [JsonProperty(PropertyName = "properties.httpGatewayConnectionPort")] + public int? HttpGatewayConnectionPort { get; set; } + + /// + /// Gets or sets VM admin user name. + /// + [JsonProperty(PropertyName = "properties.adminUserName")] + public string AdminUserName { get; set; } + + /// + /// Gets or sets VM admin user password. + /// + [JsonProperty(PropertyName = "properties.adminPassword")] + public string AdminPassword { get; set; } + + /// + /// Gets or sets load balancing rules that are applied to the public + /// load balancer of the cluster. + /// + [JsonProperty(PropertyName = "properties.loadBalancingRules")] + public IList LoadBalancingRules { get; set; } + + /// + /// Gets or sets setting this to true enables RDP access to the VM. The + /// default NSG rule opens RDP port to internet which can be overridden + /// with custom Network Security Rules. The default value for this + /// setting is false. + /// + [JsonProperty(PropertyName = "properties.allowRdpAccess")] + public bool? AllowRdpAccess { get; set; } + + /// + /// Gets or sets custom Network Security Rules that are applied to the + /// virtual network of the cluster. + /// + [JsonProperty(PropertyName = "properties.networkSecurityRules")] + public IList NetworkSecurityRules { get; set; } + + /// + /// Gets or sets client certificates that are allowed to manage the + /// cluster. + /// + [JsonProperty(PropertyName = "properties.clients")] + public IList Clients { get; set; } + + /// + /// Gets or sets the AAD authentication settings of the cluster. + /// + [JsonProperty(PropertyName = "properties.azureActiveDirectory")] + public AzureActiveDirectory AzureActiveDirectory { get; set; } + + /// + /// Gets or sets the list of custom fabric settings to configure the + /// cluster. + /// + [JsonProperty(PropertyName = "properties.fabricSettings")] + public IList FabricSettings { get; set; } + + /// + /// Gets the provisioning state of the managed cluster resource. + /// Possible values include: 'None', 'Creating', 'Created', 'Updating', + /// 'Succeeded', 'Failed', 'Canceled', 'Deleting', 'Deleted', 'Other' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets the Service Fabric runtime version of the cluster. + /// This property can only by set the user when **upgradeMode** is set + /// to 'Manual'. To get list of available Service Fabric versions for + /// new clusters use [ClusterVersion API](./ClusterVersion.md). To get + /// the list of available version for existing clusters use + /// **availableClusterVersions**. + /// + [JsonProperty(PropertyName = "properties.clusterCodeVersion")] + public string ClusterCodeVersion { get; set; } + + /// + /// Gets or sets list of add-on features to enable on the cluster. + /// + [JsonProperty(PropertyName = "properties.addonFeatures")] + public IList AddonFeatures { get; set; } + + /// + /// Gets or sets setting this to true enables automatic OS upgrade for + /// the node types that are created using any platform OS image with + /// version 'latest'. The default value for this setting is false. + /// + [JsonProperty(PropertyName = "properties.enableAutoOSUpgrade")] + public bool? EnableAutoOSUpgrade { get; set; } + + /// + /// Gets or sets the policy used to clean up unused versions. + /// + [JsonProperty(PropertyName = "properties.applicationTypeVersionsCleanupPolicy")] + public ApplicationTypeVersionsCleanupPolicy ApplicationTypeVersionsCleanupPolicy { get; set; } + + /// + /// Gets or sets the sku of the managed cluster + /// + [JsonProperty(PropertyName = "sku")] + public Sku Sku { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (DnsName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DnsName"); + } + if (AdminUserName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "AdminUserName"); + } + if (LoadBalancingRules != null) + { + foreach (var element in LoadBalancingRules) + { + if (element != null) + { + element.Validate(); + } + } + } + if (NetworkSecurityRules != null) + { + foreach (var element1 in NetworkSecurityRules) + { + if (element1 != null) + { + element1.Validate(); + } + } + } + if (Clients != null) + { + foreach (var element2 in Clients) + { + if (element2 != null) + { + element2.Validate(); + } + } + } + if (FabricSettings != null) + { + foreach (var element3 in FabricSettings) + { + if (element3 != null) + { + element3.Validate(); + } + } + } + if (ApplicationTypeVersionsCleanupPolicy != null) + { + ApplicationTypeVersionsCleanupPolicy.Validate(); + } + if (Sku != null) + { + Sku.Validate(); + } + } + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ManagedClusterUpdateParameters.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ManagedClusterUpdateParameters.cs new file mode 100644 index 0000000000000..4784dd4995a49 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ManagedClusterUpdateParameters.cs @@ -0,0 +1,55 @@ +// +// 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.ServiceFabricManagedClusters.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Managed cluster update request + /// + public partial class ManagedClusterUpdateParameters + { + /// + /// Initializes a new instance of the ManagedClusterUpdateParameters + /// class. + /// + public ManagedClusterUpdateParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagedClusterUpdateParameters + /// class. + /// + /// Managed cluster update parameters + public ManagedClusterUpdateParameters(IDictionary tags = default(IDictionary)) + { + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets managed cluster update parameters + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ManagedIdentity.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ManagedIdentity.cs new file mode 100644 index 0000000000000..3c4357130c3a2 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ManagedIdentity.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.ServiceFabricManagedClusters.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes the managed identities for an Azure resource. + /// + public partial class ManagedIdentity + { + /// + /// Initializes a new instance of the ManagedIdentity class. + /// + public ManagedIdentity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagedIdentity class. + /// + /// The principal id of the managed identity. + /// This property will only be provided for a system assigned + /// identity. + /// The tenant id of the managed identity. This + /// property will only be provided for a system assigned + /// identity. + /// Possible values include: 'None', + /// 'SystemAssigned', 'UserAssigned', 'SystemAssigned, + /// UserAssigned' + public ManagedIdentity(string principalId = default(string), string tenantId = default(string), ManagedIdentityType? type = default(ManagedIdentityType?), IDictionary userAssignedIdentities = default(IDictionary)) + { + PrincipalId = principalId; + TenantId = tenantId; + Type = type; + UserAssignedIdentities = userAssignedIdentities; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the principal id of the managed identity. This property will + /// only be provided for a system assigned identity. + /// + [JsonProperty(PropertyName = "principalId")] + public string PrincipalId { get; private set; } + + /// + /// Gets the tenant id of the managed identity. This property will only + /// be provided for a system assigned identity. + /// + [JsonProperty(PropertyName = "tenantId")] + public string TenantId { get; private set; } + + /// + /// Gets or sets possible values include: 'None', 'SystemAssigned', + /// 'UserAssigned', 'SystemAssigned, UserAssigned' + /// + [JsonProperty(PropertyName = "type")] + public ManagedIdentityType? Type { get; set; } + + /// + /// + [JsonProperty(PropertyName = "userAssignedIdentities")] + public IDictionary UserAssignedIdentities { get; set; } + + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ManagedIdentityType.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ManagedIdentityType.cs new file mode 100644 index 0000000000000..44762d84aa4e9 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ManagedIdentityType.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.ServiceFabricManagedClusters.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for ManagedIdentityType. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ManagedIdentityType + { + /// + /// Indicates that no identity is associated with the resource. + /// + [EnumMember(Value = "None")] + None, + /// + /// Indicates that system assigned identity is associated with the + /// resource. + /// + [EnumMember(Value = "SystemAssigned")] + SystemAssigned, + /// + /// Indicates that user assigned identity is associated with the + /// resource. + /// + [EnumMember(Value = "UserAssigned")] + UserAssigned, + /// + /// Indicates that both system assigned and user assigned identity are + /// associated with the resource. + /// + [EnumMember(Value = "SystemAssigned, UserAssigned")] + SystemAssignedUserAssigned + } + internal static class ManagedIdentityTypeEnumExtension + { + internal static string ToSerializedValue(this ManagedIdentityType? value) + { + return value == null ? null : ((ManagedIdentityType)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this ManagedIdentityType value) + { + switch( value ) + { + case ManagedIdentityType.None: + return "None"; + case ManagedIdentityType.SystemAssigned: + return "SystemAssigned"; + case ManagedIdentityType.UserAssigned: + return "UserAssigned"; + case ManagedIdentityType.SystemAssignedUserAssigned: + return "SystemAssigned, UserAssigned"; + } + return null; + } + + internal static ManagedIdentityType? ParseManagedIdentityType(this string value) + { + switch( value ) + { + case "None": + return ManagedIdentityType.None; + case "SystemAssigned": + return ManagedIdentityType.SystemAssigned; + case "UserAssigned": + return ManagedIdentityType.UserAssigned; + case "SystemAssigned, UserAssigned": + return ManagedIdentityType.SystemAssignedUserAssigned; + } + return null; + } + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ManagedProxyResource.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ManagedProxyResource.cs new file mode 100644 index 0000000000000..5bad90f07d93f --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ManagedProxyResource.cs @@ -0,0 +1,85 @@ +// +// 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.ServiceFabricManagedClusters.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The resource model definition for proxy-only 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. + /// + /// Azure resource identifier. + /// Azure resource name. + /// Azure resource type. + /// Azure resource tags. + public ManagedProxyResource(string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), SystemData systemData = default(SystemData)) + { + Id = id; + Name = name; + Type = type; + Tags = tags; + SystemData = systemData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets azure resource identifier. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets azure resource name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets azure resource type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets azure resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; set; } + + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/MoveCost.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/MoveCost.cs new file mode 100644 index 0000000000000..89a7e16921711 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/MoveCost.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.ServiceFabricManagedClusters.Models +{ + + /// + /// Defines values for MoveCost. + /// + public static class MoveCost + { + /// + /// Zero move cost. This value is zero. + /// + public const string Zero = "Zero"; + /// + /// Specifies the move cost of the service as Low. The value is 1. + /// + public const string Low = "Low"; + /// + /// Specifies the move cost of the service as Medium. The value is 2. + /// + public const string Medium = "Medium"; + /// + /// Specifies the move cost of the service as High. The value is 3. + /// + public const string High = "High"; + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/NamedPartitionScheme.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/NamedPartitionScheme.cs new file mode 100644 index 0000000000000..681709bdad66a --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/NamedPartitionScheme.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.ServiceFabricManagedClusters.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes the named partition scheme of the service. + /// + [Newtonsoft.Json.JsonObject("Named")] + public partial class NamedPartitionScheme : Partition + { + /// + /// Initializes a new instance of the NamedPartitionScheme class. + /// + public NamedPartitionScheme() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NamedPartitionScheme class. + /// + /// Array for the names of the partitions. + public NamedPartitionScheme(IList names) + { + Names = names; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets array for the names of the partitions. + /// + [JsonProperty(PropertyName = "names")] + public IList Names { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Names == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Names"); + } + } + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/NetworkSecurityRule.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/NetworkSecurityRule.cs new file mode 100644 index 0000000000000..eb44d0967e9e4 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/NetworkSecurityRule.cs @@ -0,0 +1,179 @@ +// +// 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.ServiceFabricManagedClusters.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a network security rule. + /// + public partial class NetworkSecurityRule + { + /// + /// Initializes a new instance of the NetworkSecurityRule class. + /// + public NetworkSecurityRule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NetworkSecurityRule class. + /// + /// Network security rule name. + /// Network protocol this rule applies to. + /// Possible values include: 'http', 'https', 'tcp', 'udp', 'icmp', + /// 'ah', 'esp' + /// The network traffic is allowed or denied. + /// Possible values include: 'allow', 'deny' + /// The priority of the rule. The value can be + /// in the range 1000 to 3000. Values outside this range are reserved + /// for Service Fabric ManagerCluster Resource Provider. The priority + /// number must be unique for each rule in the collection. The lower + /// the priority number, the higher the priority of the rule. + /// Network security rule direction. Possible + /// values include: 'inbound', 'outbound' + /// Network security rule + /// description. + /// The CIDR or source IP + /// ranges. + /// The destination address + /// prefixes. CIDR or destination IP ranges. + /// The source port ranges. + /// The destination port + /// ranges. + public NetworkSecurityRule(string name, string protocol, string access, int priority, string direction, string description = default(string), IList sourceAddressPrefixes = default(IList), IList destinationAddressPrefixes = default(IList), IList sourcePortRanges = default(IList), IList destinationPortRanges = default(IList)) + { + Name = name; + Description = description; + Protocol = protocol; + SourceAddressPrefixes = sourceAddressPrefixes; + DestinationAddressPrefixes = destinationAddressPrefixes; + SourcePortRanges = sourcePortRanges; + DestinationPortRanges = destinationPortRanges; + Access = access; + Priority = priority; + Direction = direction; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets network security rule name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets network security rule description. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// Gets or sets network protocol this rule applies to. Possible values + /// include: 'http', 'https', 'tcp', 'udp', 'icmp', 'ah', 'esp' + /// + [JsonProperty(PropertyName = "protocol")] + public string Protocol { get; set; } + + /// + /// Gets or sets the CIDR or source IP ranges. + /// + [JsonProperty(PropertyName = "sourceAddressPrefixes")] + public IList SourceAddressPrefixes { get; set; } + + /// + /// Gets or sets the destination address prefixes. CIDR or destination + /// IP ranges. + /// + [JsonProperty(PropertyName = "destinationAddressPrefixes")] + public IList DestinationAddressPrefixes { get; set; } + + /// + /// Gets or sets the source port ranges. + /// + [JsonProperty(PropertyName = "sourcePortRanges")] + public IList SourcePortRanges { get; set; } + + /// + /// Gets or sets the destination port ranges. + /// + [JsonProperty(PropertyName = "destinationPortRanges")] + public IList DestinationPortRanges { get; set; } + + /// + /// Gets or sets the network traffic is allowed or denied. Possible + /// values include: 'allow', 'deny' + /// + [JsonProperty(PropertyName = "access")] + public string Access { get; set; } + + /// + /// Gets or sets the priority of the rule. The value can be in the + /// range 1000 to 3000. Values outside this range are reserved for + /// Service Fabric ManagerCluster Resource Provider. The priority + /// number must be unique for each rule in the collection. The lower + /// the priority number, the higher the priority of the rule. + /// + [JsonProperty(PropertyName = "priority")] + public int Priority { get; set; } + + /// + /// Gets or sets network security rule direction. Possible values + /// include: 'inbound', 'outbound' + /// + [JsonProperty(PropertyName = "direction")] + public string Direction { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (Protocol == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Protocol"); + } + if (Access == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Access"); + } + if (Direction == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Direction"); + } + if (Priority > 3000) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "Priority", 3000); + } + if (Priority < 1000) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "Priority", 1000); + } + } + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/NodeType.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/NodeType.cs new file mode 100644 index 0000000000000..a4764a84aa5c4 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/NodeType.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.ServiceFabricManagedClusters.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a node type in the cluster, each node type represents sub set + /// of nodes in the cluster. + /// + [Rest.Serialization.JsonTransformation] + public partial class NodeType : ManagedProxyResource + { + /// + /// Initializes a new instance of the NodeType class. + /// + public NodeType() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NodeType class. + /// + /// The node type on which system services will + /// run. Only one node type should be marked as primary. Primary node + /// type cannot be deleted or changed for existing clusters. + /// The number of nodes in the node + /// type. + /// Disk size for each vm in the node type + /// in GBs. + /// Azure resource identifier. + /// Azure resource name. + /// Azure resource type. + /// Azure resource tags. + /// The placement tags applied to + /// nodes in the node type, which can be used to indicate where certain + /// services (workload) should run. + /// The capacity tags applied to the nodes in + /// the node type, the cluster resource manager uses these tags to + /// understand how much resource a node has. + /// The range of ports from which + /// cluster assigned port to Service Fabric applications. + /// The range of ephemeral ports that + /// nodes in this node type should be configured with. + /// The size of virtual machines in the pool. All + /// virtual machines in a pool are the same size. For example, + /// Standard_D3. + /// The publisher of the Azure Virtual + /// Machines Marketplace image. For example, Canonical or + /// MicrosoftWindowsServer. + /// The offer type of the Azure Virtual + /// Machines Marketplace image. For example, UbuntuServer or + /// WindowsServer. + /// The SKU of the Azure Virtual Machines + /// Marketplace image. For example, 14.04.0-LTS or + /// 2012-R2-Datacenter. + /// The version of the Azure Virtual + /// Machines Marketplace image. A value of 'latest' can be specified to + /// select the latest version of an image. If omitted, the default is + /// 'latest'. + /// virtual machine secretes. + /// virtual machine extensions. + /// The provisioning state of the + /// managed cluster resource. Possible values include: 'None', + /// 'Creating', 'Created', 'Updating', 'Succeeded', 'Failed', + /// 'Canceled', 'Deleting', 'Deleted', 'Other' + public NodeType(bool isPrimary, int vmInstanceCount, int dataDiskSizeGB, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), SystemData systemData = default(SystemData), IDictionary placementProperties = default(IDictionary), IDictionary capacities = default(IDictionary), EndpointRangeDescription applicationPorts = default(EndpointRangeDescription), EndpointRangeDescription ephemeralPorts = default(EndpointRangeDescription), string vmSize = default(string), string vmImagePublisher = default(string), string vmImageOffer = default(string), string vmImageSku = default(string), string vmImageVersion = default(string), IList vmSecrets = default(IList), IList vmExtensions = default(IList), VmManagedIdentity vmManagedIdentity = default(VmManagedIdentity), string provisioningState = default(string)) + : base(id, name, type, tags, systemData) + { + IsPrimary = isPrimary; + VmInstanceCount = vmInstanceCount; + DataDiskSizeGB = dataDiskSizeGB; + PlacementProperties = placementProperties; + Capacities = capacities; + ApplicationPorts = applicationPorts; + EphemeralPorts = ephemeralPorts; + VmSize = vmSize; + VmImagePublisher = vmImagePublisher; + VmImageOffer = vmImageOffer; + VmImageSku = vmImageSku; + VmImageVersion = vmImageVersion; + VmSecrets = vmSecrets; + VmExtensions = vmExtensions; + VmManagedIdentity = vmManagedIdentity; + ProvisioningState = provisioningState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the node type on which system services will run. Only + /// one node type should be marked as primary. Primary node type cannot + /// be deleted or changed for existing clusters. + /// + [JsonProperty(PropertyName = "properties.isPrimary")] + public bool IsPrimary { get; set; } + + /// + /// Gets or sets the number of nodes in the node type. + /// + [JsonProperty(PropertyName = "properties.vmInstanceCount")] + public int VmInstanceCount { get; set; } + + /// + /// Gets or sets disk size for each vm in the node type in GBs. + /// + [JsonProperty(PropertyName = "properties.dataDiskSizeGB")] + public int DataDiskSizeGB { get; set; } + + /// + /// Gets or sets the placement tags applied to nodes in the node type, + /// which can be used to indicate where certain services (workload) + /// should run. + /// + [JsonProperty(PropertyName = "properties.placementProperties")] + public IDictionary PlacementProperties { get; set; } + + /// + /// Gets or sets the capacity tags applied to the nodes in the node + /// type, the cluster resource manager uses these tags to understand + /// how much resource a node has. + /// + [JsonProperty(PropertyName = "properties.capacities")] + public IDictionary Capacities { get; set; } + + /// + /// Gets or sets the range of ports from which cluster assigned port to + /// Service Fabric applications. + /// + [JsonProperty(PropertyName = "properties.applicationPorts")] + public EndpointRangeDescription ApplicationPorts { get; set; } + + /// + /// Gets or sets the range of ephemeral ports that nodes in this node + /// type should be configured with. + /// + [JsonProperty(PropertyName = "properties.ephemeralPorts")] + public EndpointRangeDescription EphemeralPorts { get; set; } + + /// + /// Gets or sets the size of virtual machines in the pool. All virtual + /// machines in a pool are the same size. For example, Standard_D3. + /// + [JsonProperty(PropertyName = "properties.vmSize")] + public string VmSize { get; set; } + + /// + /// Gets or sets the publisher of the Azure Virtual Machines + /// Marketplace image. For example, Canonical or + /// MicrosoftWindowsServer. + /// + [JsonProperty(PropertyName = "properties.vmImagePublisher")] + public string VmImagePublisher { get; set; } + + /// + /// Gets or sets the offer type of the Azure Virtual Machines + /// Marketplace image. For example, UbuntuServer or WindowsServer. + /// + [JsonProperty(PropertyName = "properties.vmImageOffer")] + public string VmImageOffer { get; set; } + + /// + /// Gets or sets the SKU of the Azure Virtual Machines Marketplace + /// image. For example, 14.04.0-LTS or 2012-R2-Datacenter. + /// + [JsonProperty(PropertyName = "properties.vmImageSku")] + public string VmImageSku { get; set; } + + /// + /// Gets or sets the version of the Azure Virtual Machines Marketplace + /// image. A value of 'latest' can be specified to select the latest + /// version of an image. If omitted, the default is 'latest'. + /// + [JsonProperty(PropertyName = "properties.vmImageVersion")] + public string VmImageVersion { get; set; } + + /// + /// Gets or sets virtual machine secretes. + /// + /// + /// The secrets to install in the virtual machines. + /// + [JsonProperty(PropertyName = "properties.vmSecrets")] + public IList VmSecrets { get; set; } + + /// + /// Gets or sets virtual machine extensions. + /// + /// + /// Set of extensions that should be installed onto the virtual + /// machines. + /// + [JsonProperty(PropertyName = "properties.vmExtensions")] + public IList VmExtensions { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.vmManagedIdentity")] + public VmManagedIdentity VmManagedIdentity { get; set; } + + /// + /// Gets the provisioning state of the managed cluster resource. + /// Possible values include: 'None', 'Creating', 'Created', 'Updating', + /// 'Succeeded', 'Failed', 'Canceled', 'Deleting', 'Deleted', 'Other' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (VmInstanceCount > 2147483647) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "VmInstanceCount", 2147483647); + } + if (VmInstanceCount < 1) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "VmInstanceCount", 1); + } + if (ApplicationPorts != null) + { + ApplicationPorts.Validate(); + } + if (EphemeralPorts != null) + { + EphemeralPorts.Validate(); + } + if (VmSecrets != null) + { + foreach (var element in VmSecrets) + { + if (element != null) + { + element.Validate(); + } + } + } + if (VmExtensions != null) + { + foreach (var element1 in VmExtensions) + { + if (element1 != null) + { + element1.Validate(); + } + } + } + } + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/NodeTypeActionParameters.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/NodeTypeActionParameters.cs new file mode 100644 index 0000000000000..ef5e4370c25a2 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/NodeTypeActionParameters.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.ServiceFabricManagedClusters.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Parameters for Node type action. + /// + public partial class NodeTypeActionParameters + { + /// + /// Initializes a new instance of the NodeTypeActionParameters class. + /// + public NodeTypeActionParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NodeTypeActionParameters class. + /// + /// List of node names from the node type. + /// Force the action to go through. + public NodeTypeActionParameters(IList nodes, bool? force = default(bool?)) + { + Nodes = nodes; + Force = force; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of node names from the node type. + /// + [JsonProperty(PropertyName = "nodes")] + public IList Nodes { get; set; } + + /// + /// Gets or sets force the action to go through. + /// + [JsonProperty(PropertyName = "force")] + public bool? Force { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Nodes == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Nodes"); + } + } + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/NodeTypeUpdateParameters.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/NodeTypeUpdateParameters.cs new file mode 100644 index 0000000000000..4576057eb15bc --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/NodeTypeUpdateParameters.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.ServiceFabricManagedClusters.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Node type update request + /// + public partial class NodeTypeUpdateParameters + { + /// + /// Initializes a new instance of the NodeTypeUpdateParameters class. + /// + public NodeTypeUpdateParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NodeTypeUpdateParameters class. + /// + /// Node type update parameters + public NodeTypeUpdateParameters(IDictionary tags = default(IDictionary)) + { + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets node type update parameters + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/NsgProtocol.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/NsgProtocol.cs new file mode 100644 index 0000000000000..606a9499e0aff --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/NsgProtocol.cs @@ -0,0 +1,27 @@ +// +// 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.ServiceFabricManagedClusters.Models +{ + + /// + /// Defines values for NsgProtocol. + /// + public static class NsgProtocol + { + public const string Http = "http"; + public const string Https = "https"; + public const string Tcp = "tcp"; + public const string Udp = "udp"; + public const string Icmp = "icmp"; + public const string Ah = "ah"; + public const string Esp = "esp"; + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/OperationResult.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/OperationResult.cs new file mode 100644 index 0000000000000..be196a1e0abd0 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/OperationResult.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.ServiceFabricManagedClusters.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Available operation list result + /// + 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. + /// Indicates whether the operation is a + /// data action + /// 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), bool? isDataAction = default(bool?), AvailableOperationDisplay display = default(AvailableOperationDisplay), string origin = default(string), string nextLink = default(string)) + { + Name = name; + IsDataAction = isDataAction; + 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 indicates whether the operation is a data action + /// + [JsonProperty(PropertyName = "isDataAction")] + public bool? IsDataAction { 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/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/Page.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/Page.cs new file mode 100644 index 0000000000000..e39f5a5bbbfd8 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/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.ServiceFabricManagedClusters.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/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/Partition.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/Partition.cs new file mode 100644 index 0000000000000..4efffeb17976a --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/Partition.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.ServiceFabricManagedClusters.Models +{ + using System.Linq; + + /// + /// Describes how the service is partitioned. + /// + public partial class Partition + { + /// + /// Initializes a new instance of the Partition class. + /// + public Partition() + { + CustomInit(); + } + + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/PartitionInstanceCountScaleMechanism.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/PartitionInstanceCountScaleMechanism.cs new file mode 100644 index 0000000000000..f30820776a795 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/PartitionInstanceCountScaleMechanism.cs @@ -0,0 +1,85 @@ +// +// 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.ServiceFabricManagedClusters.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents a scaling mechanism for adding or removing instances of + /// stateless service partition. + /// + [Newtonsoft.Json.JsonObject("ScalePartitionInstanceCount")] + public partial class PartitionInstanceCountScaleMechanism : ScalingMechanism + { + /// + /// Initializes a new instance of the + /// PartitionInstanceCountScaleMechanism class. + /// + public PartitionInstanceCountScaleMechanism() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// PartitionInstanceCountScaleMechanism class. + /// + /// Minimum number of instances of the + /// partition. + /// Maximum number of instances of the + /// partition. + /// The number of instances to add or + /// remove during a scaling operation. + public PartitionInstanceCountScaleMechanism(int minInstanceCount, int maxInstanceCount, int scaleIncrement) + { + MinInstanceCount = minInstanceCount; + MaxInstanceCount = maxInstanceCount; + ScaleIncrement = scaleIncrement; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets minimum number of instances of the partition. + /// + [JsonProperty(PropertyName = "minInstanceCount")] + public int MinInstanceCount { get; set; } + + /// + /// Gets or sets maximum number of instances of the partition. + /// + [JsonProperty(PropertyName = "maxInstanceCount")] + public int MaxInstanceCount { get; set; } + + /// + /// Gets or sets the number of instances to add or remove during a + /// scaling operation. + /// + [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/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/PartitionScheme.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/PartitionScheme.cs new file mode 100644 index 0000000000000..3dd58c7af8cdd --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/PartitionScheme.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.ServiceFabricManagedClusters.Models +{ + + /// + /// Defines values for PartitionScheme. + /// + public static class PartitionScheme + { + /// + /// Indicates that the partition is based on string names, and is a + /// SingletonPartitionScheme object, The value is 0. + /// + public const string Singleton = "Singleton"; + /// + /// Indicates that the partition is based on Int64 key ranges, and is a + /// UniformInt64RangePartitionScheme object. The value is 1. + /// + public const string UniformInt64Range = "UniformInt64Range"; + /// + /// Indicates that the partition is based on string names, and is a + /// NamedPartitionScheme object. The value is 2. + /// + public const string Named = "Named"; + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ProbeProtocol.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ProbeProtocol.cs new file mode 100644 index 0000000000000..28d4bd3b19887 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ProbeProtocol.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.ServiceFabricManagedClusters.Models +{ + + /// + /// Defines values for ProbeProtocol. + /// + public static class ProbeProtocol + { + public const string Tcp = "tcp"; + public const string Http = "http"; + public const string Https = "https"; + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/Protocol.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/Protocol.cs new file mode 100644 index 0000000000000..2b860558790b1 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/Protocol.cs @@ -0,0 +1,22 @@ +// +// 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.ServiceFabricManagedClusters.Models +{ + + /// + /// Defines values for Protocol. + /// + public static class Protocol + { + public const string Tcp = "tcp"; + public const string Udp = "udp"; + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ProxyResource.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ProxyResource.cs new file mode 100644 index 0000000000000..c07114807bc72 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ProxyResource.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.ServiceFabricManagedClusters.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The resource model definition for proxy-only resource. + /// + public partial class ProxyResource : IResource + { + /// + /// Initializes a new instance of the ProxyResource class. + /// + public ProxyResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ProxyResource class. + /// + /// Azure resource identifier. + /// Azure resource name. + /// Azure resource type. + /// Resource location depends on the parent + /// resource. + /// Azure resource tags. + public ProxyResource(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), SystemData systemData = default(SystemData)) + { + Id = id; + Name = name; + Type = type; + Location = location; + Tags = tags; + SystemData = systemData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets azure resource identifier. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets azure resource name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets azure resource type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets resource location depends on the parent resource. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Gets or sets azure resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; set; } + + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/Resource.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/Resource.cs new file mode 100644 index 0000000000000..d934344e41837 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/Resource.cs @@ -0,0 +1,114 @@ +// +// 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.ServiceFabricManagedClusters.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The resource model definition. + /// + public partial class Resource : IResource + { + /// + /// Initializes a new instance of the Resource class. + /// + public Resource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Resource class. + /// + /// Azure resource location. + /// Azure resource identifier. + /// Azure resource name. + /// Azure resource type. + /// Azure resource tags. + /// Azure resource etag. + public Resource(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string etag = default(string), SystemData systemData = default(SystemData)) + { + Id = id; + Name = name; + Type = type; + Location = location; + Tags = tags; + Etag = etag; + SystemData = systemData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets azure resource identifier. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets azure resource name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets azure resource type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets azure resource location. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Gets or sets azure resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Gets azure resource etag. + /// + [JsonProperty(PropertyName = "etag")] + public string Etag { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { 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/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/RollingUpgradeMode.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/RollingUpgradeMode.cs new file mode 100644 index 0000000000000..fedcc842885cd --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/RollingUpgradeMode.cs @@ -0,0 +1,30 @@ +// +// 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.ServiceFabricManagedClusters.Models +{ + + /// + /// Defines values for RollingUpgradeMode. + /// + public static class RollingUpgradeMode + { + /// + /// The upgrade will stop after completing each upgrade domain and + /// automatically monitor health before proceeding. The value is 0. + /// + public const string Monitored = "Monitored"; + /// + /// The upgrade will proceed automatically without performing any + /// health monitoring. The value is 1. + /// + public const string UnmonitoredAuto = "UnmonitoredAuto"; + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/RollingUpgradeMonitoringPolicy.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/RollingUpgradeMonitoringPolicy.cs new file mode 100644 index 0000000000000..a8fc1aa620ea5 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/RollingUpgradeMonitoringPolicy.cs @@ -0,0 +1,128 @@ +// +// 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.ServiceFabricManagedClusters.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The policy used for monitoring the application upgrade + /// + public partial class RollingUpgradeMonitoringPolicy + { + /// + /// Initializes a new instance of the RollingUpgradeMonitoringPolicy + /// class. + /// + public RollingUpgradeMonitoringPolicy() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RollingUpgradeMonitoringPolicy + /// class. + /// + /// The compensating action to perform when + /// a Monitored upgrade encounters monitoring policy or health policy + /// violations. Invalid indicates the failure action is invalid. + /// Rollback specifies that the upgrade will start rolling back + /// automatically. Manual indicates that the upgrade will switch to + /// UnmonitoredManual upgrade mode. Possible values include: + /// 'Rollback', 'Manual' + public RollingUpgradeMonitoringPolicy(string failureAction, string healthCheckWaitDuration, string healthCheckStableDuration, string healthCheckRetryTimeout, string upgradeTimeout, string upgradeDomainTimeout) + { + FailureAction = failureAction; + HealthCheckWaitDuration = healthCheckWaitDuration; + HealthCheckStableDuration = healthCheckStableDuration; + HealthCheckRetryTimeout = healthCheckRetryTimeout; + UpgradeTimeout = upgradeTimeout; + UpgradeDomainTimeout = upgradeDomainTimeout; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the compensating action to perform when a Monitored + /// upgrade encounters monitoring policy or health policy violations. + /// Invalid indicates the failure action is invalid. Rollback specifies + /// that the upgrade will start rolling back automatically. Manual + /// indicates that the upgrade will switch to UnmonitoredManual upgrade + /// mode. Possible values include: 'Rollback', 'Manual' + /// + [JsonProperty(PropertyName = "failureAction")] + public string FailureAction { get; set; } + + /// + /// + [JsonProperty(PropertyName = "healthCheckWaitDuration")] + public string HealthCheckWaitDuration { get; set; } + + /// + /// + [JsonProperty(PropertyName = "healthCheckStableDuration")] + public string HealthCheckStableDuration { get; set; } + + /// + /// + [JsonProperty(PropertyName = "healthCheckRetryTimeout")] + public string HealthCheckRetryTimeout { get; set; } + + /// + /// + [JsonProperty(PropertyName = "upgradeTimeout")] + public string UpgradeTimeout { get; set; } + + /// + /// + [JsonProperty(PropertyName = "upgradeDomainTimeout")] + public string UpgradeDomainTimeout { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (FailureAction == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "FailureAction"); + } + if (HealthCheckWaitDuration == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "HealthCheckWaitDuration"); + } + if (HealthCheckStableDuration == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "HealthCheckStableDuration"); + } + if (HealthCheckRetryTimeout == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "HealthCheckRetryTimeout"); + } + if (UpgradeTimeout == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "UpgradeTimeout"); + } + if (UpgradeDomainTimeout == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "UpgradeDomainTimeout"); + } + } + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ScalingMechanism.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ScalingMechanism.cs new file mode 100644 index 0000000000000..0b9b04afc8d49 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ScalingMechanism.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.ServiceFabricManagedClusters.Models +{ + using System.Linq; + + /// + /// Describes the mechanism for performing a scaling operation. + /// + public partial class ScalingMechanism + { + /// + /// Initializes a new instance of the ScalingMechanism class. + /// + public ScalingMechanism() + { + CustomInit(); + } + + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ScalingPolicy.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ScalingPolicy.cs new file mode 100644 index 0000000000000..76c429afe2280 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ScalingPolicy.cs @@ -0,0 +1,81 @@ +// +// 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.ServiceFabricManagedClusters.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Specifies a metric to load balance a service during runtime. + /// + public partial class ScalingPolicy + { + /// + /// Initializes a new instance of the ScalingPolicy class. + /// + public ScalingPolicy() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ScalingPolicy class. + /// + /// Specifies the mechanism associated + /// with this scaling policy + /// Specifies the trigger associated with + /// this scaling policy. + public ScalingPolicy(ScalingMechanism scalingMechanism, ScalingTrigger scalingTrigger) + { + ScalingMechanism = scalingMechanism; + ScalingTrigger = scalingTrigger; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the mechanism associated with this scaling + /// policy + /// + [JsonProperty(PropertyName = "scalingMechanism")] + public ScalingMechanism ScalingMechanism { get; set; } + + /// + /// Gets or sets specifies the trigger associated with this scaling + /// policy. + /// + [JsonProperty(PropertyName = "scalingTrigger")] + public ScalingTrigger ScalingTrigger { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ScalingMechanism == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ScalingMechanism"); + } + if (ScalingTrigger == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ScalingTrigger"); + } + } + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ScalingTrigger.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ScalingTrigger.cs new file mode 100644 index 0000000000000..d4352b0811580 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ScalingTrigger.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.ServiceFabricManagedClusters.Models +{ + using System.Linq; + + /// + /// Describes the trigger for performing a scaling operation. + /// + public partial class ScalingTrigger + { + /// + /// Initializes a new instance of the ScalingTrigger class. + /// + public ScalingTrigger() + { + CustomInit(); + } + + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServiceCorrelation.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServiceCorrelation.cs new file mode 100644 index 0000000000000..ebd99b253594e --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServiceCorrelation.cs @@ -0,0 +1,85 @@ +// +// 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.ServiceFabricManagedClusters.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Creates a particular correlation between services. + /// + public partial class ServiceCorrelation + { + /// + /// Initializes a new instance of the ServiceCorrelation class. + /// + public ServiceCorrelation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ServiceCorrelation class. + /// + /// The ServiceCorrelationScheme which describes + /// the relationship between this service and the service specified via + /// ServiceName. Possible values include: 'AlignedAffinity', + /// 'NonAlignedAffinity' + /// The Arm Resource ID of the service that + /// the correlation relationship is established with. + public ServiceCorrelation(string scheme, string serviceName) + { + Scheme = scheme; + ServiceName = serviceName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the ServiceCorrelationScheme which describes the + /// relationship between this service and the service specified via + /// ServiceName. Possible values include: 'AlignedAffinity', + /// 'NonAlignedAffinity' + /// + [JsonProperty(PropertyName = "scheme")] + public string Scheme { get; set; } + + /// + /// Gets or sets the Arm Resource ID of the service that the + /// correlation relationship is established with. + /// + [JsonProperty(PropertyName = "serviceName")] + public string ServiceName { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Scheme == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Scheme"); + } + if (ServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ServiceName"); + } + } + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServiceCorrelationScheme.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServiceCorrelationScheme.cs new file mode 100644 index 0000000000000..2d81dbfef7a62 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServiceCorrelationScheme.cs @@ -0,0 +1,34 @@ +// +// 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.ServiceFabricManagedClusters.Models +{ + + /// + /// Defines values for ServiceCorrelationScheme. + /// + public static class ServiceCorrelationScheme + { + /// + /// Aligned affinity ensures that the primaries of the partitions of + /// the affinitized services are collocated on the same nodes. This is + /// the default and is the same as selecting the Affinity scheme. The + /// value is 0. + /// + public const string AlignedAffinity = "AlignedAffinity"; + /// + /// Non-Aligned affinity guarantees that all replicas of each service + /// will be placed on the same nodes. Unlike Aligned Affinity, this + /// does not guarantee that replicas of particular role will be + /// collocated. The value is 1. + /// + public const string NonAlignedAffinity = "NonAlignedAffinity"; + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServiceKind.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServiceKind.cs new file mode 100644 index 0000000000000..66a3b88082c34 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServiceKind.cs @@ -0,0 +1,30 @@ +// +// 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.ServiceFabricManagedClusters.Models +{ + + /// + /// Defines values for ServiceKind. + /// + public static class ServiceKind + { + /// + /// Does not use Service Fabric to make its state highly available or + /// reliable. The value is 0. + /// + public const string Stateless = "Stateless"; + /// + /// Uses Service Fabric to make its state or part of its state highly + /// available and reliable. The value is 1. + /// + public const string Stateful = "Stateful"; + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServiceLoadMetric.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServiceLoadMetric.cs new file mode 100644 index 0000000000000..b590ab0ff2a75 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServiceLoadMetric.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.ServiceFabricManagedClusters.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Specifies a metric to load balance a service during runtime. + /// + public partial class ServiceLoadMetric + { + /// + /// Initializes a new instance of the ServiceLoadMetric class. + /// + public ServiceLoadMetric() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ServiceLoadMetric class. + /// + /// The name of the metric. If the service chooses + /// to report load during runtime, the load metric name should match + /// the name that is specified in Name exactly. Note that metric names + /// are case sensitive. + /// The service load metric relative weight, + /// compared to other metrics configured for this service, as a number. + /// Possible values include: 'Zero', 'Low', 'Medium', 'High' + /// Used only for Stateful services. + /// The default amount of load, as a number, that this service creates + /// for this metric when it is a Primary replica. + /// Used only for Stateful services. + /// The default amount of load, as a number, that this service creates + /// for this metric when it is a Secondary replica. + /// Used only for Stateless services. The + /// default amount of load, as a number, that this service creates for + /// this metric. + public ServiceLoadMetric(string name, string weight = default(string), int? primaryDefaultLoad = default(int?), int? secondaryDefaultLoad = default(int?), int? defaultLoad = default(int?)) + { + Name = name; + Weight = weight; + PrimaryDefaultLoad = primaryDefaultLoad; + SecondaryDefaultLoad = secondaryDefaultLoad; + DefaultLoad = defaultLoad; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the metric. If the service chooses to + /// report load during runtime, the load metric name should match the + /// name that is specified in Name exactly. Note that metric names are + /// case sensitive. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the service load metric relative weight, compared to + /// other metrics configured for this service, as a number. Possible + /// values include: 'Zero', 'Low', 'Medium', 'High' + /// + [JsonProperty(PropertyName = "weight")] + public string Weight { get; set; } + + /// + /// Gets or sets used only for Stateful services. The default amount of + /// load, as a number, that this service creates for this metric when + /// it is a Primary replica. + /// + [JsonProperty(PropertyName = "primaryDefaultLoad")] + public int? PrimaryDefaultLoad { get; set; } + + /// + /// Gets or sets used only for Stateful services. The default amount of + /// load, as a number, that this service creates for this metric when + /// it is a Secondary replica. + /// + [JsonProperty(PropertyName = "secondaryDefaultLoad")] + public int? SecondaryDefaultLoad { get; set; } + + /// + /// Gets or sets used only for Stateless services. The default amount + /// of load, as a number, that this service creates for this metric. + /// + [JsonProperty(PropertyName = "defaultLoad")] + public int? DefaultLoad { 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/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServiceLoadMetricWeight.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServiceLoadMetricWeight.cs new file mode 100644 index 0000000000000..1f9e310f1c4ef --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServiceLoadMetricWeight.cs @@ -0,0 +1,39 @@ +// +// 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.ServiceFabricManagedClusters.Models +{ + + /// + /// Defines values for ServiceLoadMetricWeight. + /// + public static class ServiceLoadMetricWeight + { + /// + /// Disables resource balancing for this metric. This value is zero. + /// + public const string Zero = "Zero"; + /// + /// Specifies the metric weight of the service load as Low. The value + /// is 1. + /// + public const string Low = "Low"; + /// + /// Specifies the metric weight of the service load as Medium. The + /// value is 2. + /// + public const string Medium = "Medium"; + /// + /// Specifies the metric weight of the service load as High. The value + /// is 3. + /// + public const string High = "High"; + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServicePackageActivationMode.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServicePackageActivationMode.cs new file mode 100644 index 0000000000000..fb795c23069cb --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServicePackageActivationMode.cs @@ -0,0 +1,30 @@ +// +// 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.ServiceFabricManagedClusters.Models +{ + + /// + /// Defines values for ServicePackageActivationMode. + /// + public static class ServicePackageActivationMode + { + /// + /// Indicates the application package activation mode will use shared + /// process. + /// + public const string SharedProcess = "SharedProcess"; + /// + /// Indicates the application package activation mode will use + /// exclusive process. + /// + public const string ExclusiveProcess = "ExclusiveProcess"; + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServicePlacementInvalidDomainPolicy.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServicePlacementInvalidDomainPolicy.cs new file mode 100644 index 0000000000000..10b1e62deef6b --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServicePlacementInvalidDomainPolicy.cs @@ -0,0 +1,72 @@ +// +// 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.ServiceFabricManagedClusters.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes the policy to be used for placement of a Service Fabric + /// service where a particular fault or upgrade domain should not be used + /// for placement of the instances or replicas of that service. + /// + [Newtonsoft.Json.JsonObject("InvalidDomain")] + public partial class ServicePlacementInvalidDomainPolicy : ServicePlacementPolicy + { + /// + /// Initializes a new instance of the + /// ServicePlacementInvalidDomainPolicy class. + /// + public ServicePlacementInvalidDomainPolicy() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ServicePlacementInvalidDomainPolicy class. + /// + /// The name of the domain that should not be + /// used for placement. + public ServicePlacementInvalidDomainPolicy(string domainName) + { + DomainName = domainName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the domain that should not be used for + /// placement. + /// + [JsonProperty(PropertyName = "domainName")] + public string DomainName { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (DomainName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DomainName"); + } + } + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServicePlacementNonPartiallyPlaceServicePolicy.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServicePlacementNonPartiallyPlaceServicePolicy.cs new file mode 100644 index 0000000000000..feb4b0d5441ab --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServicePlacementNonPartiallyPlaceServicePolicy.cs @@ -0,0 +1,39 @@ +// +// 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.ServiceFabricManagedClusters.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The name of the domain that should used for placement as per this + /// policy. + /// + [Newtonsoft.Json.JsonObject("NonPartiallyPlaceService")] + public partial class ServicePlacementNonPartiallyPlaceServicePolicy : ServicePlacementPolicy + { + /// + /// Initializes a new instance of the + /// ServicePlacementNonPartiallyPlaceServicePolicy class. + /// + public ServicePlacementNonPartiallyPlaceServicePolicy() + { + CustomInit(); + } + + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServicePlacementPolicy.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServicePlacementPolicy.cs new file mode 100644 index 0000000000000..1cd1076b64ce1 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServicePlacementPolicy.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.ServiceFabricManagedClusters.Models +{ + using System.Linq; + + /// + /// Describes the policy to be used for placement of a Service Fabric + /// service. + /// + public partial class ServicePlacementPolicy + { + /// + /// Initializes a new instance of the ServicePlacementPolicy class. + /// + public ServicePlacementPolicy() + { + CustomInit(); + } + + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServicePlacementPolicyType.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServicePlacementPolicyType.cs new file mode 100644 index 0000000000000..5157a4c15e4ce --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServicePlacementPolicyType.cs @@ -0,0 +1,57 @@ +// +// 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.ServiceFabricManagedClusters.Models +{ + + /// + /// Defines values for ServicePlacementPolicyType. + /// + public static class ServicePlacementPolicyType + { + /// + /// Indicates that the ServicePlacementPolicyDescription is of type + /// ServicePlacementInvalidDomainPolicyDescription, which indicates + /// that a particular fault or upgrade domain cannot be used for + /// placement of this service. The value is 0. + /// + public const string InvalidDomain = "InvalidDomain"; + /// + /// Indicates that the ServicePlacementPolicyDescription is of type + /// ServicePlacementRequireDomainDistributionPolicyDescription + /// indicating that the replicas of the service must be placed in a + /// specific domain. The value is 1. + /// + public const string RequiredDomain = "RequiredDomain"; + /// + /// Indicates that the ServicePlacementPolicyDescription is of type + /// ServicePlacementPreferPrimaryDomainPolicyDescription, which + /// indicates that if possible the Primary replica for the partitions + /// of the service should be located in a particular domain as an + /// optimization. The value is 2. + /// + public const string PreferredPrimaryDomain = "PreferredPrimaryDomain"; + /// + /// Indicates that the ServicePlacementPolicyDescription is of type + /// ServicePlacementRequireDomainDistributionPolicyDescription, + /// indicating that the system will disallow placement of any two + /// replicas from the same partition in the same domain at any time. + /// The value is 3. + /// + public const string RequiredDomainDistribution = "RequiredDomainDistribution"; + /// + /// Indicates that the ServicePlacementPolicyDescription is of type + /// ServicePlacementNonPartiallyPlaceServicePolicyDescription, which + /// indicates that if possible all replicas of a particular partition + /// of the service should be placed atomically. The value is 4. + /// + public const string NonPartiallyPlaceService = "NonPartiallyPlaceService"; + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServicePlacementPreferPrimaryDomainPolicy.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServicePlacementPreferPrimaryDomainPolicy.cs new file mode 100644 index 0000000000000..d9349a6c7c47e --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServicePlacementPreferPrimaryDomainPolicy.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.ServiceFabricManagedClusters.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes the policy to be used for placement of a Service Fabric + /// service where the service's + /// Primary replicas should optimally be placed in a particular domain. + /// + /// This placement policy is usually used with fault domains in scenarios + /// where the Service Fabric + /// cluster is geographically distributed in order to indicate that a + /// service's primary replica should + /// be located in a particular fault domain, which in geo-distributed + /// scenarios usually aligns with regional + /// or datacenter boundaries. Note that since this is an optimization it is + /// possible that the Primary replica + /// may not end up located in this domain due to failures, capacity limits, + /// or other constraints. + /// + /// + [Newtonsoft.Json.JsonObject("PreferredPrimaryDomain")] + public partial class ServicePlacementPreferPrimaryDomainPolicy : ServicePlacementPolicy + { + /// + /// Initializes a new instance of the + /// ServicePlacementPreferPrimaryDomainPolicy class. + /// + public ServicePlacementPreferPrimaryDomainPolicy() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ServicePlacementPreferPrimaryDomainPolicy class. + /// + /// The name of the domain that should used + /// for placement as per this policy. + public ServicePlacementPreferPrimaryDomainPolicy(string domainName) + { + DomainName = domainName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the domain that should used for placement + /// as per this policy. + /// + [JsonProperty(PropertyName = "domainName")] + public string DomainName { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (DomainName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DomainName"); + } + } + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServicePlacementRequireDomainDistributionPolicy.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServicePlacementRequireDomainDistributionPolicy.cs new file mode 100644 index 0000000000000..fad2f5350d65c --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServicePlacementRequireDomainDistributionPolicy.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.ServiceFabricManagedClusters.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes the policy to be used for placement of a Service Fabric + /// service where two replicas + /// from the same partition should never be placed in the same fault or + /// upgrade domain. + /// + /// While this is not common it can expose the service to an increased risk + /// of concurrent failures + /// due to unplanned outages or other cases of subsequent/concurrent + /// failures. As an example, consider + /// a case where replicas are deployed across different data center, with + /// one replica per location. + /// In the event that one of the datacenters goes offline, normally the + /// replica that was placed in that + /// datacenter will be packed into one of the remaining datacenters. If + /// this is not desirable then this + /// policy should be set. + /// + /// + [Newtonsoft.Json.JsonObject("RequiredDomainDistribution")] + public partial class ServicePlacementRequireDomainDistributionPolicy : ServicePlacementPolicy + { + /// + /// Initializes a new instance of the + /// ServicePlacementRequireDomainDistributionPolicy class. + /// + public ServicePlacementRequireDomainDistributionPolicy() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ServicePlacementRequireDomainDistributionPolicy class. + /// + /// The name of the domain that should used + /// for placement as per this policy. + public ServicePlacementRequireDomainDistributionPolicy(string domainName) + { + DomainName = domainName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the domain that should used for placement + /// as per this policy. + /// + [JsonProperty(PropertyName = "domainName")] + public string DomainName { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (DomainName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DomainName"); + } + } + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServicePlacementRequiredDomainPolicy.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServicePlacementRequiredDomainPolicy.cs new file mode 100644 index 0000000000000..aa03a44298122 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServicePlacementRequiredDomainPolicy.cs @@ -0,0 +1,72 @@ +// +// 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.ServiceFabricManagedClusters.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes the policy to be used for placement of a Service Fabric + /// service where the instances or replicas of that service must be placed + /// in a particular domain. + /// + [Newtonsoft.Json.JsonObject("RequiredDomain")] + public partial class ServicePlacementRequiredDomainPolicy : ServicePlacementPolicy + { + /// + /// Initializes a new instance of the + /// ServicePlacementRequiredDomainPolicy class. + /// + public ServicePlacementRequiredDomainPolicy() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ServicePlacementRequiredDomainPolicy class. + /// + /// The name of the domain that should used + /// for placement as per this policy. + public ServicePlacementRequiredDomainPolicy(string domainName) + { + DomainName = domainName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the domain that should used for placement + /// as per this policy. + /// + [JsonProperty(PropertyName = "domainName")] + public string DomainName { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (DomainName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DomainName"); + } + } + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServiceResource.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServiceResource.cs new file mode 100644 index 0000000000000..dd36e206579af --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServiceResource.cs @@ -0,0 +1,199 @@ +// +// 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.ServiceFabricManagedClusters.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The service resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class ServiceResource : ProxyResource + { + /// + /// Initializes a new instance of the ServiceResource class. + /// + public ServiceResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ServiceResource class. + /// + /// The name of the service type + /// Azure resource identifier. + /// Azure resource name. + /// Azure resource type. + /// Resource location depends on the parent + /// resource. + /// Azure resource tags. + /// The placement constraints as a + /// string. Placement constraints are boolean expressions on node + /// properties and allow for restricting a service to particular nodes + /// based on the service requirements. For example, to place a service + /// on nodes where NodeType is blue specify the following: "NodeColor + /// == blue)". + /// Possible values include: 'Zero', + /// 'Low', 'Medium', 'High' + /// The current deployment or + /// provisioning state, which only appears in the response + /// The activation Mode of + /// the service package. Possible values include: 'SharedProcess', + /// 'ExclusiveProcess' + /// The DNS name of the service. It + /// requires the DNS system service to be enabled in Service Fabric + /// cluster. + public ServiceResource(string serviceTypeName, Partition partitionDescription, string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), SystemData systemData = default(SystemData), string placementConstraints = default(string), IList correlationScheme = default(IList), IList serviceLoadMetrics = default(IList), IList servicePlacementPolicies = default(IList), string defaultMoveCost = default(string), IList scalingPolicies = default(IList), string provisioningState = default(string), string servicePackageActivationMode = default(string), string serviceDnsName = default(string)) + : base(id, name, type, location, tags, systemData) + { + PlacementConstraints = placementConstraints; + CorrelationScheme = correlationScheme; + ServiceLoadMetrics = serviceLoadMetrics; + ServicePlacementPolicies = servicePlacementPolicies; + DefaultMoveCost = defaultMoveCost; + ScalingPolicies = scalingPolicies; + ProvisioningState = provisioningState; + ServiceTypeName = serviceTypeName; + PartitionDescription = partitionDescription; + ServicePackageActivationMode = servicePackageActivationMode; + ServiceDnsName = serviceDnsName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the placement constraints as a string. Placement + /// constraints are boolean expressions on node properties and allow + /// for restricting a service to particular nodes based on the service + /// requirements. For example, to place a service on nodes where + /// NodeType is blue specify the following: "NodeColor == blue)". + /// + [JsonProperty(PropertyName = "properties.placementConstraints")] + public string PlacementConstraints { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.correlationScheme")] + public IList CorrelationScheme { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.serviceLoadMetrics")] + public IList ServiceLoadMetrics { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.servicePlacementPolicies")] + public IList ServicePlacementPolicies { get; set; } + + /// + /// Gets or sets possible values include: 'Zero', 'Low', 'Medium', + /// 'High' + /// + [JsonProperty(PropertyName = "properties.defaultMoveCost")] + public string DefaultMoveCost { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.scalingPolicies")] + public IList ScalingPolicies { get; set; } + + /// + /// Gets the current deployment or provisioning state, which only + /// appears in the response + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets the name of the service type + /// + [JsonProperty(PropertyName = "properties.serviceTypeName")] + public string ServiceTypeName { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.partitionDescription")] + public Partition PartitionDescription { get; set; } + + /// + /// Gets or sets the activation Mode of the service package. Possible + /// values include: 'SharedProcess', 'ExclusiveProcess' + /// + [JsonProperty(PropertyName = "properties.servicePackageActivationMode")] + public string ServicePackageActivationMode { get; set; } + + /// + /// Gets or sets the DNS name of the service. It requires the DNS + /// system service to be enabled in Service Fabric cluster. + /// + [JsonProperty(PropertyName = "properties.serviceDnsName")] + public string ServiceDnsName { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ServiceTypeName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ServiceTypeName"); + } + if (PartitionDescription == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "PartitionDescription"); + } + if (CorrelationScheme != null) + { + foreach (var element in CorrelationScheme) + { + if (element != null) + { + element.Validate(); + } + } + } + if (ServiceLoadMetrics != null) + { + foreach (var element1 in ServiceLoadMetrics) + { + if (element1 != null) + { + element1.Validate(); + } + } + } + if (ScalingPolicies != null) + { + foreach (var element2 in ScalingPolicies) + { + if (element2 != null) + { + element2.Validate(); + } + } + } + } + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServiceResourceProperties.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServiceResourceProperties.cs new file mode 100644 index 0000000000000..ac96e50780103 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServiceResourceProperties.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.ServiceFabricManagedClusters.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The service resource properties. + /// + public partial class ServiceResourceProperties : ServiceResourcePropertiesBase + { + /// + /// Initializes a new instance of the ServiceResourceProperties class. + /// + public ServiceResourceProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ServiceResourceProperties class. + /// + /// The name of the service type + /// The placement constraints as a + /// string. Placement constraints are boolean expressions on node + /// properties and allow for restricting a service to particular nodes + /// based on the service requirements. For example, to place a service + /// on nodes where NodeType is blue specify the following: "NodeColor + /// == blue)". + /// Possible values include: 'Zero', + /// 'Low', 'Medium', 'High' + /// The current deployment or + /// provisioning state, which only appears in the response + /// The activation Mode of + /// the service package. Possible values include: 'SharedProcess', + /// 'ExclusiveProcess' + /// The DNS name of the service. It + /// requires the DNS system service to be enabled in Service Fabric + /// cluster. + public ServiceResourceProperties(string serviceTypeName, Partition partitionDescription, string placementConstraints = default(string), IList correlationScheme = default(IList), IList serviceLoadMetrics = default(IList), IList servicePlacementPolicies = default(IList), string defaultMoveCost = default(string), IList scalingPolicies = default(IList), string provisioningState = default(string), string servicePackageActivationMode = default(string), string serviceDnsName = default(string)) + : base(placementConstraints, correlationScheme, serviceLoadMetrics, servicePlacementPolicies, defaultMoveCost, scalingPolicies) + { + ProvisioningState = provisioningState; + ServiceTypeName = serviceTypeName; + PartitionDescription = partitionDescription; + ServicePackageActivationMode = servicePackageActivationMode; + ServiceDnsName = serviceDnsName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the current deployment or provisioning state, which only + /// appears in the response + /// + [JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets the name of the service type + /// + [JsonProperty(PropertyName = "serviceTypeName")] + public string ServiceTypeName { get; set; } + + /// + /// + [JsonProperty(PropertyName = "partitionDescription")] + public Partition PartitionDescription { get; set; } + + /// + /// Gets or sets the activation Mode of the service package. Possible + /// values include: 'SharedProcess', 'ExclusiveProcess' + /// + [JsonProperty(PropertyName = "servicePackageActivationMode")] + public string ServicePackageActivationMode { get; set; } + + /// + /// Gets or sets the DNS name of the service. It requires the DNS + /// system service to be enabled in Service Fabric cluster. + /// + [JsonProperty(PropertyName = "serviceDnsName")] + public string ServiceDnsName { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ServiceTypeName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ServiceTypeName"); + } + if (PartitionDescription == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "PartitionDescription"); + } + } + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServiceResourcePropertiesBase.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServiceResourcePropertiesBase.cs new file mode 100644 index 0000000000000..d73a1dcbe2c80 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServiceResourcePropertiesBase.cs @@ -0,0 +1,98 @@ +// +// 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.ServiceFabricManagedClusters.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The common service resource properties. + /// + public partial class ServiceResourcePropertiesBase + { + /// + /// Initializes a new instance of the ServiceResourcePropertiesBase + /// class. + /// + public ServiceResourcePropertiesBase() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ServiceResourcePropertiesBase + /// class. + /// + /// The placement constraints as a + /// string. Placement constraints are boolean expressions on node + /// properties and allow for restricting a service to particular nodes + /// based on the service requirements. For example, to place a service + /// on nodes where NodeType is blue specify the following: "NodeColor + /// == blue)". + /// Possible values include: 'Zero', + /// 'Low', 'Medium', 'High' + public ServiceResourcePropertiesBase(string placementConstraints = default(string), IList correlationScheme = default(IList), IList serviceLoadMetrics = default(IList), IList servicePlacementPolicies = default(IList), string defaultMoveCost = default(string), IList scalingPolicies = default(IList)) + { + PlacementConstraints = placementConstraints; + CorrelationScheme = correlationScheme; + ServiceLoadMetrics = serviceLoadMetrics; + ServicePlacementPolicies = servicePlacementPolicies; + DefaultMoveCost = defaultMoveCost; + ScalingPolicies = scalingPolicies; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the placement constraints as a string. Placement + /// constraints are boolean expressions on node properties and allow + /// for restricting a service to particular nodes based on the service + /// requirements. For example, to place a service on nodes where + /// NodeType is blue specify the following: "NodeColor == blue)". + /// + [JsonProperty(PropertyName = "placementConstraints")] + public string PlacementConstraints { get; set; } + + /// + /// + [JsonProperty(PropertyName = "correlationScheme")] + public IList CorrelationScheme { get; set; } + + /// + /// + [JsonProperty(PropertyName = "serviceLoadMetrics")] + public IList ServiceLoadMetrics { get; set; } + + /// + /// + [JsonProperty(PropertyName = "servicePlacementPolicies")] + public IList ServicePlacementPolicies { get; set; } + + /// + /// Gets or sets possible values include: 'Zero', 'Low', 'Medium', + /// 'High' + /// + [JsonProperty(PropertyName = "defaultMoveCost")] + public string DefaultMoveCost { get; set; } + + /// + /// + [JsonProperty(PropertyName = "scalingPolicies")] + public IList ScalingPolicies { get; set; } + + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServiceScalingMechanismKind.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServiceScalingMechanismKind.cs new file mode 100644 index 0000000000000..d9c5899b9114e --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServiceScalingMechanismKind.cs @@ -0,0 +1,30 @@ +// +// 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.ServiceFabricManagedClusters.Models +{ + + /// + /// Defines values for ServiceScalingMechanismKind. + /// + public static class ServiceScalingMechanismKind + { + /// + /// Represents a scaling mechanism for adding or removing instances of + /// stateless service partition. The value is 0. + /// + public const string ScalePartitionInstanceCount = "ScalePartitionInstanceCount"; + /// + /// Represents a scaling mechanism for adding or removing named + /// partitions of a stateless service. The value is 1. + /// + public const string AddRemoveIncrementalNamedPartition = "AddRemoveIncrementalNamedPartition"; + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServiceScalingTriggerKind.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServiceScalingTriggerKind.cs new file mode 100644 index 0000000000000..800a5309ca806 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServiceScalingTriggerKind.cs @@ -0,0 +1,30 @@ +// +// 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.ServiceFabricManagedClusters.Models +{ + + /// + /// Defines values for ServiceScalingTriggerKind. + /// + public static class ServiceScalingTriggerKind + { + /// + /// Represents a scaling trigger related to an average load of a + /// metric/resource of a partition. The value is 0. + /// + public const string AveragePartitionLoad = "AveragePartitionLoad"; + /// + /// Represents a scaling policy related to an average load of a + /// metric/resource of a service. The value is 1. + /// + public const string AverageServiceLoad = "AverageServiceLoad"; + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServiceTypeHealthPolicy.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServiceTypeHealthPolicy.cs new file mode 100644 index 0000000000000..b7af70f52ce94 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServiceTypeHealthPolicy.cs @@ -0,0 +1,176 @@ +// +// 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.ServiceFabricManagedClusters.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents the health policy used to evaluate the health of services + /// belonging to a service type. + /// + /// + public partial class ServiceTypeHealthPolicy + { + /// + /// Initializes a new instance of the ServiceTypeHealthPolicy class. + /// + public ServiceTypeHealthPolicy() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ServiceTypeHealthPolicy class. + /// + /// The maximum allowed + /// percentage of unhealthy services. + /// + /// The percentage represents the maximum tolerated percentage of + /// services that can be unhealthy before the application is considered + /// in error. + /// If the percentage is respected but there is at least one unhealthy + /// service, the health is evaluated as Warning. + /// This is calculated by dividing the number of unhealthy services of + /// the specific service type over the total number of services of the + /// specific service type. + /// The computation rounds up to tolerate one failure on small numbers + /// of services. + /// + /// The maximum + /// allowed percentage of unhealthy partitions per service. + /// + /// The percentage represents the maximum tolerated percentage of + /// partitions that can be unhealthy before the service is considered + /// in error. + /// If the percentage is respected but there is at least one unhealthy + /// partition, the health is evaluated as Warning. + /// The percentage is calculated by dividing the number of unhealthy + /// partitions over the total number of partitions in the service. + /// The computation rounds up to tolerate one failure on small numbers + /// of partitions. + /// + /// The maximum + /// allowed percentage of unhealthy replicas per partition. + /// + /// The percentage represents the maximum tolerated percentage of + /// replicas that can be unhealthy before the partition is considered + /// in error. + /// If the percentage is respected but there is at least one unhealthy + /// replica, the health is evaluated as Warning. + /// The percentage is calculated by dividing the number of unhealthy + /// replicas over the total number of replicas in the partition. + /// The computation rounds up to tolerate one failure on small numbers + /// of replicas. + /// + public ServiceTypeHealthPolicy(int maxPercentUnhealthyServices, int maxPercentUnhealthyPartitionsPerService, int maxPercentUnhealthyReplicasPerPartition) + { + MaxPercentUnhealthyServices = maxPercentUnhealthyServices; + MaxPercentUnhealthyPartitionsPerService = maxPercentUnhealthyPartitionsPerService; + MaxPercentUnhealthyReplicasPerPartition = maxPercentUnhealthyReplicasPerPartition; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the maximum allowed percentage of unhealthy services. + /// + /// The percentage represents the maximum tolerated percentage of + /// services that can be unhealthy before the application is considered + /// in error. + /// If the percentage is respected but there is at least one unhealthy + /// service, the health is evaluated as Warning. + /// This is calculated by dividing the number of unhealthy services of + /// the specific service type over the total number of services of the + /// specific service type. + /// The computation rounds up to tolerate one failure on small numbers + /// of services. + /// + /// + [JsonProperty(PropertyName = "maxPercentUnhealthyServices")] + public int MaxPercentUnhealthyServices { get; set; } + + /// + /// Gets or sets the maximum allowed percentage of unhealthy partitions + /// per service. + /// + /// The percentage represents the maximum tolerated percentage of + /// partitions that can be unhealthy before the service is considered + /// in error. + /// If the percentage is respected but there is at least one unhealthy + /// partition, the health is evaluated as Warning. + /// The percentage is calculated by dividing the number of unhealthy + /// partitions over the total number of partitions in the service. + /// The computation rounds up to tolerate one failure on small numbers + /// of partitions. + /// + /// + [JsonProperty(PropertyName = "maxPercentUnhealthyPartitionsPerService")] + public int MaxPercentUnhealthyPartitionsPerService { get; set; } + + /// + /// Gets or sets the maximum allowed percentage of unhealthy replicas + /// per partition. + /// + /// The percentage represents the maximum tolerated percentage of + /// replicas that can be unhealthy before the partition is considered + /// in error. + /// If the percentage is respected but there is at least one unhealthy + /// replica, the health is evaluated as Warning. + /// The percentage is calculated by dividing the number of unhealthy + /// replicas over the total number of replicas in the partition. + /// The computation rounds up to tolerate one failure on small numbers + /// of replicas. + /// + /// + [JsonProperty(PropertyName = "maxPercentUnhealthyReplicasPerPartition")] + public int MaxPercentUnhealthyReplicasPerPartition { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (MaxPercentUnhealthyServices > 100) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "MaxPercentUnhealthyServices", 100); + } + if (MaxPercentUnhealthyServices < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "MaxPercentUnhealthyServices", 0); + } + if (MaxPercentUnhealthyPartitionsPerService > 100) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "MaxPercentUnhealthyPartitionsPerService", 100); + } + if (MaxPercentUnhealthyPartitionsPerService < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "MaxPercentUnhealthyPartitionsPerService", 0); + } + if (MaxPercentUnhealthyReplicasPerPartition > 100) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "MaxPercentUnhealthyReplicasPerPartition", 100); + } + if (MaxPercentUnhealthyReplicasPerPartition < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "MaxPercentUnhealthyReplicasPerPartition", 0); + } + } + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServiceUpdateParameters.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServiceUpdateParameters.cs new file mode 100644 index 0000000000000..b4309332cb328 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/ServiceUpdateParameters.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.ServiceFabricManagedClusters.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Service update request + /// + public partial class ServiceUpdateParameters + { + /// + /// Initializes a new instance of the ServiceUpdateParameters class. + /// + public ServiceUpdateParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ServiceUpdateParameters class. + /// + /// Service update parameters + public ServiceUpdateParameters(IDictionary tags = default(IDictionary)) + { + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets service update parameters + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/SettingsParameterDescription.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/SettingsParameterDescription.cs new file mode 100644 index 0000000000000..0b98dbc4ae258 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/SettingsParameterDescription.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.ServiceFabricManagedClusters.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes a parameter in fabric settings of the cluster. + /// + public partial class SettingsParameterDescription + { + /// + /// Initializes a new instance of the SettingsParameterDescription + /// class. + /// + public SettingsParameterDescription() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SettingsParameterDescription + /// class. + /// + /// The parameter name of fabric setting. + /// The parameter value of fabric setting. + public SettingsParameterDescription(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 parameter name of fabric setting. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the parameter value of fabric setting. + /// + [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/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/SettingsSectionDescription.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/SettingsSectionDescription.cs new file mode 100644 index 0000000000000..2f672b3a3153c --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/SettingsSectionDescription.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.ServiceFabricManagedClusters.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a section in the fabric settings of the cluster. + /// + public partial class SettingsSectionDescription + { + /// + /// Initializes a new instance of the SettingsSectionDescription class. + /// + public SettingsSectionDescription() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SettingsSectionDescription class. + /// + /// The section name of the fabric settings. + /// The collection of parameters in the + /// section. + public SettingsSectionDescription(string name, IList parameters) + { + Name = name; + Parameters = parameters; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the section name of the fabric settings. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the collection of parameters in the section. + /// + [JsonProperty(PropertyName = "parameters")] + public IList Parameters { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (Parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Parameters"); + } + if (Parameters != null) + { + foreach (var element in Parameters) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/SingletonPartitionScheme.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/SingletonPartitionScheme.cs new file mode 100644 index 0000000000000..d75b3dfc38178 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/SingletonPartitionScheme.cs @@ -0,0 +1,38 @@ +// +// 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.ServiceFabricManagedClusters.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes the partition scheme of a singleton-partitioned, or + /// non-partitioned service. + /// + [Newtonsoft.Json.JsonObject("Singleton")] + public partial class SingletonPartitionScheme : Partition + { + /// + /// Initializes a new instance of the SingletonPartitionScheme class. + /// + public SingletonPartitionScheme() + { + CustomInit(); + } + + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/Sku.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/Sku.cs new file mode 100644 index 0000000000000..687293c8b7502 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/Sku.cs @@ -0,0 +1,66 @@ +// +// 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.ServiceFabricManagedClusters.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Service Fabric managed cluster Sku definition + /// + public partial class Sku + { + /// + /// Initializes a new instance of the Sku class. + /// + public Sku() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Sku class. + /// + /// Sku Name. Possible values include: 'Basic', + /// 'Standard' + public Sku(string name) + { + Name = name; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets sku Name. Possible values include: 'Basic', 'Standard' + /// + [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/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/StatefulServiceProperties.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/StatefulServiceProperties.cs new file mode 100644 index 0000000000000..8f276f706c0d8 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/StatefulServiceProperties.cs @@ -0,0 +1,177 @@ +// +// 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.ServiceFabricManagedClusters.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The properties of a stateful service resource. + /// + [Newtonsoft.Json.JsonObject("Stateful")] + public partial class StatefulServiceProperties : ServiceResourceProperties + { + /// + /// Initializes a new instance of the StatefulServiceProperties class. + /// + public StatefulServiceProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the StatefulServiceProperties class. + /// + /// The name of the service type + /// The placement constraints as a + /// string. Placement constraints are boolean expressions on node + /// properties and allow for restricting a service to particular nodes + /// based on the service requirements. For example, to place a service + /// on nodes where NodeType is blue specify the following: "NodeColor + /// == blue)". + /// Possible values include: 'Zero', + /// 'Low', 'Medium', 'High' + /// The current deployment or + /// provisioning state, which only appears in the response + /// The activation Mode of + /// the service package. Possible values include: 'SharedProcess', + /// 'ExclusiveProcess' + /// The DNS name of the service. It + /// requires the DNS system service to be enabled in Service Fabric + /// cluster. + /// A flag indicating whether this is a + /// persistent service which stores states on the local disk. If it is + /// then the value of this property is true, if not it is + /// false. + /// The target replica set size as a + /// number. + /// The minimum replica set size as a + /// number. + /// The duration between when + /// a replica goes down and when a new replica is created, represented + /// in ISO 8601 format "hh:mm:ss". + /// The maximum duration for which + /// a partition is allowed to be in a state of quorum loss, represented + /// in ISO 8601 format "hh:mm:ss". + /// The definition on how long + /// StandBy replicas should be maintained before being removed, + /// represented in ISO 8601 format "hh:mm:ss". + /// The duration for which + /// replicas can stay InBuild before reporting that build is stuck, + /// represented in ISO 8601 format "hh:mm:ss". + /// Indicates whether to drop + /// source Secondary replica even if the target replica has not + /// finished build. If desired behavior is to drop it as soon as + /// possible the value of this property is true, if not it is + /// false. + public StatefulServiceProperties(string serviceTypeName, Partition partitionDescription, string placementConstraints = default(string), IList correlationScheme = default(IList), IList serviceLoadMetrics = default(IList), IList servicePlacementPolicies = default(IList), string defaultMoveCost = default(string), IList scalingPolicies = default(IList), string provisioningState = default(string), string servicePackageActivationMode = default(string), string serviceDnsName = default(string), bool? hasPersistedState = default(bool?), int? targetReplicaSetSize = default(int?), int? minReplicaSetSize = default(int?), string replicaRestartWaitDuration = default(string), string quorumLossWaitDuration = default(string), string standByReplicaKeepDuration = default(string), string servicePlacementTimeLimit = default(string), bool? dropSourceReplicaOnMove = default(bool?)) + : base(serviceTypeName, partitionDescription, placementConstraints, correlationScheme, serviceLoadMetrics, servicePlacementPolicies, defaultMoveCost, scalingPolicies, provisioningState, servicePackageActivationMode, serviceDnsName) + { + HasPersistedState = hasPersistedState; + TargetReplicaSetSize = targetReplicaSetSize; + MinReplicaSetSize = minReplicaSetSize; + ReplicaRestartWaitDuration = replicaRestartWaitDuration; + QuorumLossWaitDuration = quorumLossWaitDuration; + StandByReplicaKeepDuration = standByReplicaKeepDuration; + ServicePlacementTimeLimit = servicePlacementTimeLimit; + DropSourceReplicaOnMove = dropSourceReplicaOnMove; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets a flag indicating whether this is a persistent service + /// which stores states on the local disk. If it is then the value of + /// this property is true, if not it is false. + /// + [JsonProperty(PropertyName = "hasPersistedState")] + public bool? HasPersistedState { get; set; } + + /// + /// Gets or sets the target replica set size as a number. + /// + [JsonProperty(PropertyName = "targetReplicaSetSize")] + public int? TargetReplicaSetSize { get; set; } + + /// + /// Gets or sets the minimum replica set size as a number. + /// + [JsonProperty(PropertyName = "minReplicaSetSize")] + public int? MinReplicaSetSize { get; set; } + + /// + /// Gets or sets the duration between when a replica goes down and when + /// a new replica is created, represented in ISO 8601 format + /// "hh:mm:ss". + /// + [JsonProperty(PropertyName = "replicaRestartWaitDuration")] + public string ReplicaRestartWaitDuration { get; set; } + + /// + /// Gets or sets the maximum duration for which a partition is allowed + /// to be in a state of quorum loss, represented in ISO 8601 format + /// "hh:mm:ss". + /// + [JsonProperty(PropertyName = "quorumLossWaitDuration")] + public string QuorumLossWaitDuration { get; set; } + + /// + /// Gets or sets the definition on how long StandBy replicas should be + /// maintained before being removed, represented in ISO 8601 format + /// "hh:mm:ss". + /// + [JsonProperty(PropertyName = "standByReplicaKeepDuration")] + public string StandByReplicaKeepDuration { get; set; } + + /// + /// Gets or sets the duration for which replicas can stay InBuild + /// before reporting that build is stuck, represented in ISO 8601 + /// format "hh:mm:ss". + /// + [JsonProperty(PropertyName = "servicePlacementTimeLimit")] + public string ServicePlacementTimeLimit { get; set; } + + /// + /// Gets or sets indicates whether to drop source Secondary replica + /// even if the target replica has not finished build. If desired + /// behavior is to drop it as soon as possible the value of this + /// property is true, if not it is false. + /// + [JsonProperty(PropertyName = "dropSourceReplicaOnMove")] + public bool? DropSourceReplicaOnMove { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (TargetReplicaSetSize < 1) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "TargetReplicaSetSize", 1); + } + if (MinReplicaSetSize < 1) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "MinReplicaSetSize", 1); + } + } + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/StatelessServiceProperties.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/StatelessServiceProperties.cs new file mode 100644 index 0000000000000..00b3e79493805 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/StatelessServiceProperties.cs @@ -0,0 +1,172 @@ +// +// 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.ServiceFabricManagedClusters.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The properties of a stateless service resource. + /// + [Newtonsoft.Json.JsonObject("Stateless")] + public partial class StatelessServiceProperties : ServiceResourceProperties + { + /// + /// Initializes a new instance of the StatelessServiceProperties class. + /// + public StatelessServiceProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the StatelessServiceProperties class. + /// + /// The name of the service type + /// The instance count. + /// The placement constraints as a + /// string. Placement constraints are boolean expressions on node + /// properties and allow for restricting a service to particular nodes + /// based on the service requirements. For example, to place a service + /// on nodes where NodeType is blue specify the following: "NodeColor + /// == blue)". + /// Possible values include: 'Zero', + /// 'Low', 'Medium', 'High' + /// The current deployment or + /// provisioning state, which only appears in the response + /// The activation Mode of + /// the service package. Possible values include: 'SharedProcess', + /// 'ExclusiveProcess' + /// The DNS name of the service. It + /// requires the DNS system service to be enabled in Service Fabric + /// cluster. + /// MinInstanceCount is the minimum + /// number of instances that must be up to meet the EnsureAvailability + /// safety check during operations like upgrade or deactivate node. The + /// actual number that is used is max( MinInstanceCount, ceil( + /// MinInstancePercentage/100.0 * InstanceCount) ). Note, if + /// InstanceCount is set to -1, during MinInstanceCount computation -1 + /// is first converted into the number of nodes on which the instances + /// are allowed to be placed according to the placement constraints on + /// the service. + /// MinInstancePercentage is the + /// minimum percentage of InstanceCount that must be up to meet the + /// EnsureAvailability safety check during operations like upgrade or + /// deactivate node. The actual number that is used is max( + /// MinInstanceCount, ceil( MinInstancePercentage/100.0 * + /// InstanceCount) ). Note, if InstanceCount is set to -1, during + /// MinInstancePercentage computation, -1 is first converted into the + /// number of nodes on which the instances are allowed to be placed + /// according to the placement constraints on the service. + /// Duration represented in + /// ISO 8601 format "hh:mm:ss", to wait before a stateless instance is + /// closed, to allow the active requests to drain gracefully. This + /// would be effective when the instance is closing during the + /// application/cluster upgrade and disabling node. The endpoint + /// exposed on this instance is removed prior to starting the delay, + /// which prevents new connections to this instance. In addition, + /// clients that have subscribed to service endpoint change + /// events(https://docs.microsoft.com/dotnet/api/system.fabric.fabricclient.servicemanagementclient.registerservicenotificationfilterasync), + /// can do the following upon receiving the endpoint removal + /// notification: - Stop sending new requests to this instance. - Close + /// existing connections after in-flight requests have completed. - + /// Connect to a different instance of the service partition for future + /// requests. Note, the default value of InstanceCloseDelayDuration is + /// 0, which indicates that there won't be any delay or removal of the + /// endpoint prior to closing the instance. + public StatelessServiceProperties(string serviceTypeName, Partition partitionDescription, int instanceCount, string placementConstraints = default(string), IList correlationScheme = default(IList), IList serviceLoadMetrics = default(IList), IList servicePlacementPolicies = default(IList), string defaultMoveCost = default(string), IList scalingPolicies = default(IList), string provisioningState = default(string), string servicePackageActivationMode = default(string), string serviceDnsName = default(string), int? minInstanceCount = default(int?), int? minInstancePercentage = default(int?), string instanceCloseDelayDuration = default(string)) + : base(serviceTypeName, partitionDescription, placementConstraints, correlationScheme, serviceLoadMetrics, servicePlacementPolicies, defaultMoveCost, scalingPolicies, provisioningState, servicePackageActivationMode, serviceDnsName) + { + InstanceCount = instanceCount; + MinInstanceCount = minInstanceCount; + MinInstancePercentage = minInstancePercentage; + InstanceCloseDelayDuration = instanceCloseDelayDuration; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the instance count. + /// + [JsonProperty(PropertyName = "instanceCount")] + public int InstanceCount { get; set; } + + /// + /// Gets or sets minInstanceCount is the minimum number of instances + /// that must be up to meet the EnsureAvailability safety check during + /// operations like upgrade or deactivate node. The actual number that + /// is used is max( MinInstanceCount, ceil( MinInstancePercentage/100.0 + /// * InstanceCount) ). Note, if InstanceCount is set to -1, during + /// MinInstanceCount computation -1 is first converted into the number + /// of nodes on which the instances are allowed to be placed according + /// to the placement constraints on the service. + /// + [JsonProperty(PropertyName = "minInstanceCount")] + public int? MinInstanceCount { get; set; } + + /// + /// Gets or sets minInstancePercentage is the minimum percentage of + /// InstanceCount that must be up to meet the EnsureAvailability safety + /// check during operations like upgrade or deactivate node. The actual + /// number that is used is max( MinInstanceCount, ceil( + /// MinInstancePercentage/100.0 * InstanceCount) ). Note, if + /// InstanceCount is set to -1, during MinInstancePercentage + /// computation, -1 is first converted into the number of nodes on + /// which the instances are allowed to be placed according to the + /// placement constraints on the service. + /// + [JsonProperty(PropertyName = "minInstancePercentage")] + public int? MinInstancePercentage { get; set; } + + /// + /// Gets or sets duration represented in ISO 8601 format "hh:mm:ss", to + /// wait before a stateless instance is closed, to allow the active + /// requests to drain gracefully. This would be effective when the + /// instance is closing during the application/cluster upgrade and + /// disabling node. The endpoint exposed on this instance is removed + /// prior to starting the delay, which prevents new connections to this + /// instance. In addition, clients that have subscribed to service + /// endpoint change + /// events(https://docs.microsoft.com/dotnet/api/system.fabric.fabricclient.servicemanagementclient.registerservicenotificationfilterasync), + /// can do the following upon receiving the endpoint removal + /// notification: - Stop sending new requests to this instance. - Close + /// existing connections after in-flight requests have completed. - + /// Connect to a different instance of the service partition for future + /// requests. Note, the default value of InstanceCloseDelayDuration is + /// 0, which indicates that there won't be any delay or removal of the + /// endpoint prior to closing the instance. + /// + [JsonProperty(PropertyName = "instanceCloseDelayDuration")] + public string InstanceCloseDelayDuration { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (InstanceCount < -1) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "InstanceCount", -1); + } + } + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/SubResource.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/SubResource.cs new file mode 100644 index 0000000000000..c72b8e33be1ef --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/SubResource.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.ServiceFabricManagedClusters.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Azure resource identifier. + /// + public partial class SubResource : IResource + { + /// + /// Initializes a new instance of the SubResource class. + /// + public SubResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SubResource class. + /// + /// Azure resource identifier. + public SubResource(string id = default(string)) + { + Id = id; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets azure resource identifier. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/SystemData.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/SystemData.cs new file mode 100644 index 0000000000000..99e91bb460f43 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/SystemData.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.ServiceFabricManagedClusters.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Metadata pertaining to creation and last modification of the resource. + /// + public partial class SystemData + { + /// + /// Initializes a new instance of the SystemData class. + /// + public SystemData() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SystemData class. + /// + /// The identity that created the + /// resource. + /// The type of identity that created the + /// resource. Possible values include: 'User', 'Application', + /// 'ManagedIdentity', 'Key' + /// The timestamp of resource creation + /// (UTC). + /// The identity that last modified the + /// resource. + /// The type of identity that last + /// modified the resource. Possible values include: 'User', + /// 'Application', 'ManagedIdentity', 'Key' + /// The timestamp of resource last + /// modification (UTC). + public SystemData(string createdBy = default(string), string createdByType = default(string), System.DateTime? createdAt = default(System.DateTime?), string lastModifiedBy = default(string), string lastModifiedByType = default(string), System.DateTime? lastModifiedAt = default(System.DateTime?)) + { + CreatedBy = createdBy; + CreatedByType = createdByType; + CreatedAt = createdAt; + LastModifiedBy = lastModifiedBy; + LastModifiedByType = lastModifiedByType; + LastModifiedAt = lastModifiedAt; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the identity that created the resource. + /// + [JsonProperty(PropertyName = "createdBy")] + public string CreatedBy { get; set; } + + /// + /// Gets or sets the type of identity that created the resource. + /// Possible values include: 'User', 'Application', 'ManagedIdentity', + /// 'Key' + /// + [JsonProperty(PropertyName = "createdByType")] + public string CreatedByType { get; set; } + + /// + /// Gets or sets the timestamp of resource creation (UTC). + /// + [JsonProperty(PropertyName = "createdAt")] + public System.DateTime? CreatedAt { get; set; } + + /// + /// Gets or sets the identity that last modified the resource. + /// + [JsonProperty(PropertyName = "lastModifiedBy")] + public string LastModifiedBy { get; set; } + + /// + /// Gets or sets the type of identity that last modified the resource. + /// Possible values include: 'User', 'Application', 'ManagedIdentity', + /// 'Key' + /// + [JsonProperty(PropertyName = "lastModifiedByType")] + public string LastModifiedByType { get; set; } + + /// + /// Gets or sets the timestamp of resource last modification (UTC). + /// + [JsonProperty(PropertyName = "lastModifiedAt")] + public System.DateTime? LastModifiedAt { get; set; } + + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/UniformInt64RangePartitionScheme.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/UniformInt64RangePartitionScheme.cs new file mode 100644 index 0000000000000..d29b20655e2ce --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/UniformInt64RangePartitionScheme.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.ServiceFabricManagedClusters.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes a partitioning scheme where an integer range is allocated + /// evenly across a number of partitions. + /// + [Newtonsoft.Json.JsonObject("UniformInt64Range")] + public partial class UniformInt64RangePartitionScheme : Partition + { + /// + /// Initializes a new instance of the UniformInt64RangePartitionScheme + /// class. + /// + public UniformInt64RangePartitionScheme() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UniformInt64RangePartitionScheme + /// class. + /// + /// The number of partitions. + /// The lower bound of the partition key range + /// that + /// should be split between the partition ‘Count’ + /// + /// The upper bound of the partition key range + /// that + /// should be split between the partition ‘Count’ + /// + public UniformInt64RangePartitionScheme(int count, long lowKey, long highKey) + { + Count = count; + LowKey = lowKey; + HighKey = highKey; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the number of partitions. + /// + [JsonProperty(PropertyName = "count")] + public int Count { get; set; } + + /// + /// Gets or sets the lower bound of the partition key range that + /// should be split between the partition ‘Count’ + /// + /// + [JsonProperty(PropertyName = "lowKey")] + public long LowKey { get; set; } + + /// + /// Gets or sets the upper bound of the partition key range that + /// should be split between the partition ‘Count’ + /// + /// + [JsonProperty(PropertyName = "highKey")] + public long HighKey { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + //Nothing to validate + } + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/UserAssignedIdentity.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/UserAssignedIdentity.cs new file mode 100644 index 0000000000000..a76e4ceeea7b9 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/UserAssignedIdentity.cs @@ -0,0 +1,58 @@ +// +// 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.ServiceFabricManagedClusters.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class UserAssignedIdentity + { + /// + /// Initializes a new instance of the UserAssignedIdentity class. + /// + public UserAssignedIdentity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UserAssignedIdentity class. + /// + /// The principal id of user assigned + /// identity. + /// The client id of user assigned + /// identity. + public UserAssignedIdentity(string principalId = default(string), string clientId = default(string)) + { + PrincipalId = principalId; + ClientId = clientId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the principal id of user assigned identity. + /// + [JsonProperty(PropertyName = "principalId")] + public string PrincipalId { get; private set; } + + /// + /// Gets the client id of user assigned identity. + /// + [JsonProperty(PropertyName = "clientId")] + public string ClientId { get; private set; } + + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/VMSSExtension.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/VMSSExtension.cs new file mode 100644 index 0000000000000..14463d41c1adc --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/VMSSExtension.cs @@ -0,0 +1,177 @@ +// +// 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.ServiceFabricManagedClusters.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Specifies set of extensions that should be installed onto the virtual + /// machines. + /// + [Rest.Serialization.JsonTransformation] + public partial class VMSSExtension + { + /// + /// Initializes a new instance of the VMSSExtension class. + /// + public VMSSExtension() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VMSSExtension class. + /// + /// The name of the extension. + /// The name of the extension handler + /// publisher. + /// Specifies the type of the extension; an example + /// is "CustomScriptExtension". + /// Specifies the version of the + /// script handler. + /// Indicates whether the + /// extension should use a newer minor version if one is available at + /// deployment time. Once deployed, however, the extension will not + /// upgrade minor versions unless redeployed, even with this property + /// set to true. + /// Json formatted public settings for the + /// extension. + /// The extension can contain either + /// protectedSettings or protectedSettingsFromKeyVault or no protected + /// settings at all. + /// If a value is provided and is + /// different from the previous value, the extension handler will be + /// forced to update even if the extension configuration has not + /// changed. + /// Collection of extension + /// names after which this extension needs to be provisioned. + /// The provisioning state, which only + /// appears in the response. + public VMSSExtension(string name, string publisher, string type, string typeHandlerVersion, bool? autoUpgradeMinorVersion = default(bool?), object settings = default(object), object protectedSettings = default(object), string forceUpdateTag = default(string), IList provisionAfterExtensions = default(IList), string provisioningState = default(string)) + { + Name = name; + Publisher = publisher; + Type = type; + TypeHandlerVersion = typeHandlerVersion; + AutoUpgradeMinorVersion = autoUpgradeMinorVersion; + Settings = settings; + ProtectedSettings = protectedSettings; + ForceUpdateTag = forceUpdateTag; + ProvisionAfterExtensions = provisionAfterExtensions; + ProvisioningState = provisioningState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the extension. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the name of the extension handler publisher. + /// + [JsonProperty(PropertyName = "properties.publisher")] + public string Publisher { get; set; } + + /// + /// Gets or sets specifies the type of the extension; an example is + /// "CustomScriptExtension". + /// + [JsonProperty(PropertyName = "properties.type")] + public string Type { get; set; } + + /// + /// Gets or sets specifies the version of the script handler. + /// + [JsonProperty(PropertyName = "properties.typeHandlerVersion")] + public string TypeHandlerVersion { get; set; } + + /// + /// Gets or sets indicates whether the extension should use a newer + /// minor version if one is available at deployment time. Once + /// deployed, however, the extension will not upgrade minor versions + /// unless redeployed, even with this property set to true. + /// + [JsonProperty(PropertyName = "properties.autoUpgradeMinorVersion")] + public bool? AutoUpgradeMinorVersion { get; set; } + + /// + /// Gets or sets json formatted public settings for the extension. + /// + [JsonProperty(PropertyName = "properties.settings")] + public object Settings { get; set; } + + /// + /// Gets or sets the extension can contain either protectedSettings or + /// protectedSettingsFromKeyVault or no protected settings at all. + /// + [JsonProperty(PropertyName = "properties.protectedSettings")] + public object ProtectedSettings { get; set; } + + /// + /// Gets or sets if a value is provided and is different from the + /// previous value, the extension handler will be forced to update even + /// if the extension configuration has not changed. + /// + [JsonProperty(PropertyName = "properties.forceUpdateTag")] + public string ForceUpdateTag { get; set; } + + /// + /// Gets or sets collection of extension names after which this + /// extension needs to be provisioned. + /// + [JsonProperty(PropertyName = "properties.provisionAfterExtensions")] + public IList ProvisionAfterExtensions { get; set; } + + /// + /// Gets the provisioning state, which only appears in the response. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (Publisher == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Publisher"); + } + if (Type == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Type"); + } + if (TypeHandlerVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "TypeHandlerVersion"); + } + } + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/VaultCertificate.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/VaultCertificate.cs new file mode 100644 index 0000000000000..bcddb294e7f04 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/VaultCertificate.cs @@ -0,0 +1,110 @@ +// +// 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.ServiceFabricManagedClusters.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes a single certificate reference in a Key Vault, and where the + /// certificate should reside on the VM. + /// + public partial class VaultCertificate + { + /// + /// Initializes a new instance of the VaultCertificate class. + /// + public VaultCertificate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VaultCertificate class. + /// + /// This is the URL of a certificate that + /// has been uploaded to Key Vault as a secret. For adding a secret to + /// the Key Vault, see [Add a key or secret to the key + /// vault](https://docs.microsoft.com/azure/key-vault/key-vault-get-started/#add). + /// In this case, your certificate needs to be It is the Base64 + /// encoding of the following JSON Object which is encoded in UTF-8: + /// <br><br> {<br> + /// "data":"<Base64-encoded-certificate>",<br> + /// "dataType":"pfx",<br> + /// "password":"<pfx-file-password>"<br>} + /// For Windows VMs, specifies the + /// certificate store on the Virtual Machine to which the certificate + /// should be added. The specified certificate store is implicitly in + /// the LocalMachine account. <br><br>For Linux VMs, the + /// certificate file is placed under the /var/lib/waagent directory, + /// with the file name <UppercaseThumbprint>.crt for the X509 + /// certificate file and <UppercaseThumbprint>.prv for private + /// key. Both of these files are .pem formatted. + public VaultCertificate(string certificateUrl, string certificateStore) + { + CertificateUrl = certificateUrl; + CertificateStore = certificateStore; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets this is the URL of a certificate that has been + /// uploaded to Key Vault as a secret. For adding a secret to the Key + /// Vault, see [Add a key or secret to the key + /// vault](https://docs.microsoft.com/azure/key-vault/key-vault-get-started/#add). + /// In this case, your certificate needs to be It is the Base64 + /// encoding of the following JSON Object which is encoded in UTF-8: + /// &lt;br&gt;&lt;br&gt; {&lt;br&gt; + /// "data":"&lt;Base64-encoded-certificate&gt;",&lt;br&gt; + /// "dataType":"pfx",&lt;br&gt; + /// "password":"&lt;pfx-file-password&gt;"&lt;br&gt;} + /// + [JsonProperty(PropertyName = "certificateUrl")] + public string CertificateUrl { get; set; } + + /// + /// Gets or sets for Windows VMs, specifies the certificate store on + /// the Virtual Machine to which the certificate should be added. The + /// specified certificate store is implicitly in the LocalMachine + /// account. &lt;br&gt;&lt;br&gt;For Linux VMs, the + /// certificate file is placed under the /var/lib/waagent directory, + /// with the file name &lt;UppercaseThumbprint&gt;.crt for the + /// X509 certificate file and &lt;UppercaseThumbprint&gt;.prv + /// for private key. Both of these files are .pem formatted. + /// + [JsonProperty(PropertyName = "certificateStore")] + public string CertificateStore { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (CertificateUrl == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "CertificateUrl"); + } + if (CertificateStore == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "CertificateStore"); + } + } + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/VaultSecretGroup.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/VaultSecretGroup.cs new file mode 100644 index 0000000000000..cf3c225b39d2c --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/VaultSecretGroup.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.ServiceFabricManagedClusters.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Specifies set of certificates that should be installed onto the virtual + /// machines. + /// + public partial class VaultSecretGroup + { + /// + /// Initializes a new instance of the VaultSecretGroup class. + /// + public VaultSecretGroup() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VaultSecretGroup class. + /// + /// The relative URL of the Key Vault + /// containing all of the certificates in VaultCertificates. + /// The list of key vault references in + /// SourceVault which contain certificates. + public VaultSecretGroup(SubResource sourceVault, IList vaultCertificates) + { + SourceVault = sourceVault; + VaultCertificates = vaultCertificates; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the relative URL of the Key Vault containing all of + /// the certificates in VaultCertificates. + /// + [JsonProperty(PropertyName = "sourceVault")] + public SubResource SourceVault { get; set; } + + /// + /// Gets or sets the list of key vault references in SourceVault which + /// contain certificates. + /// + [JsonProperty(PropertyName = "vaultCertificates")] + public IList VaultCertificates { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (SourceVault == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "SourceVault"); + } + if (VaultCertificates == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "VaultCertificates"); + } + if (VaultCertificates != null) + { + foreach (var element in VaultCertificates) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/VmManagedIdentity.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/VmManagedIdentity.cs new file mode 100644 index 0000000000000..1d876bb96e20b --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Models/VmManagedIdentity.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.ServiceFabricManagedClusters.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Identities for the virtual machine scale set under the node type. + /// + public partial class VmManagedIdentity + { + /// + /// Initializes a new instance of the VmManagedIdentity class. + /// + public VmManagedIdentity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VmManagedIdentity class. + /// + /// The list of user identities + /// associated with the virtual machine scale set under the node type. + /// Each entry will be an ARM resource ids in the form: + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + public VmManagedIdentity(IList userAssignedIdentities = default(IList)) + { + UserAssignedIdentities = userAssignedIdentities; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the list of user identities associated with the + /// virtual machine scale set under the node type. Each entry will be + /// an ARM resource ids in the form: + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + /// + [JsonProperty(PropertyName = "userAssignedIdentities")] + public IList UserAssignedIdentities { get; set; } + + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/NodeTypesOperations.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/NodeTypesOperations.cs new file mode 100644 index 0000000000000..77a7b53ad3f9f --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/NodeTypesOperations.cs @@ -0,0 +1,1988 @@ +// +// 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.ServiceFabricManagedClusters +{ + 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; + + /// + /// NodeTypesOperations operations. + /// + internal partial class NodeTypesOperations : IServiceOperations, INodeTypesOperations + { + /// + /// Initializes a new instance of the NodeTypesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal NodeTypesOperations(ServiceFabricManagedClustersManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ServiceFabricManagedClustersManagementClient + /// + public ServiceFabricManagedClustersManagementClient Client { get; private set; } + + /// + /// Gets the list of Node types of the specified managed cluster. + /// + /// + /// Gets all Node types of the specified managed cluster. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster 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>> ListByManagedClustersWithHttpMessagesAsync(string resourceGroupName, string clusterName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (clusterName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "clusterName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("clusterName", clusterName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByManagedClusters", 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.ServiceFabric/managedClusters/{clusterName}/nodeTypes").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{clusterName}", System.Uri.EscapeDataString(clusterName)); + 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; + } + + /// + /// Restarts one or more nodes on the node type. + /// + /// + /// Restarts one or more nodes on the node type. It will disable the fabric + /// nodes, trigger a restart on the VMs and activate the nodes back again. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the node type. + /// + /// + /// parameters for restart action. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task RestartWithHttpMessagesAsync(string resourceGroupName, string clusterName, string nodeTypeName, NodeTypeActionParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginRestartWithHttpMessagesAsync(resourceGroupName, clusterName, nodeTypeName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Reimages one or more nodes on the node type. + /// + /// + /// Reimages one or more nodes on the node type. It will disable the fabric + /// nodes, trigger a reimage on the VMs and activate the nodes back again. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the node type. + /// + /// + /// parameters for reimage action. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task ReimageWithHttpMessagesAsync(string resourceGroupName, string clusterName, string nodeTypeName, NodeTypeActionParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginReimageWithHttpMessagesAsync(resourceGroupName, clusterName, nodeTypeName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes one or more nodes on the node type. + /// + /// + /// Deletes one or more nodes on the node type. It will disable the fabric + /// nodes, trigger a delete on the VMs and removes the state from the cluster. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the node type. + /// + /// + /// parameters for delete action. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteNodeWithHttpMessagesAsync(string resourceGroupName, string clusterName, string nodeTypeName, NodeTypeActionParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteNodeWithHttpMessagesAsync(resourceGroupName, clusterName, nodeTypeName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a Service Fabric node type. + /// + /// + /// Get a Service Fabric node type of a given managed cluster. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the node type. + /// + /// + /// 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 clusterName, string nodeTypeName, 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 (clusterName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "clusterName"); + } + if (nodeTypeName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nodeTypeName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("clusterName", clusterName); + tracingParameters.Add("nodeTypeName", nodeTypeName); + 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.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{clusterName}", System.Uri.EscapeDataString(clusterName)); + _url = _url.Replace("{nodeTypeName}", System.Uri.EscapeDataString(nodeTypeName)); + 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; + } + + /// + /// Creates or updates a Service Fabric node type. + /// + /// + /// Create or update a Service Fabric node type of a given managed cluster. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the node type. + /// + /// + /// The node type resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string clusterName, string nodeTypeName, NodeType parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, clusterName, nodeTypeName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Update the tags of a node type resource of a given managed cluster. + /// + /// + /// Update the configuration of a node type of a given managed cluster, only + /// updating tags. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the node type. + /// + /// + /// Node type update parameters + /// + /// + /// 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string clusterName, string nodeTypeName, IDictionary tags = default(IDictionary), 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 (clusterName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "clusterName"); + } + if (nodeTypeName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nodeTypeName"); + } + NodeTypeUpdateParameters parameters = new NodeTypeUpdateParameters(); + if (tags != null) + { + parameters.Tags = tags; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("clusterName", clusterName); + tracingParameters.Add("nodeTypeName", nodeTypeName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", 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.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{clusterName}", System.Uri.EscapeDataString(clusterName)); + _url = _url.Replace("{nodeTypeName}", System.Uri.EscapeDataString(nodeTypeName)); + 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("PATCH"); + _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(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, 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) + { + 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 a Service Fabric node type. + /// + /// + /// Delete a Service Fabric node type of a given managed cluster. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the node type. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string clusterName, string nodeTypeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, clusterName, nodeTypeName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Restarts one or more nodes on the node type. + /// + /// + /// Restarts one or more nodes on the node type. It will disable the fabric + /// nodes, trigger a restart on the VMs and activate the nodes back again. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the node type. + /// + /// + /// parameters for restart action. + /// + /// + /// 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 BeginRestartWithHttpMessagesAsync(string resourceGroupName, string clusterName, string nodeTypeName, NodeTypeActionParameters parameters, 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 (clusterName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "clusterName"); + } + if (nodeTypeName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nodeTypeName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.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("clusterName", clusterName); + tracingParameters.Add("nodeTypeName", nodeTypeName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginRestart", 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.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}/restart").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{clusterName}", System.Uri.EscapeDataString(clusterName)); + _url = _url.Replace("{nodeTypeName}", System.Uri.EscapeDataString(nodeTypeName)); + 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; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, 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 != 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(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Reimages one or more nodes on the node type. + /// + /// + /// Reimages one or more nodes on the node type. It will disable the fabric + /// nodes, trigger a reimage on the VMs and activate the nodes back again. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the node type. + /// + /// + /// parameters for reimage action. + /// + /// + /// 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 BeginReimageWithHttpMessagesAsync(string resourceGroupName, string clusterName, string nodeTypeName, NodeTypeActionParameters parameters, 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 (clusterName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "clusterName"); + } + if (nodeTypeName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nodeTypeName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.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("clusterName", clusterName); + tracingParameters.Add("nodeTypeName", nodeTypeName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginReimage", 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.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}/reimage").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{clusterName}", System.Uri.EscapeDataString(clusterName)); + _url = _url.Replace("{nodeTypeName}", System.Uri.EscapeDataString(nodeTypeName)); + 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; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, 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 != 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(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes one or more nodes on the node type. + /// + /// + /// Deletes one or more nodes on the node type. It will disable the fabric + /// nodes, trigger a delete on the VMs and removes the state from the cluster. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the node type. + /// + /// + /// parameters for delete action. + /// + /// + /// 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 BeginDeleteNodeWithHttpMessagesAsync(string resourceGroupName, string clusterName, string nodeTypeName, NodeTypeActionParameters parameters, 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 (clusterName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "clusterName"); + } + if (nodeTypeName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nodeTypeName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.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("clusterName", clusterName); + tracingParameters.Add("nodeTypeName", nodeTypeName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDeleteNode", 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.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}/deleteNode").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{clusterName}", System.Uri.EscapeDataString(clusterName)); + _url = _url.Replace("{nodeTypeName}", System.Uri.EscapeDataString(nodeTypeName)); + 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; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, 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 != 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(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or updates a Service Fabric node type. + /// + /// + /// Create or update a Service Fabric node type of a given managed cluster. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the node type. + /// + /// + /// The node type 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string clusterName, string nodeTypeName, NodeType parameters, 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 (clusterName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "clusterName"); + } + if (nodeTypeName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nodeTypeName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.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("clusterName", clusterName); + tracingParameters.Add("nodeTypeName", nodeTypeName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", 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.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{clusterName}", System.Uri.EscapeDataString(clusterName)); + _url = _url.Replace("{nodeTypeName}", System.Uri.EscapeDataString(nodeTypeName)); + 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(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, 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 != 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 == 202) + { + _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 a Service Fabric node type. + /// + /// + /// Delete a Service Fabric node type of a given managed cluster. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the node type. + /// + /// + /// 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 BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string clusterName, string nodeTypeName, 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 (clusterName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "clusterName"); + } + if (nodeTypeName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nodeTypeName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("clusterName", clusterName); + tracingParameters.Add("nodeTypeName", nodeTypeName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", 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.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{clusterName}", System.Uri.EscapeDataString(clusterName)); + _url = _url.Replace("{nodeTypeName}", System.Uri.EscapeDataString(nodeTypeName)); + 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 the list of Node types of the specified managed cluster. + /// + /// + /// Gets all Node types of the specified managed cluster. + /// + /// + /// 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>> ListByManagedClustersNextWithHttpMessagesAsync(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, "ListByManagedClustersNext", 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/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/NodeTypesOperationsExtensions.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/NodeTypesOperationsExtensions.cs new file mode 100644 index 0000000000000..41f1d0b8e1ce1 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/NodeTypesOperationsExtensions.cs @@ -0,0 +1,781 @@ +// +// 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.ServiceFabricManagedClusters +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for NodeTypesOperations. + /// + public static partial class NodeTypesOperationsExtensions + { + /// + /// Gets the list of Node types of the specified managed cluster. + /// + /// + /// Gets all Node types of the specified managed cluster. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + public static IPage ListByManagedClusters(this INodeTypesOperations operations, string resourceGroupName, string clusterName) + { + return operations.ListByManagedClustersAsync(resourceGroupName, clusterName).GetAwaiter().GetResult(); + } + + /// + /// Gets the list of Node types of the specified managed cluster. + /// + /// + /// Gets all Node types of the specified managed cluster. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByManagedClustersAsync(this INodeTypesOperations operations, string resourceGroupName, string clusterName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByManagedClustersWithHttpMessagesAsync(resourceGroupName, clusterName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Restarts one or more nodes on the node type. + /// + /// + /// Restarts one or more nodes on the node type. It will disable the fabric + /// nodes, trigger a restart on the VMs and activate the nodes back again. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the node type. + /// + /// + /// parameters for restart action. + /// + public static void Restart(this INodeTypesOperations operations, string resourceGroupName, string clusterName, string nodeTypeName, NodeTypeActionParameters parameters) + { + operations.RestartAsync(resourceGroupName, clusterName, nodeTypeName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Restarts one or more nodes on the node type. + /// + /// + /// Restarts one or more nodes on the node type. It will disable the fabric + /// nodes, trigger a restart on the VMs and activate the nodes back again. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the node type. + /// + /// + /// parameters for restart action. + /// + /// + /// The cancellation token. + /// + public static async Task RestartAsync(this INodeTypesOperations operations, string resourceGroupName, string clusterName, string nodeTypeName, NodeTypeActionParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.RestartWithHttpMessagesAsync(resourceGroupName, clusterName, nodeTypeName, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Reimages one or more nodes on the node type. + /// + /// + /// Reimages one or more nodes on the node type. It will disable the fabric + /// nodes, trigger a reimage on the VMs and activate the nodes back again. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the node type. + /// + /// + /// parameters for reimage action. + /// + public static void Reimage(this INodeTypesOperations operations, string resourceGroupName, string clusterName, string nodeTypeName, NodeTypeActionParameters parameters) + { + operations.ReimageAsync(resourceGroupName, clusterName, nodeTypeName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Reimages one or more nodes on the node type. + /// + /// + /// Reimages one or more nodes on the node type. It will disable the fabric + /// nodes, trigger a reimage on the VMs and activate the nodes back again. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the node type. + /// + /// + /// parameters for reimage action. + /// + /// + /// The cancellation token. + /// + public static async Task ReimageAsync(this INodeTypesOperations operations, string resourceGroupName, string clusterName, string nodeTypeName, NodeTypeActionParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.ReimageWithHttpMessagesAsync(resourceGroupName, clusterName, nodeTypeName, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Deletes one or more nodes on the node type. + /// + /// + /// Deletes one or more nodes on the node type. It will disable the fabric + /// nodes, trigger a delete on the VMs and removes the state from the cluster. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the node type. + /// + /// + /// parameters for delete action. + /// + public static void DeleteNode(this INodeTypesOperations operations, string resourceGroupName, string clusterName, string nodeTypeName, NodeTypeActionParameters parameters) + { + operations.DeleteNodeAsync(resourceGroupName, clusterName, nodeTypeName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Deletes one or more nodes on the node type. + /// + /// + /// Deletes one or more nodes on the node type. It will disable the fabric + /// nodes, trigger a delete on the VMs and removes the state from the cluster. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the node type. + /// + /// + /// parameters for delete action. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteNodeAsync(this INodeTypesOperations operations, string resourceGroupName, string clusterName, string nodeTypeName, NodeTypeActionParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteNodeWithHttpMessagesAsync(resourceGroupName, clusterName, nodeTypeName, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets a Service Fabric node type. + /// + /// + /// Get a Service Fabric node type of a given managed cluster. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the node type. + /// + public static NodeType Get(this INodeTypesOperations operations, string resourceGroupName, string clusterName, string nodeTypeName) + { + return operations.GetAsync(resourceGroupName, clusterName, nodeTypeName).GetAwaiter().GetResult(); + } + + /// + /// Gets a Service Fabric node type. + /// + /// + /// Get a Service Fabric node type of a given managed cluster. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the node type. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this INodeTypesOperations operations, string resourceGroupName, string clusterName, string nodeTypeName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, clusterName, nodeTypeName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates a Service Fabric node type. + /// + /// + /// Create or update a Service Fabric node type of a given managed cluster. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the node type. + /// + /// + /// The node type resource. + /// + public static NodeType CreateOrUpdate(this INodeTypesOperations operations, string resourceGroupName, string clusterName, string nodeTypeName, NodeType parameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, clusterName, nodeTypeName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a Service Fabric node type. + /// + /// + /// Create or update a Service Fabric node type of a given managed cluster. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the node type. + /// + /// + /// The node type resource. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this INodeTypesOperations operations, string resourceGroupName, string clusterName, string nodeTypeName, NodeType parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, clusterName, nodeTypeName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update the tags of a node type resource of a given managed cluster. + /// + /// + /// Update the configuration of a node type of a given managed cluster, only + /// updating tags. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the node type. + /// + /// + /// Node type update parameters + /// + public static NodeType Update(this INodeTypesOperations operations, string resourceGroupName, string clusterName, string nodeTypeName, IDictionary tags = default(IDictionary)) + { + return operations.UpdateAsync(resourceGroupName, clusterName, nodeTypeName, tags).GetAwaiter().GetResult(); + } + + /// + /// Update the tags of a node type resource of a given managed cluster. + /// + /// + /// Update the configuration of a node type of a given managed cluster, only + /// updating tags. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the node type. + /// + /// + /// Node type update parameters + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this INodeTypesOperations operations, string resourceGroupName, string clusterName, string nodeTypeName, IDictionary tags = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, clusterName, nodeTypeName, tags, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a Service Fabric node type. + /// + /// + /// Delete a Service Fabric node type of a given managed cluster. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the node type. + /// + public static void Delete(this INodeTypesOperations operations, string resourceGroupName, string clusterName, string nodeTypeName) + { + operations.DeleteAsync(resourceGroupName, clusterName, nodeTypeName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a Service Fabric node type. + /// + /// + /// Delete a Service Fabric node type of a given managed cluster. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the node type. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this INodeTypesOperations operations, string resourceGroupName, string clusterName, string nodeTypeName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, clusterName, nodeTypeName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Restarts one or more nodes on the node type. + /// + /// + /// Restarts one or more nodes on the node type. It will disable the fabric + /// nodes, trigger a restart on the VMs and activate the nodes back again. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the node type. + /// + /// + /// parameters for restart action. + /// + public static void BeginRestart(this INodeTypesOperations operations, string resourceGroupName, string clusterName, string nodeTypeName, NodeTypeActionParameters parameters) + { + operations.BeginRestartAsync(resourceGroupName, clusterName, nodeTypeName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Restarts one or more nodes on the node type. + /// + /// + /// Restarts one or more nodes on the node type. It will disable the fabric + /// nodes, trigger a restart on the VMs and activate the nodes back again. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the node type. + /// + /// + /// parameters for restart action. + /// + /// + /// The cancellation token. + /// + public static async Task BeginRestartAsync(this INodeTypesOperations operations, string resourceGroupName, string clusterName, string nodeTypeName, NodeTypeActionParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginRestartWithHttpMessagesAsync(resourceGroupName, clusterName, nodeTypeName, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Reimages one or more nodes on the node type. + /// + /// + /// Reimages one or more nodes on the node type. It will disable the fabric + /// nodes, trigger a reimage on the VMs and activate the nodes back again. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the node type. + /// + /// + /// parameters for reimage action. + /// + public static void BeginReimage(this INodeTypesOperations operations, string resourceGroupName, string clusterName, string nodeTypeName, NodeTypeActionParameters parameters) + { + operations.BeginReimageAsync(resourceGroupName, clusterName, nodeTypeName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Reimages one or more nodes on the node type. + /// + /// + /// Reimages one or more nodes on the node type. It will disable the fabric + /// nodes, trigger a reimage on the VMs and activate the nodes back again. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the node type. + /// + /// + /// parameters for reimage action. + /// + /// + /// The cancellation token. + /// + public static async Task BeginReimageAsync(this INodeTypesOperations operations, string resourceGroupName, string clusterName, string nodeTypeName, NodeTypeActionParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginReimageWithHttpMessagesAsync(resourceGroupName, clusterName, nodeTypeName, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Deletes one or more nodes on the node type. + /// + /// + /// Deletes one or more nodes on the node type. It will disable the fabric + /// nodes, trigger a delete on the VMs and removes the state from the cluster. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the node type. + /// + /// + /// parameters for delete action. + /// + public static void BeginDeleteNode(this INodeTypesOperations operations, string resourceGroupName, string clusterName, string nodeTypeName, NodeTypeActionParameters parameters) + { + operations.BeginDeleteNodeAsync(resourceGroupName, clusterName, nodeTypeName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Deletes one or more nodes on the node type. + /// + /// + /// Deletes one or more nodes on the node type. It will disable the fabric + /// nodes, trigger a delete on the VMs and removes the state from the cluster. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the node type. + /// + /// + /// parameters for delete action. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteNodeAsync(this INodeTypesOperations operations, string resourceGroupName, string clusterName, string nodeTypeName, NodeTypeActionParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteNodeWithHttpMessagesAsync(resourceGroupName, clusterName, nodeTypeName, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Creates or updates a Service Fabric node type. + /// + /// + /// Create or update a Service Fabric node type of a given managed cluster. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the node type. + /// + /// + /// The node type resource. + /// + public static NodeType BeginCreateOrUpdate(this INodeTypesOperations operations, string resourceGroupName, string clusterName, string nodeTypeName, NodeType parameters) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, clusterName, nodeTypeName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a Service Fabric node type. + /// + /// + /// Create or update a Service Fabric node type of a given managed cluster. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the node type. + /// + /// + /// The node type resource. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this INodeTypesOperations operations, string resourceGroupName, string clusterName, string nodeTypeName, NodeType parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, clusterName, nodeTypeName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a Service Fabric node type. + /// + /// + /// Delete a Service Fabric node type of a given managed cluster. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the node type. + /// + public static void BeginDelete(this INodeTypesOperations operations, string resourceGroupName, string clusterName, string nodeTypeName) + { + operations.BeginDeleteAsync(resourceGroupName, clusterName, nodeTypeName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a Service Fabric node type. + /// + /// + /// Delete a Service Fabric node type of a given managed cluster. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the node type. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this INodeTypesOperations operations, string resourceGroupName, string clusterName, string nodeTypeName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, clusterName, nodeTypeName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets the list of Node types of the specified managed cluster. + /// + /// + /// Gets all Node types of the specified managed cluster. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByManagedClustersNext(this INodeTypesOperations operations, string nextPageLink) + { + return operations.ListByManagedClustersNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets the list of Node types of the specified managed cluster. + /// + /// + /// Gets all Node types of the specified managed cluster. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByManagedClustersNextAsync(this INodeTypesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByManagedClustersNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Operations.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Operations.cs new file mode 100644 index 0000000000000..85ab9f01431c2 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/Operations.cs @@ -0,0 +1,400 @@ +// +// 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.ServiceFabricManagedClusters +{ + 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(ServiceFabricManagedClustersManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ServiceFabricManagedClustersManagementClient + /// + public ServiceFabricManagedClustersManagementClient Client { get; private set; } + + /// + /// Lists all of the available Service Fabric resource provider API operations. + /// + /// + /// Get the list of available Service Fabric resource provider API operations. + /// + /// + /// The version of the Service Fabric resource provider API + /// + /// + /// 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 apiVersion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (apiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "apiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + 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.ServiceFabric/operations").ToString(); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 Service Fabric resource provider API operations. + /// + /// + /// Get the list of available Service Fabric resource provider API operations. + /// + /// + /// 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/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/OperationsExtensions.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/OperationsExtensions.cs new file mode 100644 index 0000000000000..0a7895fe8f455 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/OperationsExtensions.cs @@ -0,0 +1,105 @@ +// +// 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.ServiceFabricManagedClusters +{ + 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 Service Fabric resource provider API operations. + /// + /// + /// Get the list of available Service Fabric resource provider API operations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The version of the Service Fabric resource provider API + /// + public static IPage List(this IOperations operations, string apiVersion) + { + return operations.ListAsync(apiVersion).GetAwaiter().GetResult(); + } + + /// + /// Lists all of the available Service Fabric resource provider API operations. + /// + /// + /// Get the list of available Service Fabric resource provider API operations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The version of the Service Fabric resource provider API + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IOperations operations, string apiVersion, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(apiVersion, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all of the available Service Fabric resource provider API operations. + /// + /// + /// Get the list of available Service Fabric resource provider API operations. + /// + /// + /// 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 Service Fabric resource provider API operations. + /// + /// + /// Get the list of available Service Fabric resource provider API operations. + /// + /// + /// 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/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/SdkInfo_ServiceFabricManagedClustersManagementClient.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/SdkInfo_ServiceFabricManagedClustersManagementClient.cs new file mode 100644 index 0000000000000..a8854e8227491 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/SdkInfo_ServiceFabricManagedClustersManagementClient.cs @@ -0,0 +1,33 @@ + +// +// 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.ServiceFabricManagedClusters +{ + using System; + using System.Collections.Generic; + using System.Linq; + + internal static partial class SdkInfo + { + public static IEnumerable> ApiInfo_ServiceFabricManagedClustersManagementClient + { + get + { + return new Tuple[] + { + new Tuple("ServiceFabric", "ApplicationTypeVersions", "2021-01-01-preview"), + new Tuple("ServiceFabric", "ApplicationTypes", "2021-01-01-preview"), + new Tuple("ServiceFabric", "Applications", "2021-01-01-preview"), + new Tuple("ServiceFabric", "ManagedClusters", "2021-01-01-preview"), + new Tuple("ServiceFabric", "NodeTypes", "2021-01-01-preview"), + new Tuple("ServiceFabric", "Operations", "2021-01-01-preview"), + new Tuple("ServiceFabric", "Services", "2021-01-01-preview"), + }.AsEnumerable(); + } + } + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/ServiceFabricManagedClustersManagementClient.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/ServiceFabricManagedClustersManagementClient.cs new file mode 100644 index 0000000000000..a5a8a7c14e7f6 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/ServiceFabricManagedClustersManagementClient.cs @@ -0,0 +1,408 @@ +// +// 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.ServiceFabricManagedClusters +{ + 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 Managed Clusters Management Client + /// + public partial class ServiceFabricManagedClustersManagementClient : ServiceClient, IServiceFabricManagedClustersManagementClient, 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 Service Fabric resource provider API. This is a required + /// parameter and it's value must be "2021-01-01-preview" for this + /// specification. + /// + 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 IApplicationTypesOperations. + /// + public virtual IApplicationTypesOperations ApplicationTypes { get; private set; } + + /// + /// Gets the IApplicationTypeVersionsOperations. + /// + public virtual IApplicationTypeVersionsOperations ApplicationTypeVersions { get; private set; } + + /// + /// Gets the IApplicationsOperations. + /// + public virtual IApplicationsOperations Applications { get; private set; } + + /// + /// Gets the IServicesOperations. + /// + public virtual IServicesOperations Services { get; private set; } + + /// + /// Gets the IManagedClustersOperations. + /// + public virtual IManagedClustersOperations ManagedClusters { get; private set; } + + /// + /// Gets the INodeTypesOperations. + /// + public virtual INodeTypesOperations NodeTypes { get; private set; } + + /// + /// Initializes a new instance of the ServiceFabricManagedClustersManagementClient class. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling ServiceFabricManagedClustersManagementClient.Dispose(). False: will not dispose provided httpClient + protected ServiceFabricManagedClustersManagementClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) + { + Initialize(); + } + + /// + /// Initializes a new instance of the ServiceFabricManagedClustersManagementClient class. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected ServiceFabricManagedClustersManagementClient(params DelegatingHandler[] handlers) : base(handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the ServiceFabricManagedClustersManagementClient class. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected ServiceFabricManagedClustersManagementClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the ServiceFabricManagedClustersManagementClient 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 ServiceFabricManagedClustersManagementClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + BaseUri = baseUri; + } + + /// + /// Initializes a new instance of the ServiceFabricManagedClustersManagementClient 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 ServiceFabricManagedClustersManagementClient(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 ServiceFabricManagedClustersManagementClient 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 ServiceFabricManagedClustersManagementClient(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 ServiceFabricManagedClustersManagementClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling ServiceFabricManagedClustersManagementClient.Dispose(). False: will not dispose provided httpClient + /// + /// Thrown when a required parameter is null + /// + public ServiceFabricManagedClustersManagementClient(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 ServiceFabricManagedClustersManagementClient 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 ServiceFabricManagedClustersManagementClient(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 ServiceFabricManagedClustersManagementClient 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 ServiceFabricManagedClustersManagementClient(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 ServiceFabricManagedClustersManagementClient 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 ServiceFabricManagedClustersManagementClient(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); + ApplicationTypes = new ApplicationTypesOperations(this); + ApplicationTypeVersions = new ApplicationTypeVersionsOperations(this); + Applications = new ApplicationsOperations(this); + Services = new ServicesOperations(this); + ManagedClusters = new ManagedClustersOperations(this); + NodeTypes = new NodeTypesOperations(this); + BaseUri = new System.Uri("https://management.azure.com"); + ApiVersion = "2021-01-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("partitionScheme")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("partitionScheme")); + 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("type")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("type")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("serviceKind")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("serviceKind")); + CustomInitialize(); + DeserializationSettings.Converters.Add(new TransformationJsonConverter()); + DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); + } + } +} diff --git a/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/ServicesOperations.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/ServicesOperations.cs new file mode 100644 index 0000000000000..13d2e51f4b771 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/ServicesOperations.cs @@ -0,0 +1,1364 @@ +// +// 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.ServiceFabricManagedClusters +{ + 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; + + /// + /// ServicesOperations operations. + /// + internal partial class ServicesOperations : IServiceOperations, IServicesOperations + { + /// + /// Initializes a new instance of the ServicesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ServicesOperations(ServiceFabricManagedClustersManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ServiceFabricManagedClustersManagementClient + /// + public ServiceFabricManagedClustersManagementClient Client { get; private set; } + + /// + /// Gets a Service Fabric managed service resource. + /// + /// + /// Get a Service Fabric service resource created or in the process of being + /// created in the Service Fabric managed application resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application resource. + /// + /// + /// The name of the service resource in the format of + /// {applicationName}~{serviceName}. + /// + /// + /// 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 clusterName, string applicationName, string serviceName, 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 (clusterName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "clusterName"); + } + if (applicationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "applicationName"); + } + if (serviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serviceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("clusterName", clusterName); + tracingParameters.Add("applicationName", applicationName); + tracingParameters.Add("serviceName", serviceName); + 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.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}/services/{serviceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{clusterName}", System.Uri.EscapeDataString(clusterName)); + _url = _url.Replace("{applicationName}", System.Uri.EscapeDataString(applicationName)); + _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); + 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; + } + + /// + /// Creates or updates a Service Fabric managed service resource. + /// + /// + /// Create or update a Service Fabric managed service resource with the + /// specified name. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application resource. + /// + /// + /// The name of the service resource in the format of + /// {applicationName}~{serviceName}. + /// + /// + /// The service resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateWithHttpMessagesAsync(string resourceGroupName, string clusterName, string applicationName, string serviceName, ServiceResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateWithHttpMessagesAsync(resourceGroupName, clusterName, applicationName, serviceName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates the tags of a service resource of a given managed cluster. + /// + /// + /// Updates the tags of a service resource of a given managed cluster. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application resource. + /// + /// + /// The name of the service resource in the format of + /// {applicationName}~{serviceName}. + /// + /// + /// Service update parameters + /// + /// + /// 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string clusterName, string applicationName, string serviceName, IDictionary tags = default(IDictionary), 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 (clusterName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "clusterName"); + } + if (applicationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "applicationName"); + } + if (serviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serviceName"); + } + ServiceUpdateParameters parameters = new ServiceUpdateParameters(); + if (tags != null) + { + parameters.Tags = tags; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("clusterName", clusterName); + tracingParameters.Add("applicationName", applicationName); + tracingParameters.Add("serviceName", serviceName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", 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.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}/services/{serviceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{clusterName}", System.Uri.EscapeDataString(clusterName)); + _url = _url.Replace("{applicationName}", System.Uri.EscapeDataString(applicationName)); + _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); + 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("PATCH"); + _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(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, 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) + { + 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 a Service Fabric managed service resource. + /// + /// + /// Delete a Service Fabric managed service resource with the specified name. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application resource. + /// + /// + /// The name of the service resource in the format of + /// {applicationName}~{serviceName}. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string clusterName, string applicationName, string serviceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, clusterName, applicationName, serviceName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the list of service resources created in the specified Service Fabric + /// managed application resource. + /// + /// + /// Gets all service resources created or in the process of being created in + /// the Service Fabric managed application resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the 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>> ListByApplicationsWithHttpMessagesAsync(string resourceGroupName, string clusterName, string applicationName, 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 (clusterName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "clusterName"); + } + if (applicationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "applicationName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("clusterName", clusterName); + tracingParameters.Add("applicationName", applicationName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByApplications", 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.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}/services").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{clusterName}", System.Uri.EscapeDataString(clusterName)); + _url = _url.Replace("{applicationName}", System.Uri.EscapeDataString(applicationName)); + 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; + } + + /// + /// Creates or updates a Service Fabric managed service resource. + /// + /// + /// Create or update a Service Fabric managed service resource with the + /// specified name. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application resource. + /// + /// + /// The name of the service resource in the format of + /// {applicationName}~{serviceName}. + /// + /// + /// The service 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> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string clusterName, string applicationName, string serviceName, ServiceResource parameters, 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 (clusterName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "clusterName"); + } + if (applicationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "applicationName"); + } + if (serviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serviceName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.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("clusterName", clusterName); + tracingParameters.Add("applicationName", applicationName); + tracingParameters.Add("serviceName", serviceName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreate", 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.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}/services/{serviceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{clusterName}", System.Uri.EscapeDataString(clusterName)); + _url = _url.Replace("{applicationName}", System.Uri.EscapeDataString(applicationName)); + _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); + 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(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, 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 != 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 == 202) + { + _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 a Service Fabric managed service resource. + /// + /// + /// Delete a Service Fabric managed service resource with the specified name. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application resource. + /// + /// + /// The name of the service resource in the format of + /// {applicationName}~{serviceName}. + /// + /// + /// 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 BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string clusterName, string applicationName, string serviceName, 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 (clusterName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "clusterName"); + } + if (applicationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "applicationName"); + } + if (serviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serviceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("clusterName", clusterName); + tracingParameters.Add("applicationName", applicationName); + tracingParameters.Add("serviceName", serviceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", 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.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}/services/{serviceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{clusterName}", System.Uri.EscapeDataString(clusterName)); + _url = _url.Replace("{applicationName}", System.Uri.EscapeDataString(applicationName)); + _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); + 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 the list of service resources created in the specified Service Fabric + /// managed application resource. + /// + /// + /// Gets all service resources created or in the process of being created in + /// the Service Fabric managed application resource. + /// + /// + /// 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>> ListByApplicationsNextWithHttpMessagesAsync(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, "ListByApplicationsNext", 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/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/ServicesOperationsExtensions.cs b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/ServicesOperationsExtensions.cs new file mode 100644 index 0000000000000..56817b0b55553 --- /dev/null +++ b/sdk/servicefabricmanagedlusters/Microsoft.Azure.Management.ServiceFabricManagedClusters/src/Generated/ServicesOperationsExtensions.cs @@ -0,0 +1,505 @@ +// +// 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.ServiceFabricManagedClusters +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ServicesOperations. + /// + public static partial class ServicesOperationsExtensions + { + /// + /// Gets a Service Fabric managed service resource. + /// + /// + /// Get a Service Fabric service resource created or in the process of being + /// created in the Service Fabric managed application resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application resource. + /// + /// + /// The name of the service resource in the format of + /// {applicationName}~{serviceName}. + /// + public static ServiceResource Get(this IServicesOperations operations, string resourceGroupName, string clusterName, string applicationName, string serviceName) + { + return operations.GetAsync(resourceGroupName, clusterName, applicationName, serviceName).GetAwaiter().GetResult(); + } + + /// + /// Gets a Service Fabric managed service resource. + /// + /// + /// Get a Service Fabric service resource created or in the process of being + /// created in the Service Fabric managed application resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application resource. + /// + /// + /// The name of the service resource in the format of + /// {applicationName}~{serviceName}. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IServicesOperations operations, string resourceGroupName, string clusterName, string applicationName, string serviceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, clusterName, applicationName, serviceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates a Service Fabric managed service resource. + /// + /// + /// Create or update a Service Fabric managed service resource with the + /// specified name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application resource. + /// + /// + /// The name of the service resource in the format of + /// {applicationName}~{serviceName}. + /// + /// + /// The service resource. + /// + public static ServiceResource Create(this IServicesOperations operations, string resourceGroupName, string clusterName, string applicationName, string serviceName, ServiceResource parameters) + { + return operations.CreateAsync(resourceGroupName, clusterName, applicationName, serviceName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a Service Fabric managed service resource. + /// + /// + /// Create or update a Service Fabric managed service resource with the + /// specified name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application resource. + /// + /// + /// The name of the service resource in the format of + /// {applicationName}~{serviceName}. + /// + /// + /// The service resource. + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IServicesOperations operations, string resourceGroupName, string clusterName, string applicationName, string serviceName, ServiceResource parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, clusterName, applicationName, serviceName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates the tags of a service resource of a given managed cluster. + /// + /// + /// Updates the tags of a service resource of a given managed cluster. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application resource. + /// + /// + /// The name of the service resource in the format of + /// {applicationName}~{serviceName}. + /// + /// + /// Service update parameters + /// + public static ServiceResource Update(this IServicesOperations operations, string resourceGroupName, string clusterName, string applicationName, string serviceName, IDictionary tags = default(IDictionary)) + { + return operations.UpdateAsync(resourceGroupName, clusterName, applicationName, serviceName, tags).GetAwaiter().GetResult(); + } + + /// + /// Updates the tags of a service resource of a given managed cluster. + /// + /// + /// Updates the tags of a service resource of a given managed cluster. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application resource. + /// + /// + /// The name of the service resource in the format of + /// {applicationName}~{serviceName}. + /// + /// + /// Service update parameters + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IServicesOperations operations, string resourceGroupName, string clusterName, string applicationName, string serviceName, IDictionary tags = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, clusterName, applicationName, serviceName, tags, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a Service Fabric managed service resource. + /// + /// + /// Delete a Service Fabric managed service resource with the specified name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application resource. + /// + /// + /// The name of the service resource in the format of + /// {applicationName}~{serviceName}. + /// + public static void Delete(this IServicesOperations operations, string resourceGroupName, string clusterName, string applicationName, string serviceName) + { + operations.DeleteAsync(resourceGroupName, clusterName, applicationName, serviceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a Service Fabric managed service resource. + /// + /// + /// Delete a Service Fabric managed service resource with the specified name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application resource. + /// + /// + /// The name of the service resource in the format of + /// {applicationName}~{serviceName}. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IServicesOperations operations, string resourceGroupName, string clusterName, string applicationName, string serviceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, clusterName, applicationName, serviceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets the list of service resources created in the specified Service Fabric + /// managed application resource. + /// + /// + /// Gets all service resources created or in the process of being created in + /// the Service Fabric managed application resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application resource. + /// + public static IPage ListByApplications(this IServicesOperations operations, string resourceGroupName, string clusterName, string applicationName) + { + return operations.ListByApplicationsAsync(resourceGroupName, clusterName, applicationName).GetAwaiter().GetResult(); + } + + /// + /// Gets the list of service resources created in the specified Service Fabric + /// managed application resource. + /// + /// + /// Gets all service resources created or in the process of being created in + /// the Service Fabric managed application resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application resource. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByApplicationsAsync(this IServicesOperations operations, string resourceGroupName, string clusterName, string applicationName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByApplicationsWithHttpMessagesAsync(resourceGroupName, clusterName, applicationName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates a Service Fabric managed service resource. + /// + /// + /// Create or update a Service Fabric managed service resource with the + /// specified name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application resource. + /// + /// + /// The name of the service resource in the format of + /// {applicationName}~{serviceName}. + /// + /// + /// The service resource. + /// + public static ServiceResource BeginCreate(this IServicesOperations operations, string resourceGroupName, string clusterName, string applicationName, string serviceName, ServiceResource parameters) + { + return operations.BeginCreateAsync(resourceGroupName, clusterName, applicationName, serviceName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a Service Fabric managed service resource. + /// + /// + /// Create or update a Service Fabric managed service resource with the + /// specified name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application resource. + /// + /// + /// The name of the service resource in the format of + /// {applicationName}~{serviceName}. + /// + /// + /// The service resource. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateAsync(this IServicesOperations operations, string resourceGroupName, string clusterName, string applicationName, string serviceName, ServiceResource parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateWithHttpMessagesAsync(resourceGroupName, clusterName, applicationName, serviceName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a Service Fabric managed service resource. + /// + /// + /// Delete a Service Fabric managed service resource with the specified name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application resource. + /// + /// + /// The name of the service resource in the format of + /// {applicationName}~{serviceName}. + /// + public static void BeginDelete(this IServicesOperations operations, string resourceGroupName, string clusterName, string applicationName, string serviceName) + { + operations.BeginDeleteAsync(resourceGroupName, clusterName, applicationName, serviceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a Service Fabric managed service resource. + /// + /// + /// Delete a Service Fabric managed service resource with the specified name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cluster resource. + /// + /// + /// The name of the application resource. + /// + /// + /// The name of the service resource in the format of + /// {applicationName}~{serviceName}. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IServicesOperations operations, string resourceGroupName, string clusterName, string applicationName, string serviceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, clusterName, applicationName, serviceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets the list of service resources created in the specified Service Fabric + /// managed application resource. + /// + /// + /// Gets all service resources created or in the process of being created in + /// the Service Fabric managed application resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByApplicationsNext(this IServicesOperations operations, string nextPageLink) + { + return operations.ListByApplicationsNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets the list of service resources created in the specified Service Fabric + /// managed application resource. + /// + /// + /// Gets all service resources created or in the process of being created in + /// the Service Fabric managed application resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByApplicationsNextAsync(this IServicesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByApplicationsNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +}