diff --git a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/IPrivateEndpointConnectionsOperations.cs b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/IPrivateEndpointConnectionsOperations.cs new file mode 100644 index 000000000000..9ed7cd4706fe --- /dev/null +++ b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/IPrivateEndpointConnectionsOperations.cs @@ -0,0 +1,207 @@ +// +// 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.StorageSync +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// PrivateEndpointConnectionsOperations operations. + /// + public partial interface IPrivateEndpointConnectionsOperations + { + /// + /// Gets the specified private endpoint connection associated with the + /// storage sync service. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the storage sync service name within the specified + /// resource group. + /// + /// + /// The name of the private endpoint connection associated with the + /// Azure 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 storageSyncServiceName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update the state of specified private endpoint connection + /// associated with the storage sync service. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the storage sync service name within the specified + /// resource group. + /// + /// + /// The name of the private endpoint connection associated with the + /// Azure resource + /// + /// + /// The private endpoint connection properties. + /// + /// + /// 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 storageSyncServiceName, string privateEndpointConnectionName, PrivateEndpointConnection properties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the specified private endpoint connection associated with + /// the storage sync service. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the storage sync service name within the specified + /// resource group. + /// + /// + /// The name of the private endpoint connection associated with the + /// Azure 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 storageSyncServiceName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get a PrivateEndpointConnection List. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Storage Sync 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,PrivateEndpointConnectionsListByStorageSyncServiceHeaders>> ListByStorageSyncServiceWithHttpMessagesAsync(string resourceGroupName, string storageSyncServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update the state of specified private endpoint connection + /// associated with the storage sync service. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the storage sync service name within the specified + /// resource group. + /// + /// + /// The name of the private endpoint connection associated with the + /// Azure resource + /// + /// + /// The private endpoint connection properties. + /// + /// + /// 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 storageSyncServiceName, string privateEndpointConnectionName, PrivateEndpointConnection properties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the specified private endpoint connection associated with + /// the storage sync service. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the storage sync service name within the specified + /// resource group. + /// + /// + /// The name of the private endpoint connection associated with the + /// Azure 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 storageSyncServiceName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/IPrivateLinkResourcesOperations.cs b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/IPrivateLinkResourcesOperations.cs new file mode 100644 index 000000000000..c7efb101165a --- /dev/null +++ b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/IPrivateLinkResourcesOperations.cs @@ -0,0 +1,54 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorageSync +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// PrivateLinkResourcesOperations operations. + /// + public partial interface IPrivateLinkResourcesOperations + { + /// + /// Gets the private link resources that need to be created for a + /// storage sync service. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the storage sync service name within the specified + /// 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> ListByStorageSyncServiceWithHttpMessagesAsync(string resourceGroupName, string storageSyncServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/IStorageSyncManagementClient.cs b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/IStorageSyncManagementClient.cs index 4273770c666c..f812f6583e9d 100644 --- a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/IStorageSyncManagementClient.cs +++ b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/IStorageSyncManagementClient.cs @@ -79,6 +79,16 @@ public partial interface IStorageSyncManagementClient : System.IDisposable /// IStorageSyncServicesOperations StorageSyncServices { get; } + /// + /// Gets the IPrivateLinkResourcesOperations. + /// + IPrivateLinkResourcesOperations PrivateLinkResources { get; } + + /// + /// Gets the IPrivateEndpointConnectionsOperations. + /// + IPrivateEndpointConnectionsOperations PrivateEndpointConnections { get; } + /// /// Gets the ISyncGroupsOperations. /// diff --git a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/IStorageSyncServicesOperations.cs b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/IStorageSyncServicesOperations.cs index c3b60de9579d..8b90307aeb7a 100644 --- a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/IStorageSyncServicesOperations.cs +++ b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/IStorageSyncServicesOperations.cs @@ -75,7 +75,7 @@ public partial interface IStorageSyncServicesOperations /// /// Thrown when a required parameter is null /// - Task> CreateWithHttpMessagesAsync(string resourceGroupName, string storageSyncServiceName, StorageSyncServiceCreateParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateWithHttpMessagesAsync(string resourceGroupName, string storageSyncServiceName, StorageSyncServiceCreateParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get a given StorageSyncService. /// @@ -192,5 +192,83 @@ public partial interface IStorageSyncServicesOperations /// Thrown when a required parameter is null /// Task,StorageSyncServicesListBySubscriptionHeaders>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create a new StorageSyncService. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Storage Sync Service resource. + /// + /// + /// Storage Sync Service resource name. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string storageSyncServiceName, StorageSyncServiceCreateParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Patch a given StorageSyncService. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Storage Sync Service resource. + /// + /// + /// Storage Sync 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string storageSyncServiceName, StorageSyncServiceUpdateParameters parameters = default(StorageSyncServiceUpdateParameters), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a given StorageSyncService. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Storage Sync Service 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 storageSyncServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/CloudTieringCachePerformance.cs b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/CloudTieringCachePerformance.cs new file mode 100644 index 000000000000..82fd9c6eb42b --- /dev/null +++ b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/CloudTieringCachePerformance.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.StorageSync.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Server endpoint cloud tiering status object. + /// + public partial class CloudTieringCachePerformance + { + /// + /// Initializes a new instance of the CloudTieringCachePerformance + /// class. + /// + public CloudTieringCachePerformance() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CloudTieringCachePerformance + /// class. + /// + /// Last updated timestamp + /// Count of bytes that were served from + /// the local server + /// Count of bytes that were served from + /// the cloud + /// Percentage of total bytes (hit + + /// miss) that were served from the local server + public CloudTieringCachePerformance(System.DateTime? lastUpdatedTimestamp = default(System.DateTime?), long? cacheHitBytes = default(long?), long? cacheMissBytes = default(long?), int? cacheHitBytesPercent = default(int?)) + { + LastUpdatedTimestamp = lastUpdatedTimestamp; + CacheHitBytes = cacheHitBytes; + CacheMissBytes = cacheMissBytes; + CacheHitBytesPercent = cacheHitBytesPercent; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets last updated timestamp + /// + [JsonProperty(PropertyName = "lastUpdatedTimestamp")] + public System.DateTime? LastUpdatedTimestamp { get; private set; } + + /// + /// Gets count of bytes that were served from the local server + /// + [JsonProperty(PropertyName = "cacheHitBytes")] + public long? CacheHitBytes { get; private set; } + + /// + /// Gets count of bytes that were served from the cloud + /// + [JsonProperty(PropertyName = "cacheMissBytes")] + public long? CacheMissBytes { get; private set; } + + /// + /// Gets percentage of total bytes (hit + miss) that were served from + /// the local server + /// + [JsonProperty(PropertyName = "cacheHitBytesPercent")] + public int? CacheHitBytesPercent { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (CacheHitBytes < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "CacheHitBytes", 0); + } + if (CacheMissBytes < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "CacheMissBytes", 0); + } + if (CacheHitBytesPercent > 100) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "CacheHitBytesPercent", 100); + } + if (CacheHitBytesPercent < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "CacheHitBytesPercent", 0); + } + } + } +} diff --git a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/CloudTieringDatePolicyStatus.cs b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/CloudTieringDatePolicyStatus.cs new file mode 100644 index 000000000000..b55472063e07 --- /dev/null +++ b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/CloudTieringDatePolicyStatus.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorageSync.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Status of the date policy + /// + public partial class CloudTieringDatePolicyStatus + { + /// + /// Initializes a new instance of the CloudTieringDatePolicyStatus + /// class. + /// + public CloudTieringDatePolicyStatus() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CloudTieringDatePolicyStatus + /// class. + /// + /// Last updated timestamp + /// Most recent + /// access time of tiered files + public CloudTieringDatePolicyStatus(System.DateTime? lastUpdatedTimestamp = default(System.DateTime?), System.DateTime? tieredFilesMostRecentAccessTimestamp = default(System.DateTime?)) + { + LastUpdatedTimestamp = lastUpdatedTimestamp; + TieredFilesMostRecentAccessTimestamp = tieredFilesMostRecentAccessTimestamp; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets last updated timestamp + /// + [JsonProperty(PropertyName = "lastUpdatedTimestamp")] + public System.DateTime? LastUpdatedTimestamp { get; private set; } + + /// + /// Gets most recent access time of tiered files + /// + [JsonProperty(PropertyName = "tieredFilesMostRecentAccessTimestamp")] + public System.DateTime? TieredFilesMostRecentAccessTimestamp { get; private set; } + + } +} diff --git a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/CloudTieringFilesNotTiering.cs b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/CloudTieringFilesNotTiering.cs new file mode 100644 index 000000000000..7976099ca30f --- /dev/null +++ b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/CloudTieringFilesNotTiering.cs @@ -0,0 +1,96 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorageSync.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Server endpoint cloud tiering status object. + /// + public partial class CloudTieringFilesNotTiering + { + /// + /// Initializes a new instance of the CloudTieringFilesNotTiering + /// class. + /// + public CloudTieringFilesNotTiering() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CloudTieringFilesNotTiering + /// class. + /// + /// Last updated timestamp + /// Last cloud tiering result + /// (HResult) + /// Array of tiering errors + public CloudTieringFilesNotTiering(System.DateTime? lastUpdatedTimestamp = default(System.DateTime?), long? totalFileCount = default(long?), IList errors = default(IList)) + { + LastUpdatedTimestamp = lastUpdatedTimestamp; + TotalFileCount = totalFileCount; + Errors = errors; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets last updated timestamp + /// + [JsonProperty(PropertyName = "lastUpdatedTimestamp")] + public System.DateTime? LastUpdatedTimestamp { get; private set; } + + /// + /// Gets last cloud tiering result (HResult) + /// + [JsonProperty(PropertyName = "totalFileCount")] + public long? TotalFileCount { get; private set; } + + /// + /// Gets array of tiering errors + /// + [JsonProperty(PropertyName = "errors")] + public IList Errors { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (TotalFileCount < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "TotalFileCount", 0); + } + if (Errors != null) + { + foreach (var element in Errors) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/CloudTieringSpaceSavings.cs b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/CloudTieringSpaceSavings.cs new file mode 100644 index 000000000000..fa05b1717ed5 --- /dev/null +++ b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/CloudTieringSpaceSavings.cs @@ -0,0 +1,129 @@ +// +// 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.StorageSync.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Server endpoint cloud tiering status object. + /// + public partial class CloudTieringSpaceSavings + { + /// + /// Initializes a new instance of the CloudTieringSpaceSavings class. + /// + public CloudTieringSpaceSavings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CloudTieringSpaceSavings class. + /// + /// Last updated timestamp + /// Volume size + /// Total size of content in the + /// azure file share + /// Cached content size on the + /// server + /// Percentage of cached size over + /// total size + /// Count of bytes saved on the + /// server + public CloudTieringSpaceSavings(System.DateTime? lastUpdatedTimestamp = default(System.DateTime?), long? volumeSizeBytes = default(long?), long? totalSizeCloudBytes = default(long?), long? cachedSizeBytes = default(long?), int? spaceSavingsPercent = default(int?), long? spaceSavingsBytes = default(long?)) + { + LastUpdatedTimestamp = lastUpdatedTimestamp; + VolumeSizeBytes = volumeSizeBytes; + TotalSizeCloudBytes = totalSizeCloudBytes; + CachedSizeBytes = cachedSizeBytes; + SpaceSavingsPercent = spaceSavingsPercent; + SpaceSavingsBytes = spaceSavingsBytes; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets last updated timestamp + /// + [JsonProperty(PropertyName = "lastUpdatedTimestamp")] + public System.DateTime? LastUpdatedTimestamp { get; private set; } + + /// + /// Gets volume size + /// + [JsonProperty(PropertyName = "volumeSizeBytes")] + public long? VolumeSizeBytes { get; private set; } + + /// + /// Gets total size of content in the azure file share + /// + [JsonProperty(PropertyName = "totalSizeCloudBytes")] + public long? TotalSizeCloudBytes { get; private set; } + + /// + /// Gets cached content size on the server + /// + [JsonProperty(PropertyName = "cachedSizeBytes")] + public long? CachedSizeBytes { get; private set; } + + /// + /// Gets percentage of cached size over total size + /// + [JsonProperty(PropertyName = "spaceSavingsPercent")] + public int? SpaceSavingsPercent { get; private set; } + + /// + /// Gets count of bytes saved on the server + /// + [JsonProperty(PropertyName = "spaceSavingsBytes")] + public long? SpaceSavingsBytes { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (VolumeSizeBytes < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "VolumeSizeBytes", 0); + } + if (TotalSizeCloudBytes < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "TotalSizeCloudBytes", 0); + } + if (CachedSizeBytes < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "CachedSizeBytes", 0); + } + if (SpaceSavingsPercent > 100) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "SpaceSavingsPercent", 100); + } + if (SpaceSavingsPercent < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "SpaceSavingsPercent", 0); + } + if (SpaceSavingsBytes < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "SpaceSavingsBytes", 0); + } + } + } +} diff --git a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/CloudTieringVolumeFreeSpacePolicyStatus.cs b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/CloudTieringVolumeFreeSpacePolicyStatus.cs new file mode 100644 index 000000000000..52969a048106 --- /dev/null +++ b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/CloudTieringVolumeFreeSpacePolicyStatus.cs @@ -0,0 +1,99 @@ +// +// 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.StorageSync.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Status of the volume free space policy + /// + public partial class CloudTieringVolumeFreeSpacePolicyStatus + { + /// + /// Initializes a new instance of the + /// CloudTieringVolumeFreeSpacePolicyStatus class. + /// + public CloudTieringVolumeFreeSpacePolicyStatus() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// CloudTieringVolumeFreeSpacePolicyStatus class. + /// + /// Last updated timestamp + /// In the case where + /// multiple server endpoints are present in a volume, an effective + /// free space policy is applied. + /// Current volume free + /// space percentage. + public CloudTieringVolumeFreeSpacePolicyStatus(System.DateTime? lastUpdatedTimestamp = default(System.DateTime?), int? effectiveVolumeFreeSpacePolicy = default(int?), int? currentVolumeFreeSpacePercent = default(int?)) + { + LastUpdatedTimestamp = lastUpdatedTimestamp; + EffectiveVolumeFreeSpacePolicy = effectiveVolumeFreeSpacePolicy; + CurrentVolumeFreeSpacePercent = currentVolumeFreeSpacePercent; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets last updated timestamp + /// + [JsonProperty(PropertyName = "lastUpdatedTimestamp")] + public System.DateTime? LastUpdatedTimestamp { get; private set; } + + /// + /// Gets in the case where multiple server endpoints are present in a + /// volume, an effective free space policy is applied. + /// + [JsonProperty(PropertyName = "effectiveVolumeFreeSpacePolicy")] + public int? EffectiveVolumeFreeSpacePolicy { get; private set; } + + /// + /// Gets current volume free space percentage. + /// + [JsonProperty(PropertyName = "currentVolumeFreeSpacePercent")] + public int? CurrentVolumeFreeSpacePercent { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (EffectiveVolumeFreeSpacePolicy > 100) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "EffectiveVolumeFreeSpacePolicy", 100); + } + if (EffectiveVolumeFreeSpacePolicy < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "EffectiveVolumeFreeSpacePolicy", 0); + } + if (CurrentVolumeFreeSpacePercent > 100) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "CurrentVolumeFreeSpacePercent", 100); + } + if (CurrentVolumeFreeSpacePercent < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "CurrentVolumeFreeSpacePercent", 0); + } + } + } +} diff --git a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/FeatureStatus.cs b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/FeatureStatus.cs new file mode 100644 index 000000000000..81a74ec3dfb9 --- /dev/null +++ b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/FeatureStatus.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.StorageSync.Models +{ + + /// + /// Defines values for FeatureStatus. + /// + public static class FeatureStatus + { + public const string On = "on"; + public const string Off = "off"; + } +} diff --git a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/FilesNotTieringError.cs b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/FilesNotTieringError.cs new file mode 100644 index 000000000000..3999fd41aef6 --- /dev/null +++ b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/FilesNotTieringError.cs @@ -0,0 +1,73 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorageSync.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Files not tiering error object + /// + public partial class FilesNotTieringError + { + /// + /// Initializes a new instance of the FilesNotTieringError class. + /// + public FilesNotTieringError() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FilesNotTieringError class. + /// + /// Error code (HResult) + /// Count of files with this error + public FilesNotTieringError(int? errorCode = default(int?), long? fileCount = default(long?)) + { + ErrorCode = errorCode; + FileCount = fileCount; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets error code (HResult) + /// + [JsonProperty(PropertyName = "errorCode")] + public int? ErrorCode { get; private set; } + + /// + /// Gets count of files with this error + /// + [JsonProperty(PropertyName = "fileCount")] + public long? FileCount { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (FileCount < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "FileCount", 0); + } + } + } +} diff --git a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/IncomingTrafficPolicy.cs b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/IncomingTrafficPolicy.cs new file mode 100644 index 000000000000..47b6ba5eb706 --- /dev/null +++ b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/IncomingTrafficPolicy.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.StorageSync.Models +{ + + /// + /// Defines values for IncomingTrafficPolicy. + /// + public static class IncomingTrafficPolicy + { + public const string AllowAllTraffic = "AllowAllTraffic"; + public const string AllowVirtualNetworksOnly = "AllowVirtualNetworksOnly"; + } +} diff --git a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/InitialDownloadPolicy.cs b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/InitialDownloadPolicy.cs new file mode 100644 index 000000000000..e524a2e55ce2 --- /dev/null +++ b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/InitialDownloadPolicy.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.StorageSync.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for InitialDownloadPolicy. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum InitialDownloadPolicy + { + [EnumMember(Value = "NamespaceOnly")] + NamespaceOnly, + [EnumMember(Value = "NamespaceThenModifiedFiles")] + NamespaceThenModifiedFiles, + [EnumMember(Value = "AvoidTieredFiles")] + AvoidTieredFiles + } + internal static class InitialDownloadPolicyEnumExtension + { + internal static string ToSerializedValue(this InitialDownloadPolicy? value) + { + return value == null ? null : ((InitialDownloadPolicy)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this InitialDownloadPolicy value) + { + switch( value ) + { + case InitialDownloadPolicy.NamespaceOnly: + return "NamespaceOnly"; + case InitialDownloadPolicy.NamespaceThenModifiedFiles: + return "NamespaceThenModifiedFiles"; + case InitialDownloadPolicy.AvoidTieredFiles: + return "AvoidTieredFiles"; + } + return null; + } + + internal static InitialDownloadPolicy? ParseInitialDownloadPolicy(this string value) + { + switch( value ) + { + case "NamespaceOnly": + return InitialDownloadPolicy.NamespaceOnly; + case "NamespaceThenModifiedFiles": + return InitialDownloadPolicy.NamespaceThenModifiedFiles; + case "AvoidTieredFiles": + return InitialDownloadPolicy.AvoidTieredFiles; + } + return null; + } + } +} diff --git a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/LocalCacheMode.cs b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/LocalCacheMode.cs new file mode 100644 index 000000000000..a30cf3a159dd --- /dev/null +++ b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/LocalCacheMode.cs @@ -0,0 +1,60 @@ +// +// 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.StorageSync.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for LocalCacheMode. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum LocalCacheMode + { + [EnumMember(Value = "DownloadNewAndModifiedFiles")] + DownloadNewAndModifiedFiles, + [EnumMember(Value = "UpdateLocallyCachedFiles")] + UpdateLocallyCachedFiles + } + internal static class LocalCacheModeEnumExtension + { + internal static string ToSerializedValue(this LocalCacheMode? value) + { + return value == null ? null : ((LocalCacheMode)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this LocalCacheMode value) + { + switch( value ) + { + case LocalCacheMode.DownloadNewAndModifiedFiles: + return "DownloadNewAndModifiedFiles"; + case LocalCacheMode.UpdateLocallyCachedFiles: + return "UpdateLocallyCachedFiles"; + } + return null; + } + + internal static LocalCacheMode? ParseLocalCacheMode(this string value) + { + switch( value ) + { + case "DownloadNewAndModifiedFiles": + return LocalCacheMode.DownloadNewAndModifiedFiles; + case "UpdateLocallyCachedFiles": + return LocalCacheMode.UpdateLocallyCachedFiles; + } + return null; + } + } +} diff --git a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/OperationDirection.cs b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/OperationDirection.cs new file mode 100644 index 000000000000..5ded34cb0804 --- /dev/null +++ b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/OperationDirection.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.StorageSync.Models +{ + + /// + /// Defines values for OperationDirection. + /// + public static class OperationDirection + { + public const string Do = "do"; + public const string Undo = "undo"; + public const string Cancel = "cancel"; + } +} diff --git a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/PrivateEndpoint.cs b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/PrivateEndpoint.cs new file mode 100644 index 000000000000..db80529057d7 --- /dev/null +++ b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/PrivateEndpoint.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.StorageSync.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The Private Endpoint resource. + /// + public partial class PrivateEndpoint + { + /// + /// Initializes a new instance of the PrivateEndpoint class. + /// + public PrivateEndpoint() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateEndpoint class. + /// + /// The ARM identifier for Private Endpoint + public PrivateEndpoint(string id = default(string)) + { + Id = id; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the ARM identifier for Private Endpoint + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + } +} diff --git a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/PrivateEndpointConnection.cs b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/PrivateEndpointConnection.cs new file mode 100644 index 000000000000..67281d933cc4 --- /dev/null +++ b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/PrivateEndpointConnection.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.StorageSync.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The Private Endpoint Connection resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class PrivateEndpointConnection : Resource + { + /// + /// Initializes a new instance of the PrivateEndpointConnection class. + /// + public PrivateEndpointConnection() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateEndpointConnection class. + /// + /// A collection of + /// information about the state of the connection between service + /// consumer and provider. + /// Fully qualified resource Id for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// The resource of private end + /// point. + /// The provisioning state of the + /// private endpoint connection resource. Possible values include: + /// 'Succeeded', 'Creating', 'Deleting', 'Failed' + public PrivateEndpointConnection(PrivateLinkServiceConnectionState privateLinkServiceConnectionState, string id = default(string), string name = default(string), string type = default(string), PrivateEndpoint privateEndpoint = default(PrivateEndpoint), string provisioningState = default(string)) + : base(id, name, type) + { + PrivateEndpoint = privateEndpoint; + PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; + ProvisioningState = provisioningState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the resource of private end point. + /// + [JsonProperty(PropertyName = "properties.privateEndpoint")] + public PrivateEndpoint PrivateEndpoint { get; set; } + + /// + /// Gets or sets a collection of information about the state of the + /// connection between service consumer and provider. + /// + [JsonProperty(PropertyName = "properties.privateLinkServiceConnectionState")] + public PrivateLinkServiceConnectionState PrivateLinkServiceConnectionState { get; set; } + + /// + /// Gets or sets the provisioning state of the private endpoint + /// connection resource. Possible values include: 'Succeeded', + /// 'Creating', 'Deleting', 'Failed' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (PrivateLinkServiceConnectionState == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "PrivateLinkServiceConnectionState"); + } + } + } +} diff --git a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/PrivateEndpointConnectionProvisioningState.cs b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/PrivateEndpointConnectionProvisioningState.cs new file mode 100644 index 000000000000..f275d196cd84 --- /dev/null +++ b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/PrivateEndpointConnectionProvisioningState.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.StorageSync.Models +{ + + /// + /// Defines values for PrivateEndpointConnectionProvisioningState. + /// + public static class PrivateEndpointConnectionProvisioningState + { + public const string Succeeded = "Succeeded"; + public const string Creating = "Creating"; + public const string Deleting = "Deleting"; + public const string Failed = "Failed"; + } +} diff --git a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/PrivateEndpointConnectionsCreateHeaders.cs b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/PrivateEndpointConnectionsCreateHeaders.cs new file mode 100644 index 000000000000..03f21372446e --- /dev/null +++ b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/PrivateEndpointConnectionsCreateHeaders.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.StorageSync.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Create operation. + /// + public partial class PrivateEndpointConnectionsCreateHeaders + { + /// + /// Initializes a new instance of the + /// PrivateEndpointConnectionsCreateHeaders class. + /// + public PrivateEndpointConnectionsCreateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// PrivateEndpointConnectionsCreateHeaders class. + /// + /// Operation Status Location + /// URI + /// Operation Status Location URI + /// Retry After + /// Request id + /// correlation request + /// id + public PrivateEndpointConnectionsCreateHeaders(string azureAsyncOperation = default(string), string location = default(string), string retryAfter = default(string), string xMsRequestId = default(string), string xMsCorrelationRequestId = default(string)) + { + AzureAsyncOperation = azureAsyncOperation; + Location = location; + RetryAfter = retryAfter; + XMsRequestId = xMsRequestId; + XMsCorrelationRequestId = xMsCorrelationRequestId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets operation Status Location URI + /// + [JsonProperty(PropertyName = "Azure-AsyncOperation")] + public string AzureAsyncOperation { get; set; } + + /// + /// Gets or sets operation Status Location URI + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + /// + /// Gets or sets retry After + /// + [JsonProperty(PropertyName = "Retry-After")] + public string RetryAfter { get; set; } + + /// + /// Gets or sets request id + /// + [JsonProperty(PropertyName = "x-ms-request-id")] + public string XMsRequestId { get; set; } + + /// + /// Gets or sets correlation request id + /// + [JsonProperty(PropertyName = "x-ms-correlation-request-id")] + public string XMsCorrelationRequestId { get; set; } + + } +} diff --git a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/PrivateEndpointConnectionsDeleteHeaders.cs b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/PrivateEndpointConnectionsDeleteHeaders.cs new file mode 100644 index 000000000000..bb475bddf5c8 --- /dev/null +++ b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/PrivateEndpointConnectionsDeleteHeaders.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.StorageSync.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Delete operation. + /// + public partial class PrivateEndpointConnectionsDeleteHeaders + { + /// + /// Initializes a new instance of the + /// PrivateEndpointConnectionsDeleteHeaders class. + /// + public PrivateEndpointConnectionsDeleteHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// PrivateEndpointConnectionsDeleteHeaders class. + /// + /// Operation Status Location + /// URI + /// Operation Status Location URI + /// Retry After + /// Request id + /// correlation request + /// id + public PrivateEndpointConnectionsDeleteHeaders(string azureAsyncOperation = default(string), string location = default(string), string retryAfter = default(string), string xMsRequestId = default(string), string xMsCorrelationRequestId = default(string)) + { + AzureAsyncOperation = azureAsyncOperation; + Location = location; + RetryAfter = retryAfter; + XMsRequestId = xMsRequestId; + XMsCorrelationRequestId = xMsCorrelationRequestId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets operation Status Location URI + /// + [JsonProperty(PropertyName = "Azure-AsyncOperation")] + public string AzureAsyncOperation { get; set; } + + /// + /// Gets or sets operation Status Location URI + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + /// + /// Gets or sets retry After + /// + [JsonProperty(PropertyName = "Retry-After")] + public string RetryAfter { get; set; } + + /// + /// Gets or sets request id + /// + [JsonProperty(PropertyName = "x-ms-request-id")] + public string XMsRequestId { get; set; } + + /// + /// Gets or sets correlation request id + /// + [JsonProperty(PropertyName = "x-ms-correlation-request-id")] + public string XMsCorrelationRequestId { get; set; } + + } +} diff --git a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/PrivateEndpointConnectionsListByStorageSyncServiceHeaders.cs b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/PrivateEndpointConnectionsListByStorageSyncServiceHeaders.cs new file mode 100644 index 000000000000..fc72d4dfa657 --- /dev/null +++ b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/PrivateEndpointConnectionsListByStorageSyncServiceHeaders.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorageSync.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for ListByStorageSyncService operation. + /// + public partial class PrivateEndpointConnectionsListByStorageSyncServiceHeaders + { + /// + /// Initializes a new instance of the + /// PrivateEndpointConnectionsListByStorageSyncServiceHeaders class. + /// + public PrivateEndpointConnectionsListByStorageSyncServiceHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// PrivateEndpointConnectionsListByStorageSyncServiceHeaders class. + /// + /// request id. + /// correlation request + /// id. + public PrivateEndpointConnectionsListByStorageSyncServiceHeaders(string xMsRequestId = default(string), string xMsCorrelationRequestId = default(string)) + { + XMsRequestId = xMsRequestId; + XMsCorrelationRequestId = xMsCorrelationRequestId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets request id. + /// + [JsonProperty(PropertyName = "x-ms-request-id")] + public string XMsRequestId { get; set; } + + /// + /// Gets or sets correlation request id. + /// + [JsonProperty(PropertyName = "x-ms-correlation-request-id")] + public string XMsCorrelationRequestId { get; set; } + + } +} diff --git a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/PrivateEndpointServiceConnectionStatus.cs b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/PrivateEndpointServiceConnectionStatus.cs new file mode 100644 index 000000000000..affca9375c62 --- /dev/null +++ b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/PrivateEndpointServiceConnectionStatus.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.StorageSync.Models +{ + + /// + /// Defines values for PrivateEndpointServiceConnectionStatus. + /// + public static class PrivateEndpointServiceConnectionStatus + { + public const string Pending = "Pending"; + public const string Approved = "Approved"; + public const string Rejected = "Rejected"; + } +} diff --git a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/PrivateLinkResource.cs b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/PrivateLinkResource.cs new file mode 100644 index 000000000000..e6f7cef998e9 --- /dev/null +++ b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/PrivateLinkResource.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.StorageSync.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A private link resource + /// + [Rest.Serialization.JsonTransformation] + public partial class PrivateLinkResource : Resource + { + /// + /// Initializes a new instance of the PrivateLinkResource class. + /// + public PrivateLinkResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateLinkResource class. + /// + /// Fully qualified resource Id for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// The private link resource group id. + /// The private link resource required + /// member names. + /// The private link resource Private + /// link DNS zone name. + public PrivateLinkResource(string id = default(string), string name = default(string), string type = default(string), string groupId = default(string), IList requiredMembers = default(IList), IList requiredZoneNames = default(IList)) + : base(id, name, type) + { + GroupId = groupId; + RequiredMembers = requiredMembers; + RequiredZoneNames = requiredZoneNames; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the private link resource group id. + /// + [JsonProperty(PropertyName = "properties.groupId")] + public string GroupId { get; private set; } + + /// + /// Gets the private link resource required member names. + /// + [JsonProperty(PropertyName = "properties.requiredMembers")] + public IList RequiredMembers { get; private set; } + + /// + /// Gets or sets the private link resource Private link DNS zone name. + /// + [JsonProperty(PropertyName = "properties.requiredZoneNames")] + public IList RequiredZoneNames { get; set; } + + } +} diff --git a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/PrivateLinkResourceListResult.cs b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/PrivateLinkResourceListResult.cs new file mode 100644 index 000000000000..bda175c31359 --- /dev/null +++ b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/PrivateLinkResourceListResult.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.StorageSync.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A list of private link resources + /// + public partial class PrivateLinkResourceListResult + { + /// + /// Initializes a new instance of the PrivateLinkResourceListResult + /// class. + /// + public PrivateLinkResourceListResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateLinkResourceListResult + /// class. + /// + /// Array of private link resources + public PrivateLinkResourceListResult(IList value = default(IList)) + { + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets array of private link resources + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + } +} diff --git a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/PrivateLinkServiceConnectionState.cs b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/PrivateLinkServiceConnectionState.cs new file mode 100644 index 000000000000..db4ff396c44f --- /dev/null +++ b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/PrivateLinkServiceConnectionState.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.StorageSync.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// A collection of information about the state of the connection between + /// service consumer and provider. + /// + public partial class PrivateLinkServiceConnectionState + { + /// + /// Initializes a new instance of the PrivateLinkServiceConnectionState + /// class. + /// + public PrivateLinkServiceConnectionState() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateLinkServiceConnectionState + /// class. + /// + /// Indicates whether the connection has been + /// Approved/Rejected/Removed by the owner of the service. Possible + /// values include: 'Pending', 'Approved', 'Rejected' + /// The reason for approval/rejection of the + /// connection. + /// A message indicating if changes on the + /// service provider require any updates on the consumer. + public PrivateLinkServiceConnectionState(string status = default(string), string description = default(string), string actionRequired = default(string)) + { + Status = status; + Description = description; + ActionRequired = actionRequired; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets indicates whether the connection has been + /// Approved/Rejected/Removed by the owner of the service. Possible + /// values include: 'Pending', 'Approved', 'Rejected' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + /// + /// Gets or sets the reason for approval/rejection of the connection. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// Gets or sets a message indicating if changes on the service + /// provider require any updates on the consumer. + /// + [JsonProperty(PropertyName = "actionRequired")] + public string ActionRequired { get; set; } + + } +} diff --git a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/ProgressType.cs b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/ProgressType.cs new file mode 100644 index 000000000000..ce7213e595e1 --- /dev/null +++ b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/ProgressType.cs @@ -0,0 +1,25 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorageSync.Models +{ + + /// + /// Defines values for ProgressType. + /// + public static class ProgressType + { + public const string None = "none"; + public const string Initialize = "initialize"; + public const string Download = "download"; + public const string Upload = "upload"; + public const string Recall = "recall"; + } +} diff --git a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/RegisteredServer.cs b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/RegisteredServer.cs index a5d1bd72a26e..804ee3481f26 100644 --- a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/RegisteredServer.cs +++ b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/RegisteredServer.cs @@ -64,9 +64,10 @@ public RegisteredServer() /// Service Location /// Friendly Name /// Management Endpoint Uri + /// Telemetry Endpoint Uri /// Monitoring /// Configuration - public RegisteredServer(string id = default(string), string name = default(string), string type = default(string), string serverCertificate = default(string), string agentVersion = default(string), string serverOSVersion = default(string), int? serverManagementErrorCode = default(int?), string lastHeartBeat = default(string), string provisioningState = default(string), string serverRole = default(string), string clusterId = default(string), string clusterName = default(string), string serverId = default(string), string storageSyncServiceUid = default(string), string lastWorkflowId = default(string), string lastOperationName = default(string), string discoveryEndpointUri = default(string), string resourceLocation = default(string), string serviceLocation = default(string), string friendlyName = default(string), string managementEndpointUri = default(string), string monitoringConfiguration = default(string)) + public RegisteredServer(string id = default(string), string name = default(string), string type = default(string), string serverCertificate = default(string), string agentVersion = default(string), string serverOSVersion = default(string), int? serverManagementErrorCode = default(int?), string lastHeartBeat = default(string), string provisioningState = default(string), string serverRole = default(string), string clusterId = default(string), string clusterName = default(string), string serverId = default(string), string storageSyncServiceUid = default(string), string lastWorkflowId = default(string), string lastOperationName = default(string), string discoveryEndpointUri = default(string), string resourceLocation = default(string), string serviceLocation = default(string), string friendlyName = default(string), string managementEndpointUri = default(string), string monitoringEndpointUri = default(string), string monitoringConfiguration = default(string)) : base(id, name, type) { ServerCertificate = serverCertificate; @@ -87,6 +88,7 @@ public RegisteredServer() ServiceLocation = serviceLocation; FriendlyName = friendlyName; ManagementEndpointUri = managementEndpointUri; + MonitoringEndpointUri = monitoringEndpointUri; MonitoringConfiguration = monitoringConfiguration; CustomInit(); } @@ -204,6 +206,12 @@ public RegisteredServer() [JsonProperty(PropertyName = "properties.managementEndpointUri")] public string ManagementEndpointUri { get; set; } + /// + /// Gets or sets telemetry Endpoint Uri + /// + [JsonProperty(PropertyName = "properties.monitoringEndpointUri")] + public string MonitoringEndpointUri { get; set; } + /// /// Gets or sets monitoring Configuration /// diff --git a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/ServerEndpoint.cs b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/ServerEndpoint.cs index 48f357c8e2e1..01e7a9ac483f 100644 --- a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/ServerEndpoint.cs +++ b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/ServerEndpoint.cs @@ -65,7 +65,15 @@ public ServerEndpoint() /// populated if cloud tiering is enabled. /// Recall status. Only populated if cloud /// tiering is enabled. - public ServerEndpoint(string id = default(string), string name = default(string), string type = default(string), string serverLocalPath = default(string), string cloudTiering = default(string), int? volumeFreeSpacePercent = default(int?), int? tierFilesOlderThanDays = default(int?), string friendlyName = default(string), string serverResourceId = default(string), string provisioningState = default(string), string lastWorkflowId = default(string), string lastOperationName = default(string), ServerEndpointSyncStatus syncStatus = default(ServerEndpointSyncStatus), string offlineDataTransfer = default(string), string offlineDataTransferStorageAccountResourceId = default(string), string offlineDataTransferStorageAccountTenantId = default(string), string offlineDataTransferShareName = default(string), ServerEndpointCloudTieringStatus cloudTieringStatus = default(ServerEndpointCloudTieringStatus), ServerEndpointRecallStatus recallStatus = default(ServerEndpointRecallStatus)) + /// Policy for how namespace and + /// files are recalled during FastDr. Possible values include: + /// 'NamespaceOnly', 'NamespaceThenModifiedFiles', + /// 'AvoidTieredFiles' + /// Policy for enabling follow-the-sun + /// business models: link local cache to cloud behavior to pre-populate + /// before local access. Possible values include: + /// 'DownloadNewAndModifiedFiles', 'UpdateLocallyCachedFiles' + public ServerEndpoint(string id = default(string), string name = default(string), string type = default(string), string serverLocalPath = default(string), string cloudTiering = default(string), int? volumeFreeSpacePercent = default(int?), int? tierFilesOlderThanDays = default(int?), string friendlyName = default(string), string serverResourceId = default(string), string provisioningState = default(string), string lastWorkflowId = default(string), string lastOperationName = default(string), ServerEndpointSyncStatus syncStatus = default(ServerEndpointSyncStatus), string offlineDataTransfer = default(string), string offlineDataTransferStorageAccountResourceId = default(string), string offlineDataTransferStorageAccountTenantId = default(string), string offlineDataTransferShareName = default(string), ServerEndpointCloudTieringStatus cloudTieringStatus = default(ServerEndpointCloudTieringStatus), ServerEndpointRecallStatus recallStatus = default(ServerEndpointRecallStatus), InitialDownloadPolicy? initialDownloadPolicy = default(InitialDownloadPolicy?), LocalCacheMode? localCacheMode = default(LocalCacheMode?)) : base(id, name, type) { ServerLocalPath = serverLocalPath; @@ -84,6 +92,8 @@ public ServerEndpoint() OfflineDataTransferShareName = offlineDataTransferShareName; CloudTieringStatus = cloudTieringStatus; RecallStatus = recallStatus; + InitialDownloadPolicy = initialDownloadPolicy; + LocalCacheMode = localCacheMode; CustomInit(); } @@ -191,6 +201,23 @@ public ServerEndpoint() [JsonProperty(PropertyName = "properties.recallStatus")] public ServerEndpointRecallStatus RecallStatus { get; private set; } + /// + /// Gets or sets policy for how namespace and files are recalled during + /// FastDr. Possible values include: 'NamespaceOnly', + /// 'NamespaceThenModifiedFiles', 'AvoidTieredFiles' + /// + [JsonProperty(PropertyName = "properties.initialDownloadPolicy")] + public InitialDownloadPolicy? InitialDownloadPolicy { get; set; } + + /// + /// Gets or sets policy for enabling follow-the-sun business models: + /// link local cache to cloud behavior to pre-populate before local + /// access. Possible values include: 'DownloadNewAndModifiedFiles', + /// 'UpdateLocallyCachedFiles' + /// + [JsonProperty(PropertyName = "properties.localCacheMode")] + public LocalCacheMode? LocalCacheMode { get; set; } + /// /// Validate the object. /// @@ -219,6 +246,10 @@ public virtual void Validate() { SyncStatus.Validate(); } + if (CloudTieringStatus != null) + { + CloudTieringStatus.Validate(); + } if (RecallStatus != null) { RecallStatus.Validate(); diff --git a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/ServerEndpointCloudTieringHealthState.cs b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/ServerEndpointCloudTieringHealthState.cs new file mode 100644 index 000000000000..43d348af2913 --- /dev/null +++ b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/ServerEndpointCloudTieringHealthState.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.StorageSync.Models +{ + + /// + /// Defines values for ServerEndpointCloudTieringHealthState. + /// + public static class ServerEndpointCloudTieringHealthState + { + public const string Healthy = "Healthy"; + public const string Error = "Error"; + } +} diff --git a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/ServerEndpointCloudTieringStatus.cs b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/ServerEndpointCloudTieringStatus.cs index 6a87e1311163..eb7e65652b10 100644 --- a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/ServerEndpointCloudTieringStatus.cs +++ b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/ServerEndpointCloudTieringStatus.cs @@ -31,19 +31,36 @@ public ServerEndpointCloudTieringStatus() /// Initializes a new instance of the ServerEndpointCloudTieringStatus /// class. /// + /// Last updated timestamp /// Cloud tiering health state. Possible values /// include: 'Healthy', 'Error' - /// Last updated timestamp + /// The last updated timestamp + /// of health state /// Last cloud tiering result /// (HResult) /// Last cloud tiering success /// timestamp - public ServerEndpointCloudTieringStatus(string health = default(string), System.DateTime? lastUpdatedTimestamp = default(System.DateTime?), int? lastCloudTieringResult = default(int?), System.DateTime? lastSuccessTimestamp = default(System.DateTime?)) + /// Information regarding how much local + /// space cloud tiering is saving. + /// Information regarding how well the + /// local cache on the server is performing. + /// Information regarding files that + /// failed to be tiered + /// Status of the volume free + /// space policy + /// Status of the date policy + public ServerEndpointCloudTieringStatus(System.DateTime? lastUpdatedTimestamp = default(System.DateTime?), string health = default(string), System.DateTime? healthLastUpdatedTimestamp = default(System.DateTime?), int? lastCloudTieringResult = default(int?), System.DateTime? lastSuccessTimestamp = default(System.DateTime?), CloudTieringSpaceSavings spaceSavings = default(CloudTieringSpaceSavings), CloudTieringCachePerformance cachePerformance = default(CloudTieringCachePerformance), CloudTieringFilesNotTiering filesNotTiering = default(CloudTieringFilesNotTiering), CloudTieringVolumeFreeSpacePolicyStatus volumeFreeSpacePolicyStatus = default(CloudTieringVolumeFreeSpacePolicyStatus), CloudTieringDatePolicyStatus datePolicyStatus = default(CloudTieringDatePolicyStatus)) { - Health = health; LastUpdatedTimestamp = lastUpdatedTimestamp; + Health = health; + HealthLastUpdatedTimestamp = healthLastUpdatedTimestamp; LastCloudTieringResult = lastCloudTieringResult; LastSuccessTimestamp = lastSuccessTimestamp; + SpaceSavings = spaceSavings; + CachePerformance = cachePerformance; + FilesNotTiering = filesNotTiering; + VolumeFreeSpacePolicyStatus = volumeFreeSpacePolicyStatus; + DatePolicyStatus = datePolicyStatus; CustomInit(); } @@ -52,6 +69,12 @@ public ServerEndpointCloudTieringStatus() /// partial void CustomInit(); + /// + /// Gets last updated timestamp + /// + [JsonProperty(PropertyName = "lastUpdatedTimestamp")] + public System.DateTime? LastUpdatedTimestamp { get; private set; } + /// /// Gets cloud tiering health state. Possible values include: /// 'Healthy', 'Error' @@ -60,10 +83,10 @@ public ServerEndpointCloudTieringStatus() public string Health { get; private set; } /// - /// Gets last updated timestamp + /// Gets the last updated timestamp of health state /// - [JsonProperty(PropertyName = "lastUpdatedTimestamp")] - public System.DateTime? LastUpdatedTimestamp { get; private set; } + [JsonProperty(PropertyName = "healthLastUpdatedTimestamp")] + public System.DateTime? HealthLastUpdatedTimestamp { get; private set; } /// /// Gets last cloud tiering result (HResult) @@ -77,5 +100,62 @@ public ServerEndpointCloudTieringStatus() [JsonProperty(PropertyName = "lastSuccessTimestamp")] public System.DateTime? LastSuccessTimestamp { get; private set; } + /// + /// Gets information regarding how much local space cloud tiering is + /// saving. + /// + [JsonProperty(PropertyName = "spaceSavings")] + public CloudTieringSpaceSavings SpaceSavings { get; private set; } + + /// + /// Gets information regarding how well the local cache on the server + /// is performing. + /// + [JsonProperty(PropertyName = "cachePerformance")] + public CloudTieringCachePerformance CachePerformance { get; private set; } + + /// + /// Gets information regarding files that failed to be tiered + /// + [JsonProperty(PropertyName = "filesNotTiering")] + public CloudTieringFilesNotTiering FilesNotTiering { get; private set; } + + /// + /// Gets status of the volume free space policy + /// + [JsonProperty(PropertyName = "volumeFreeSpacePolicyStatus")] + public CloudTieringVolumeFreeSpacePolicyStatus VolumeFreeSpacePolicyStatus { get; private set; } + + /// + /// Gets status of the date policy + /// + [JsonProperty(PropertyName = "datePolicyStatus")] + public CloudTieringDatePolicyStatus DatePolicyStatus { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (SpaceSavings != null) + { + SpaceSavings.Validate(); + } + if (CachePerformance != null) + { + CachePerformance.Validate(); + } + if (FilesNotTiering != null) + { + FilesNotTiering.Validate(); + } + if (VolumeFreeSpacePolicyStatus != null) + { + VolumeFreeSpacePolicyStatus.Validate(); + } + } } } diff --git a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/ServerEndpointCreateParameters.cs b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/ServerEndpointCreateParameters.cs index 5d98bb368fbf..6afebdea3a71 100644 --- a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/ServerEndpointCreateParameters.cs +++ b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/ServerEndpointCreateParameters.cs @@ -53,7 +53,15 @@ public ServerEndpointCreateParameters() /// values include: 'on', 'off' /// Offline data transfer /// share name - public ServerEndpointCreateParameters(string id = default(string), string name = default(string), string type = default(string), string serverLocalPath = default(string), string cloudTiering = default(string), int? volumeFreeSpacePercent = default(int?), int? tierFilesOlderThanDays = default(int?), string friendlyName = default(string), string serverResourceId = default(string), string offlineDataTransfer = default(string), string offlineDataTransferShareName = default(string)) + /// Policy for how namespace and + /// files are recalled during FastDr. Possible values include: + /// 'NamespaceOnly', 'NamespaceThenModifiedFiles', + /// 'AvoidTieredFiles' + /// Policy for enabling follow-the-sun + /// business models: link local cache to cloud behavior to pre-populate + /// before local access. Possible values include: + /// 'DownloadNewAndModifiedFiles', 'UpdateLocallyCachedFiles' + public ServerEndpointCreateParameters(string id = default(string), string name = default(string), string type = default(string), string serverLocalPath = default(string), string cloudTiering = default(string), int? volumeFreeSpacePercent = default(int?), int? tierFilesOlderThanDays = default(int?), string friendlyName = default(string), string serverResourceId = default(string), string offlineDataTransfer = default(string), string offlineDataTransferShareName = default(string), InitialDownloadPolicy? initialDownloadPolicy = default(InitialDownloadPolicy?), LocalCacheMode? localCacheMode = default(LocalCacheMode?)) : base(id, name, type) { ServerLocalPath = serverLocalPath; @@ -64,6 +72,8 @@ public ServerEndpointCreateParameters() ServerResourceId = serverResourceId; OfflineDataTransfer = offlineDataTransfer; OfflineDataTransferShareName = offlineDataTransferShareName; + InitialDownloadPolicy = initialDownloadPolicy; + LocalCacheMode = localCacheMode; CustomInit(); } @@ -122,6 +132,23 @@ public ServerEndpointCreateParameters() [JsonProperty(PropertyName = "properties.offlineDataTransferShareName")] public string OfflineDataTransferShareName { get; set; } + /// + /// Gets or sets policy for how namespace and files are recalled during + /// FastDr. Possible values include: 'NamespaceOnly', + /// 'NamespaceThenModifiedFiles', 'AvoidTieredFiles' + /// + [JsonProperty(PropertyName = "properties.initialDownloadPolicy")] + public InitialDownloadPolicy? InitialDownloadPolicy { get; set; } + + /// + /// Gets or sets policy for enabling follow-the-sun business models: + /// link local cache to cloud behavior to pre-populate before local + /// access. Possible values include: 'DownloadNewAndModifiedFiles', + /// 'UpdateLocallyCachedFiles' + /// + [JsonProperty(PropertyName = "properties.localCacheMode")] + public LocalCacheMode? LocalCacheMode { get; set; } + /// /// Validate the object. /// diff --git a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/ServerEndpointOfflineDataTransferState.cs b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/ServerEndpointOfflineDataTransferState.cs new file mode 100644 index 000000000000..dc0a982ceaf0 --- /dev/null +++ b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/ServerEndpointOfflineDataTransferState.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.StorageSync.Models +{ + + /// + /// Defines values for ServerEndpointOfflineDataTransferState. + /// + public static class ServerEndpointOfflineDataTransferState + { + public const string InProgress = "InProgress"; + public const string Stopping = "Stopping"; + public const string NotRunning = "NotRunning"; + public const string Complete = "Complete"; + } +} diff --git a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/ServerEndpointSyncActivityState.cs b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/ServerEndpointSyncActivityState.cs new file mode 100644 index 000000000000..d13de43c4dde --- /dev/null +++ b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/ServerEndpointSyncActivityState.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.StorageSync.Models +{ + + /// + /// Defines values for ServerEndpointSyncActivityState. + /// + public static class ServerEndpointSyncActivityState + { + public const string Upload = "Upload"; + public const string Download = "Download"; + public const string UploadAndDownload = "UploadAndDownload"; + } +} diff --git a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/ServerEndpointSyncHealthState.cs b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/ServerEndpointSyncHealthState.cs new file mode 100644 index 000000000000..86d4107599bb --- /dev/null +++ b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/ServerEndpointSyncHealthState.cs @@ -0,0 +1,25 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorageSync.Models +{ + + /// + /// Defines values for ServerEndpointSyncHealthState. + /// + public static class ServerEndpointSyncHealthState + { + public const string Healthy = "Healthy"; + public const string Error = "Error"; + public const string SyncBlockedForRestore = "SyncBlockedForRestore"; + public const string SyncBlockedForChangeDetectionPostRestore = "SyncBlockedForChangeDetectionPostRestore"; + public const string NoActivity = "NoActivity"; + } +} diff --git a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/ServerEndpointUpdateParameters.cs b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/ServerEndpointUpdateParameters.cs index fe2fd814b70e..12936df8f5ed 100644 --- a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/ServerEndpointUpdateParameters.cs +++ b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/ServerEndpointUpdateParameters.cs @@ -44,13 +44,18 @@ public ServerEndpointUpdateParameters() /// values include: 'on', 'off' /// Offline data transfer /// share name - public ServerEndpointUpdateParameters(string cloudTiering = default(string), int? volumeFreeSpacePercent = default(int?), int? tierFilesOlderThanDays = default(int?), string offlineDataTransfer = default(string), string offlineDataTransferShareName = default(string)) + /// Policy for enabling follow-the-sun + /// business models: link local cache to cloud behavior to pre-populate + /// before local access. Possible values include: + /// 'DownloadNewAndModifiedFiles', 'UpdateLocallyCachedFiles' + public ServerEndpointUpdateParameters(string cloudTiering = default(string), int? volumeFreeSpacePercent = default(int?), int? tierFilesOlderThanDays = default(int?), string offlineDataTransfer = default(string), string offlineDataTransferShareName = default(string), LocalCacheMode? localCacheMode = default(LocalCacheMode?)) { CloudTiering = cloudTiering; VolumeFreeSpacePercent = volumeFreeSpacePercent; TierFilesOlderThanDays = tierFilesOlderThanDays; OfflineDataTransfer = offlineDataTransfer; OfflineDataTransferShareName = offlineDataTransferShareName; + LocalCacheMode = localCacheMode; CustomInit(); } @@ -91,6 +96,15 @@ public ServerEndpointUpdateParameters() [JsonProperty(PropertyName = "properties.offlineDataTransferShareName")] public string OfflineDataTransferShareName { get; set; } + /// + /// Gets or sets policy for enabling follow-the-sun business models: + /// link local cache to cloud behavior to pre-populate before local + /// access. Possible values include: 'DownloadNewAndModifiedFiles', + /// 'UpdateLocallyCachedFiles' + /// + [JsonProperty(PropertyName = "properties.localCacheMode")] + public LocalCacheMode? LocalCacheMode { get; set; } + /// /// Validate the object. /// diff --git a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/StorageSyncService.cs b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/StorageSyncService.cs index af1221cdd4ca..9f0d60fb1226 100644 --- a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/StorageSyncService.cs +++ b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/StorageSyncService.cs @@ -43,15 +43,32 @@ public StorageSyncService() /// Microsoft.Compute/virtualMachines or /// Microsoft.Storage/storageAccounts. /// Resource tags. + /// Incoming Traffic Policy. + /// Possible values include: 'AllowAllTraffic', + /// 'AllowVirtualNetworksOnly' /// Storage Sync service /// status. /// Storage Sync service /// Uid - public StorageSyncService(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), int? storageSyncServiceStatus = default(int?), string storageSyncServiceUid = default(string)) + /// StorageSyncService Provisioning + /// State + /// StorageSyncService + /// lastWorkflowId + /// Resource Last Operation + /// Name + /// List of private endpoint + /// connection associated with the specified storage sync + /// service + public StorageSyncService(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string incomingTrafficPolicy = default(string), int? storageSyncServiceStatus = default(int?), string storageSyncServiceUid = default(string), string provisioningState = default(string), string lastWorkflowId = default(string), string lastOperationName = default(string), IList privateEndpointConnections = default(IList)) : base(location, id, name, type, tags) { + IncomingTrafficPolicy = incomingTrafficPolicy; StorageSyncServiceStatus = storageSyncServiceStatus; StorageSyncServiceUid = storageSyncServiceUid; + ProvisioningState = provisioningState; + LastWorkflowId = lastWorkflowId; + LastOperationName = lastOperationName; + PrivateEndpointConnections = privateEndpointConnections; CustomInit(); } @@ -60,6 +77,13 @@ public StorageSyncService() /// partial void CustomInit(); + /// + /// Gets or sets incoming Traffic Policy. Possible values include: + /// 'AllowAllTraffic', 'AllowVirtualNetworksOnly' + /// + [JsonProperty(PropertyName = "properties.incomingTrafficPolicy")] + public string IncomingTrafficPolicy { get; set; } + /// /// Gets storage Sync service status. /// @@ -72,6 +96,31 @@ public StorageSyncService() [JsonProperty(PropertyName = "properties.storageSyncServiceUid")] public string StorageSyncServiceUid { get; private set; } + /// + /// Gets storageSyncService Provisioning State + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets storageSyncService lastWorkflowId + /// + [JsonProperty(PropertyName = "properties.lastWorkflowId")] + public string LastWorkflowId { get; private set; } + + /// + /// Gets resource Last Operation Name + /// + [JsonProperty(PropertyName = "properties.lastOperationName")] + public string LastOperationName { get; private set; } + + /// + /// Gets list of private endpoint connection associated with the + /// specified storage sync service + /// + [JsonProperty(PropertyName = "properties.privateEndpointConnections")] + public IList PrivateEndpointConnections { get; private set; } + /// /// Validate the object. /// @@ -81,6 +130,16 @@ public StorageSyncService() public override void Validate() { base.Validate(); + if (PrivateEndpointConnections != null) + { + foreach (var element in PrivateEndpointConnections) + { + if (element != null) + { + element.Validate(); + } + } + } } } } diff --git a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/StorageSyncServiceCreateParameters.cs b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/StorageSyncServiceCreateParameters.cs index a455ce37eccc..f3cbef85dece 100644 --- a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/StorageSyncServiceCreateParameters.cs +++ b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/StorageSyncServiceCreateParameters.cs @@ -11,6 +11,7 @@ namespace Microsoft.Azure.Management.StorageSync.Models { using Microsoft.Rest; + using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; @@ -19,6 +20,7 @@ namespace Microsoft.Azure.Management.StorageSync.Models /// /// The parameters used when creating a storage sync service. /// + [Rest.Serialization.JsonTransformation] public partial class StorageSyncServiceCreateParameters { /// @@ -46,11 +48,14 @@ public StorageSyncServiceCreateParameters() /// tags can be provided for a resource. Each tag must have a key with /// a length no greater than 128 characters and a value with a length /// no greater than 256 characters. - public StorageSyncServiceCreateParameters(string location, IDictionary tags = default(IDictionary), object properties = default(object)) + /// Incoming Traffic Policy. + /// Possible values include: 'AllowAllTraffic', + /// 'AllowVirtualNetworksOnly' + public StorageSyncServiceCreateParameters(string location, IDictionary tags = default(IDictionary), string incomingTrafficPolicy = default(string)) { Location = location; Tags = tags; - Properties = properties; + IncomingTrafficPolicy = incomingTrafficPolicy; CustomInit(); } @@ -81,9 +86,11 @@ public StorageSyncServiceCreateParameters() public IDictionary Tags { get; set; } /// + /// Gets or sets incoming Traffic Policy. Possible values include: + /// 'AllowAllTraffic', 'AllowVirtualNetworksOnly' /// - [JsonProperty(PropertyName = "properties")] - public object Properties { get; set; } + [JsonProperty(PropertyName = "properties.incomingTrafficPolicy")] + public string IncomingTrafficPolicy { get; set; } /// /// Validate the object. diff --git a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/StorageSyncServiceUpdateParameters.cs b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/StorageSyncServiceUpdateParameters.cs index 80705ebddee1..0f1897e48c80 100644 --- a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/StorageSyncServiceUpdateParameters.cs +++ b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/StorageSyncServiceUpdateParameters.cs @@ -10,6 +10,8 @@ namespace Microsoft.Azure.Management.StorageSync.Models { + using Microsoft.Rest; + using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; @@ -18,6 +20,7 @@ namespace Microsoft.Azure.Management.StorageSync.Models /// /// Parameters for updating an Storage sync service. /// + [Rest.Serialization.JsonTransformation] public partial class StorageSyncServiceUpdateParameters { /// @@ -35,12 +38,13 @@ public StorageSyncServiceUpdateParameters() /// /// The user-specified tags associated with the /// storage sync service. - /// The properties of the storage sync - /// service. - public StorageSyncServiceUpdateParameters(IDictionary tags = default(IDictionary), object properties = default(object)) + /// Incoming Traffic Policy. + /// Possible values include: 'AllowAllTraffic', + /// 'AllowVirtualNetworksOnly' + public StorageSyncServiceUpdateParameters(IDictionary tags = default(IDictionary), string incomingTrafficPolicy = default(string)) { Tags = tags; - Properties = properties; + IncomingTrafficPolicy = incomingTrafficPolicy; CustomInit(); } @@ -57,10 +61,11 @@ public StorageSyncServiceUpdateParameters() public IDictionary Tags { get; set; } /// - /// Gets or sets the properties of the storage sync service. + /// Gets or sets incoming Traffic Policy. Possible values include: + /// 'AllowAllTraffic', 'AllowVirtualNetworksOnly' /// - [JsonProperty(PropertyName = "properties")] - public object Properties { get; set; } + [JsonProperty(PropertyName = "properties.incomingTrafficPolicy")] + public string IncomingTrafficPolicy { get; set; } } } diff --git a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/StorageSyncServicesCreateHeaders.cs b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/StorageSyncServicesCreateHeaders.cs new file mode 100644 index 000000000000..b276e266afa6 --- /dev/null +++ b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/StorageSyncServicesCreateHeaders.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.StorageSync.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Create operation. + /// + public partial class StorageSyncServicesCreateHeaders + { + /// + /// Initializes a new instance of the StorageSyncServicesCreateHeaders + /// class. + /// + public StorageSyncServicesCreateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the StorageSyncServicesCreateHeaders + /// class. + /// + /// Operation Status Location + /// URI + /// Operation Status Location URI + /// Retry After + /// Request id + /// correlation request + /// id + public StorageSyncServicesCreateHeaders(string azureAsyncOperation = default(string), string location = default(string), string retryAfter = default(string), string xMsRequestId = default(string), string xMsCorrelationRequestId = default(string)) + { + AzureAsyncOperation = azureAsyncOperation; + Location = location; + RetryAfter = retryAfter; + XMsRequestId = xMsRequestId; + XMsCorrelationRequestId = xMsCorrelationRequestId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets operation Status Location URI + /// + [JsonProperty(PropertyName = "Azure-AsyncOperation")] + public string AzureAsyncOperation { get; set; } + + /// + /// Gets or sets operation Status Location URI + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + /// + /// Gets or sets retry After + /// + [JsonProperty(PropertyName = "Retry-After")] + public string RetryAfter { get; set; } + + /// + /// Gets or sets request id + /// + [JsonProperty(PropertyName = "x-ms-request-id")] + public string XMsRequestId { get; set; } + + /// + /// Gets or sets correlation request id + /// + [JsonProperty(PropertyName = "x-ms-correlation-request-id")] + public string XMsCorrelationRequestId { get; set; } + + } +} diff --git a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/StorageSyncServicesDeleteHeaders.cs b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/StorageSyncServicesDeleteHeaders.cs index f667bd4c719b..a466c7330f95 100644 --- a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/StorageSyncServicesDeleteHeaders.cs +++ b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/StorageSyncServicesDeleteHeaders.cs @@ -31,13 +31,20 @@ public StorageSyncServicesDeleteHeaders() /// Initializes a new instance of the StorageSyncServicesDeleteHeaders /// class. /// - /// request id. + /// Request id /// correlation request - /// id. - public StorageSyncServicesDeleteHeaders(string xMsRequestId = default(string), string xMsCorrelationRequestId = default(string)) + /// id + /// Operation Status Location + /// URI + /// Operation Status Location URI + /// Retry After + public StorageSyncServicesDeleteHeaders(string xMsRequestId = default(string), string xMsCorrelationRequestId = default(string), string azureAsyncOperation = default(string), string location = default(string), string retryAfter = default(string)) { XMsRequestId = xMsRequestId; XMsCorrelationRequestId = xMsCorrelationRequestId; + AzureAsyncOperation = azureAsyncOperation; + Location = location; + RetryAfter = retryAfter; CustomInit(); } @@ -47,16 +54,34 @@ public StorageSyncServicesDeleteHeaders() partial void CustomInit(); /// - /// Gets or sets request id. + /// Gets or sets request id /// [JsonProperty(PropertyName = "x-ms-request-id")] public string XMsRequestId { get; set; } /// - /// Gets or sets correlation request id. + /// Gets or sets correlation request id /// [JsonProperty(PropertyName = "x-ms-correlation-request-id")] public string XMsCorrelationRequestId { get; set; } + /// + /// Gets or sets operation Status Location URI + /// + [JsonProperty(PropertyName = "Azure-AsyncOperation")] + public string AzureAsyncOperation { get; set; } + + /// + /// Gets or sets operation Status Location URI + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + /// + /// Gets or sets retry After + /// + [JsonProperty(PropertyName = "Retry-After")] + public string RetryAfter { get; set; } + } } diff --git a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/StorageSyncServicesUpdateHeaders.cs b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/StorageSyncServicesUpdateHeaders.cs index 8f3f7f78a5fc..f4aa3045ede2 100644 --- a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/StorageSyncServicesUpdateHeaders.cs +++ b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/StorageSyncServicesUpdateHeaders.cs @@ -31,13 +31,20 @@ public StorageSyncServicesUpdateHeaders() /// Initializes a new instance of the StorageSyncServicesUpdateHeaders /// class. /// - /// request id. + /// Request id /// correlation request - /// id. - public StorageSyncServicesUpdateHeaders(string xMsRequestId = default(string), string xMsCorrelationRequestId = default(string)) + /// id + /// Operation Status Location + /// URI + /// Operation Status Location URI + /// Retry After + public StorageSyncServicesUpdateHeaders(string xMsRequestId = default(string), string xMsCorrelationRequestId = default(string), string azureAsyncOperation = default(string), string location = default(string), string retryAfter = default(string)) { XMsRequestId = xMsRequestId; XMsCorrelationRequestId = xMsCorrelationRequestId; + AzureAsyncOperation = azureAsyncOperation; + Location = location; + RetryAfter = retryAfter; CustomInit(); } @@ -47,16 +54,34 @@ public StorageSyncServicesUpdateHeaders() partial void CustomInit(); /// - /// Gets or sets request id. + /// Gets or sets request id /// [JsonProperty(PropertyName = "x-ms-request-id")] public string XMsRequestId { get; set; } /// - /// Gets or sets correlation request id. + /// Gets or sets correlation request id /// [JsonProperty(PropertyName = "x-ms-correlation-request-id")] public string XMsCorrelationRequestId { get; set; } + /// + /// Gets or sets operation Status Location URI + /// + [JsonProperty(PropertyName = "Azure-AsyncOperation")] + public string AzureAsyncOperation { get; set; } + + /// + /// Gets or sets operation Status Location URI + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + /// + /// Gets or sets retry After + /// + [JsonProperty(PropertyName = "Retry-After")] + public string RetryAfter { get; set; } + } } diff --git a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/WorkflowStatus.cs b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/WorkflowStatus.cs new file mode 100644 index 000000000000..96e362b0e067 --- /dev/null +++ b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/Models/WorkflowStatus.cs @@ -0,0 +1,25 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorageSync.Models +{ + + /// + /// Defines values for WorkflowStatus. + /// + public static class WorkflowStatus + { + public const string Active = "active"; + public const string Expired = "expired"; + public const string Succeeded = "succeeded"; + public const string Aborted = "aborted"; + public const string Failed = "failed"; + } +} diff --git a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/PrivateEndpointConnectionsOperations.cs b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/PrivateEndpointConnectionsOperations.cs new file mode 100644 index 000000000000..82590d593516 --- /dev/null +++ b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/PrivateEndpointConnectionsOperations.cs @@ -0,0 +1,1065 @@ +// +// 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.StorageSync +{ + 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; + + /// + /// PrivateEndpointConnectionsOperations operations. + /// + internal partial class PrivateEndpointConnectionsOperations : IServiceOperations, IPrivateEndpointConnectionsOperations + { + /// + /// Initializes a new instance of the PrivateEndpointConnectionsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal PrivateEndpointConnectionsOperations(StorageSyncManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the StorageSyncManagementClient + /// + public StorageSyncManagementClient Client { get; private set; } + + /// + /// Gets the specified private endpoint connection associated with the storage + /// sync service. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the storage sync service name within the specified resource + /// group. + /// + /// + /// The name of the private endpoint connection associated with the Azure + /// 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 storageSyncServiceName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (storageSyncServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "storageSyncServiceName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (privateEndpointConnectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnectionName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("storageSyncServiceName", storageSyncServiceName); + tracingParameters.Add("privateEndpointConnectionName", privateEndpointConnectionName); + 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.StorageSync/storageSyncServices/{storageSyncServiceName}/privateEndpointConnections/{privateEndpointConnectionName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{storageSyncServiceName}", System.Uri.EscapeDataString(storageSyncServiceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{privateEndpointConnectionName}", System.Uri.EscapeDataString(privateEndpointConnectionName)); + 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 StorageSyncErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + StorageSyncError _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; + } + + /// + /// Update the state of specified private endpoint connection associated with + /// the storage sync service. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the storage sync service name within the specified resource + /// group. + /// + /// + /// The name of the private endpoint connection associated with the Azure + /// resource + /// + /// + /// The private endpoint connection properties. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateWithHttpMessagesAsync(string resourceGroupName, string storageSyncServiceName, string privateEndpointConnectionName, PrivateEndpointConnection properties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateWithHttpMessagesAsync(resourceGroupName, storageSyncServiceName, privateEndpointConnectionName, properties, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes the specified private endpoint connection associated with the + /// storage sync service. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the storage sync service name within the specified resource + /// group. + /// + /// + /// The name of the private endpoint connection associated with the Azure + /// resource + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> DeleteWithHttpMessagesAsync(string resourceGroupName, string storageSyncServiceName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationHeaderResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, storageSyncServiceName, privateEndpointConnectionName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a PrivateEndpointConnection List. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Storage Sync 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,PrivateEndpointConnectionsListByStorageSyncServiceHeaders>> ListByStorageSyncServiceWithHttpMessagesAsync(string resourceGroupName, string storageSyncServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (storageSyncServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "storageSyncServiceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("storageSyncServiceName", storageSyncServiceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByStorageSyncService", 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.StorageSync/storageSyncServices/{storageSyncServiceName}/privateEndpointConnections").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{storageSyncServiceName}", System.Uri.EscapeDataString(storageSyncServiceName)); + 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 StorageSyncErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + StorageSyncError _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,PrivateEndpointConnectionsListByStorageSyncServiceHeaders>(); + _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); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Update the state of specified private endpoint connection associated with + /// the storage sync service. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the storage sync service name within the specified resource + /// group. + /// + /// + /// The name of the private endpoint connection associated with the Azure + /// resource + /// + /// + /// The private endpoint connection properties. + /// + /// + /// 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 storageSyncServiceName, string privateEndpointConnectionName, PrivateEndpointConnection properties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (storageSyncServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "storageSyncServiceName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (privateEndpointConnectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnectionName"); + } + if (properties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "properties"); + } + if (properties != null) + { + properties.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("storageSyncServiceName", storageSyncServiceName); + tracingParameters.Add("privateEndpointConnectionName", privateEndpointConnectionName); + tracingParameters.Add("properties", properties); + 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.StorageSync/storageSyncServices/{storageSyncServiceName}/privateEndpointConnections/{privateEndpointConnectionName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{storageSyncServiceName}", System.Uri.EscapeDataString(storageSyncServiceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{privateEndpointConnectionName}", System.Uri.EscapeDataString(privateEndpointConnectionName)); + 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(properties != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(properties, 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 StorageSyncErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + StorageSyncError _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); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes the specified private endpoint connection associated with the + /// storage sync service. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the storage sync service name within the specified resource + /// group. + /// + /// + /// The name of the private endpoint connection associated with the Azure + /// 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 storageSyncServiceName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (storageSyncServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "storageSyncServiceName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (privateEndpointConnectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnectionName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("storageSyncServiceName", storageSyncServiceName); + tracingParameters.Add("privateEndpointConnectionName", privateEndpointConnectionName); + 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.StorageSync/storageSyncServices/{storageSyncServiceName}/privateEndpointConnections/{privateEndpointConnectionName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{storageSyncServiceName}", System.Uri.EscapeDataString(storageSyncServiceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{privateEndpointConnectionName}", System.Uri.EscapeDataString(privateEndpointConnectionName)); + 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 StorageSyncErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + StorageSyncError _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 AzureOperationHeaderResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/PrivateEndpointConnectionsOperationsExtensions.cs b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/PrivateEndpointConnectionsOperationsExtensions.cs new file mode 100644 index 000000000000..b5ac86d388e0 --- /dev/null +++ b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/PrivateEndpointConnectionsOperationsExtensions.cs @@ -0,0 +1,339 @@ +// +// 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.StorageSync +{ + 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 PrivateEndpointConnectionsOperations. + /// + public static partial class PrivateEndpointConnectionsOperationsExtensions + { + /// + /// Gets the specified private endpoint connection associated with the storage + /// sync service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the storage sync service name within the specified resource + /// group. + /// + /// + /// The name of the private endpoint connection associated with the Azure + /// resource + /// + public static PrivateEndpointConnection Get(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string storageSyncServiceName, string privateEndpointConnectionName) + { + return operations.GetAsync(resourceGroupName, storageSyncServiceName, privateEndpointConnectionName).GetAwaiter().GetResult(); + } + + /// + /// Gets the specified private endpoint connection associated with the storage + /// sync service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the storage sync service name within the specified resource + /// group. + /// + /// + /// The name of the private endpoint connection associated with the Azure + /// resource + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string storageSyncServiceName, string privateEndpointConnectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, storageSyncServiceName, privateEndpointConnectionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update the state of specified private endpoint connection associated with + /// the storage sync service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the storage sync service name within the specified resource + /// group. + /// + /// + /// The name of the private endpoint connection associated with the Azure + /// resource + /// + /// + /// The private endpoint connection properties. + /// + public static PrivateEndpointConnection Create(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string storageSyncServiceName, string privateEndpointConnectionName, PrivateEndpointConnection properties) + { + return operations.CreateAsync(resourceGroupName, storageSyncServiceName, privateEndpointConnectionName, properties).GetAwaiter().GetResult(); + } + + /// + /// Update the state of specified private endpoint connection associated with + /// the storage sync service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the storage sync service name within the specified resource + /// group. + /// + /// + /// The name of the private endpoint connection associated with the Azure + /// resource + /// + /// + /// The private endpoint connection properties. + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string storageSyncServiceName, string privateEndpointConnectionName, PrivateEndpointConnection properties, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, storageSyncServiceName, privateEndpointConnectionName, properties, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the specified private endpoint connection associated with the + /// storage sync service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the storage sync service name within the specified resource + /// group. + /// + /// + /// The name of the private endpoint connection associated with the Azure + /// resource + /// + public static PrivateEndpointConnectionsDeleteHeaders Delete(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string storageSyncServiceName, string privateEndpointConnectionName) + { + return operations.DeleteAsync(resourceGroupName, storageSyncServiceName, privateEndpointConnectionName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the specified private endpoint connection associated with the + /// storage sync service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the storage sync service name within the specified resource + /// group. + /// + /// + /// The name of the private endpoint connection associated with the Azure + /// resource + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string storageSyncServiceName, string privateEndpointConnectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(resourceGroupName, storageSyncServiceName, privateEndpointConnectionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Headers; + } + } + + /// + /// Get a PrivateEndpointConnection List. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Storage Sync Service resource. + /// + public static IEnumerable ListByStorageSyncService(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string storageSyncServiceName) + { + return operations.ListByStorageSyncServiceAsync(resourceGroupName, storageSyncServiceName).GetAwaiter().GetResult(); + } + + /// + /// Get a PrivateEndpointConnection List. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Storage Sync Service resource. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByStorageSyncServiceAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string storageSyncServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByStorageSyncServiceWithHttpMessagesAsync(resourceGroupName, storageSyncServiceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update the state of specified private endpoint connection associated with + /// the storage sync service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the storage sync service name within the specified resource + /// group. + /// + /// + /// The name of the private endpoint connection associated with the Azure + /// resource + /// + /// + /// The private endpoint connection properties. + /// + public static PrivateEndpointConnection BeginCreate(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string storageSyncServiceName, string privateEndpointConnectionName, PrivateEndpointConnection properties) + { + return operations.BeginCreateAsync(resourceGroupName, storageSyncServiceName, privateEndpointConnectionName, properties).GetAwaiter().GetResult(); + } + + /// + /// Update the state of specified private endpoint connection associated with + /// the storage sync service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the storage sync service name within the specified resource + /// group. + /// + /// + /// The name of the private endpoint connection associated with the Azure + /// resource + /// + /// + /// The private endpoint connection properties. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string storageSyncServiceName, string privateEndpointConnectionName, PrivateEndpointConnection properties, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateWithHttpMessagesAsync(resourceGroupName, storageSyncServiceName, privateEndpointConnectionName, properties, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the specified private endpoint connection associated with the + /// storage sync service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the storage sync service name within the specified resource + /// group. + /// + /// + /// The name of the private endpoint connection associated with the Azure + /// resource + /// + public static PrivateEndpointConnectionsDeleteHeaders BeginDelete(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string storageSyncServiceName, string privateEndpointConnectionName) + { + return operations.BeginDeleteAsync(resourceGroupName, storageSyncServiceName, privateEndpointConnectionName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the specified private endpoint connection associated with the + /// storage sync service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the storage sync service name within the specified resource + /// group. + /// + /// + /// The name of the private endpoint connection associated with the Azure + /// resource + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string storageSyncServiceName, string privateEndpointConnectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, storageSyncServiceName, privateEndpointConnectionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Headers; + } + } + + } +} diff --git a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/PrivateLinkResourcesOperations.cs b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/PrivateLinkResourcesOperations.cs new file mode 100644 index 000000000000..0a5150fc0d07 --- /dev/null +++ b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/PrivateLinkResourcesOperations.cs @@ -0,0 +1,281 @@ +// +// 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.StorageSync +{ + 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; + + /// + /// PrivateLinkResourcesOperations operations. + /// + internal partial class PrivateLinkResourcesOperations : IServiceOperations, IPrivateLinkResourcesOperations + { + /// + /// Initializes a new instance of the PrivateLinkResourcesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal PrivateLinkResourcesOperations(StorageSyncManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the StorageSyncManagementClient + /// + public StorageSyncManagementClient Client { get; private set; } + + /// + /// Gets the private link resources that need to be created for a storage sync + /// service. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the storage sync service name within the specified 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> ListByStorageSyncServiceWithHttpMessagesAsync(string resourceGroupName, string storageSyncServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (storageSyncServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "storageSyncServiceName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("storageSyncServiceName", storageSyncServiceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByStorageSyncService", 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.StorageSync/storageSyncServices/{storageSyncServiceName}/privateLinkResources").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{storageSyncServiceName}", System.Uri.EscapeDataString(storageSyncServiceName)); + _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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + 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/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/PrivateLinkResourcesOperationsExtensions.cs b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/PrivateLinkResourcesOperationsExtensions.cs new file mode 100644 index 000000000000..fe5fee95570f --- /dev/null +++ b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/PrivateLinkResourcesOperationsExtensions.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.StorageSync +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for PrivateLinkResourcesOperations. + /// + public static partial class PrivateLinkResourcesOperationsExtensions + { + /// + /// Gets the private link resources that need to be created for a storage sync + /// service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the storage sync service name within the specified resource + /// group. + /// + public static PrivateLinkResourceListResult ListByStorageSyncService(this IPrivateLinkResourcesOperations operations, string resourceGroupName, string storageSyncServiceName) + { + return operations.ListByStorageSyncServiceAsync(resourceGroupName, storageSyncServiceName).GetAwaiter().GetResult(); + } + + /// + /// Gets the private link resources that need to be created for a storage sync + /// service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the storage sync service name within the specified resource + /// group. + /// + /// + /// The cancellation token. + /// + public static async Task ListByStorageSyncServiceAsync(this IPrivateLinkResourcesOperations operations, string resourceGroupName, string storageSyncServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByStorageSyncServiceWithHttpMessagesAsync(resourceGroupName, storageSyncServiceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/SdkInfo_MicrosoftStorageSync.cs b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/SdkInfo_MicrosoftStorageSync.cs index a1fefb8997e4..1e1de329c712 100644 --- a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/SdkInfo_MicrosoftStorageSync.cs +++ b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/SdkInfo_MicrosoftStorageSync.cs @@ -19,27 +19,18 @@ public static IEnumerable> ApiInfo_MicrosoftStorag { return new Tuple[] { - new Tuple("StorageSync", "CloudEndpoints", "2019-06-01"), - new Tuple("StorageSync", "OperationStatus", "2019-06-01"), - new Tuple("StorageSync", "Operations", "2019-06-01"), - new Tuple("StorageSync", "RegisteredServers", "2019-06-01"), - new Tuple("StorageSync", "ServerEndpoints", "2019-06-01"), - new Tuple("StorageSync", "StorageSyncServices", "2019-06-01"), - new Tuple("StorageSync", "SyncGroups", "2019-06-01"), - new Tuple("StorageSync", "Workflows", "2019-06-01"), + new Tuple("StorageSync", "CloudEndpoints", "2020-03-01"), + new Tuple("StorageSync", "OperationStatus", "2020-03-01"), + new Tuple("StorageSync", "Operations", "2020-03-01"), + new Tuple("StorageSync", "PrivateEndpointConnections", "2020-03-01"), + new Tuple("StorageSync", "PrivateLinkResources", "2020-03-01"), + new Tuple("StorageSync", "RegisteredServers", "2020-03-01"), + new Tuple("StorageSync", "ServerEndpoints", "2020-03-01"), + new Tuple("StorageSync", "StorageSyncServices", "2020-03-01"), + new Tuple("StorageSync", "SyncGroups", "2020-03-01"), + new Tuple("StorageSync", "Workflows", "2020-03-01"), }.AsEnumerable(); } } - // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "latest"; - public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4407"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/storagesync/resource-manager/readme.md --csharp --version=latest --reflect-api-versions --csharp-sdks-folder=D:\\github\\anpint\\azure-sdk-for-net\\sdk"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "c42f3f3427766255b06a01846e1ec497c4d3c94a"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } - diff --git a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/StorageSyncManagementClient.cs b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/StorageSyncManagementClient.cs index 3c3fb7bd74ec..5989ae25e427 100644 --- a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/StorageSyncManagementClient.cs +++ b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/StorageSyncManagementClient.cs @@ -84,6 +84,16 @@ public partial class StorageSyncManagementClient : ServiceClient public virtual IStorageSyncServicesOperations StorageSyncServices { get; private set; } + /// + /// Gets the IPrivateLinkResourcesOperations. + /// + public virtual IPrivateLinkResourcesOperations PrivateLinkResources { get; private set; } + + /// + /// Gets the IPrivateEndpointConnectionsOperations. + /// + public virtual IPrivateEndpointConnectionsOperations PrivateEndpointConnections { get; private set; } + /// /// Gets the ISyncGroupsOperations. /// @@ -357,6 +367,8 @@ private void Initialize() { Operations = new Operations(this); StorageSyncServices = new StorageSyncServicesOperations(this); + PrivateLinkResources = new PrivateLinkResourcesOperations(this); + PrivateEndpointConnections = new PrivateEndpointConnectionsOperations(this); SyncGroups = new SyncGroupsOperations(this); CloudEndpoints = new CloudEndpointsOperations(this); ServerEndpoints = new ServerEndpointsOperations(this); @@ -364,7 +376,7 @@ private void Initialize() Workflows = new WorkflowsOperations(this); OperationStatus = new OperationStatusOperations(this); BaseUri = new System.Uri("https://management.azure.com"); - ApiVersion = "2019-06-01"; + ApiVersion = "2020-03-01"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; diff --git a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/StorageSyncServicesOperations.cs b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/StorageSyncServicesOperations.cs index 804c446d95f9..c23b6ea7ec09 100644 --- a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/StorageSyncServicesOperations.cs +++ b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/StorageSyncServicesOperations.cs @@ -283,6 +283,28 @@ internal StorageSyncServicesOperations(StorageSyncManagementClient client) /// Storage Sync Service resource name. /// /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateWithHttpMessagesAsync(string resourceGroupName, string storageSyncServiceName, StorageSyncServiceCreateParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateWithHttpMessagesAsync(resourceGroupName, storageSyncServiceName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a given StorageSyncService. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Storage Sync Service resource. + /// + /// /// Headers that will be added to request. /// /// @@ -303,7 +325,7 @@ internal StorageSyncServicesOperations(StorageSyncManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateWithHttpMessagesAsync(string resourceGroupName, string storageSyncServiceName, StorageSyncServiceCreateParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string storageSyncServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { @@ -335,6 +357,10 @@ internal StorageSyncServicesOperations(StorageSyncManagementClient client) throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); } } + if (storageSyncServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "storageSyncServiceName"); + } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); @@ -346,18 +372,6 @@ internal StorageSyncServicesOperations(StorageSyncManagementClient client) throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); } } - if (storageSyncServiceName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "storageSyncServiceName"); - } - if (parameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); - } - if (parameters != null) - { - parameters.Validate(); - } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -367,9 +381,8 @@ internal StorageSyncServicesOperations(StorageSyncManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("storageSyncServiceName", storageSyncServiceName); - tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; @@ -389,7 +402,7 @@ internal StorageSyncServicesOperations(StorageSyncManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -420,12 +433,6 @@ internal StorageSyncServicesOperations(StorageSyncManagementClient client) // 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) { @@ -476,7 +483,7 @@ internal StorageSyncServicesOperations(StorageSyncManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -501,6 +508,19 @@ internal StorageSyncServicesOperations(StorageSyncManagementClient client) throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -509,7 +529,7 @@ internal StorageSyncServicesOperations(StorageSyncManagementClient client) } /// - /// Get a given StorageSyncService. + /// Patch a given StorageSyncService. /// /// /// The name of the resource group. The name is case insensitive. @@ -517,6 +537,50 @@ internal StorageSyncServicesOperations(StorageSyncManagementClient client) /// /// Name of Storage Sync Service resource. /// + /// + /// Storage Sync Service resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string storageSyncServiceName, StorageSyncServiceUpdateParameters parameters = default(StorageSyncServiceUpdateParameters), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, storageSyncServiceName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Delete a given StorageSyncService. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Storage Sync Service resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> DeleteWithHttpMessagesAsync(string resourceGroupName, string storageSyncServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationHeaderResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, storageSyncServiceName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a StorageSyncService list by Resource group name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// /// /// Headers that will be added to request. /// @@ -538,7 +602,7 @@ internal StorageSyncServicesOperations(StorageSyncManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string storageSyncServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task,StorageSyncServicesListByResourceGroupHeaders>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { @@ -570,10 +634,6 @@ internal StorageSyncServicesOperations(StorageSyncManagementClient client) throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); } } - if (storageSyncServiceName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "storageSyncServiceName"); - } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); @@ -593,16 +653,14 @@ internal StorageSyncServicesOperations(StorageSyncManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("storageSyncServiceName", storageSyncServiceName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + 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.StorageSync/storageSyncServices/{storageSyncServiceName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{storageSyncServiceName}", System.Uri.EscapeDataString(storageSyncServiceName)); List _queryParameters = new List(); if (Client.ApiVersion != null) { @@ -696,7 +754,7 @@ internal StorageSyncServicesOperations(StorageSyncManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse,StorageSyncServicesListByResourceGroupHeaders>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -709,7 +767,7 @@ internal StorageSyncServicesOperations(StorageSyncManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -723,7 +781,7 @@ internal StorageSyncServicesOperations(StorageSyncManagementClient client) } try { - _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); } catch (JsonException ex) { @@ -742,17 +800,8 @@ internal StorageSyncServicesOperations(StorageSyncManagementClient client) } /// - /// Patch a given StorageSyncService. + /// Get a StorageSyncService list by subscription. /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// Name of Storage Sync Service resource. - /// - /// - /// Storage Sync Service resource. - /// /// /// Headers that will be added to request. /// @@ -774,7 +823,7 @@ internal StorageSyncServicesOperations(StorageSyncManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string storageSyncServiceName, StorageSyncServiceUpdateParameters parameters = default(StorageSyncServiceUpdateParameters), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task,StorageSyncServicesListBySubscriptionHeaders>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { @@ -787,25 +836,6 @@ internal StorageSyncServicesOperations(StorageSyncManagementClient client) throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); } } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (resourceGroupName != null) - { - if (resourceGroupName.Length > 90) - { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); - } - if (resourceGroupName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) - { - throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); - } - } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); @@ -817,10 +847,6 @@ internal StorageSyncServicesOperations(StorageSyncManagementClient client) throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); } } - if (storageSyncServiceName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "storageSyncServiceName"); - } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -828,18 +854,13 @@ internal StorageSyncServicesOperations(StorageSyncManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("storageSyncServiceName", storageSyncServiceName); - tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + 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}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.StorageSync/storageSyncServices").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{storageSyncServiceName}", System.Uri.EscapeDataString(storageSyncServiceName)); List _queryParameters = new List(); if (Client.ApiVersion != null) { @@ -852,7 +873,7 @@ internal StorageSyncServicesOperations(StorageSyncManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -883,12 +904,6 @@ internal StorageSyncServicesOperations(StorageSyncManagementClient client) // 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) { @@ -939,7 +954,7 @@ internal StorageSyncServicesOperations(StorageSyncManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse,StorageSyncServicesListBySubscriptionHeaders>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -952,7 +967,7 @@ internal StorageSyncServicesOperations(StorageSyncManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -966,7 +981,7 @@ internal StorageSyncServicesOperations(StorageSyncManagementClient client) } try { - _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); } catch (JsonException ex) { @@ -985,7 +1000,7 @@ internal StorageSyncServicesOperations(StorageSyncManagementClient client) } /// - /// Delete a given StorageSyncService. + /// Create a new StorageSyncService. /// /// /// The name of the resource group. The name is case insensitive. @@ -993,6 +1008,9 @@ internal StorageSyncServicesOperations(StorageSyncManagementClient client) /// /// Name of Storage Sync Service resource. /// + /// + /// Storage Sync Service resource name. + /// /// /// Headers that will be added to request. /// @@ -1002,6 +1020,9 @@ internal StorageSyncServicesOperations(StorageSyncManagementClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// @@ -1011,7 +1032,7 @@ internal StorageSyncServicesOperations(StorageSyncManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> DeleteWithHttpMessagesAsync(string resourceGroupName, string storageSyncServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string storageSyncServiceName, StorageSyncServiceCreateParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { @@ -1058,6 +1079,14 @@ internal StorageSyncServicesOperations(StorageSyncManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "storageSyncServiceName"); } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1067,8 +1096,9 @@ internal StorageSyncServicesOperations(StorageSyncManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("storageSyncServiceName", storageSyncServiceName); + tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreate", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; @@ -1088,7 +1118,7 @@ internal StorageSyncServicesOperations(StorageSyncManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.Method = new HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -1119,6 +1149,12 @@ internal StorageSyncServicesOperations(StorageSyncManagementClient client) // 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) { @@ -1139,7 +1175,7 @@ internal StorageSyncServicesOperations(StorageSyncManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 204) + if ((int)_statusCode != 200 && (int)_statusCode != 202) { var ex = new StorageSyncErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -1169,16 +1205,34 @@ internal StorageSyncServicesOperations(StorageSyncManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationHeaderResponse(); + 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); + } + } try { - _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); } catch (JsonException ex) { @@ -1197,11 +1251,17 @@ internal StorageSyncServicesOperations(StorageSyncManagementClient client) } /// - /// Get a StorageSyncService list by Resource group name. + /// Patch a given StorageSyncService. /// /// /// The name of the resource group. The name is case insensitive. /// + /// + /// Name of Storage Sync Service resource. + /// + /// + /// Storage Sync Service resource. + /// /// /// Headers that will be added to request. /// @@ -1223,7 +1283,7 @@ internal StorageSyncServicesOperations(StorageSyncManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task,StorageSyncServicesListByResourceGroupHeaders>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string storageSyncServiceName, StorageSyncServiceUpdateParameters parameters = default(StorageSyncServiceUpdateParameters), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { @@ -1266,6 +1326,10 @@ internal StorageSyncServicesOperations(StorageSyncManagementClient client) throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); } } + if (storageSyncServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "storageSyncServiceName"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1274,14 +1338,17 @@ internal StorageSyncServicesOperations(StorageSyncManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("storageSyncServiceName", storageSyncServiceName); + tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", 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.StorageSync/storageSyncServices").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{storageSyncServiceName}", System.Uri.EscapeDataString(storageSyncServiceName)); List _queryParameters = new List(); if (Client.ApiVersion != null) { @@ -1294,7 +1361,7 @@ internal StorageSyncServicesOperations(StorageSyncManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.Method = new HttpMethod("PATCH"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -1325,6 +1392,12 @@ internal StorageSyncServicesOperations(StorageSyncManagementClient client) // 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) { @@ -1345,7 +1418,7 @@ internal StorageSyncServicesOperations(StorageSyncManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 200 && (int)_statusCode != 202) { var ex = new StorageSyncErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -1375,7 +1448,7 @@ internal StorageSyncServicesOperations(StorageSyncManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse,StorageSyncServicesListByResourceGroupHeaders>(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -1388,7 +1461,7 @@ internal StorageSyncServicesOperations(StorageSyncManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -1402,7 +1475,7 @@ internal StorageSyncServicesOperations(StorageSyncManagementClient client) } try { - _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); } catch (JsonException ex) { @@ -1421,8 +1494,14 @@ internal StorageSyncServicesOperations(StorageSyncManagementClient client) } /// - /// Get a StorageSyncService list by subscription. + /// Delete a given StorageSyncService. /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Storage Sync Service resource. + /// /// /// Headers that will be added to request. /// @@ -1432,9 +1511,6 @@ internal StorageSyncServicesOperations(StorageSyncManagementClient client) /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// /// /// Thrown when a required parameter is null /// @@ -1444,7 +1520,7 @@ internal StorageSyncServicesOperations(StorageSyncManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task,StorageSyncServicesListBySubscriptionHeaders>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string storageSyncServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { @@ -1457,6 +1533,25 @@ internal StorageSyncServicesOperations(StorageSyncManagementClient client) throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); } } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); @@ -1468,6 +1563,10 @@ internal StorageSyncServicesOperations(StorageSyncManagementClient client) throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); } } + if (storageSyncServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "storageSyncServiceName"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1475,13 +1574,17 @@ internal StorageSyncServicesOperations(StorageSyncManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("storageSyncServiceName", storageSyncServiceName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters); + 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}/providers/Microsoft.StorageSync/storageSyncServices").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{storageSyncServiceName}", System.Uri.EscapeDataString(storageSyncServiceName)); List _queryParameters = new List(); if (Client.ApiVersion != null) { @@ -1494,7 +1597,7 @@ internal StorageSyncServicesOperations(StorageSyncManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.Method = new HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -1545,7 +1648,7 @@ internal StorageSyncServicesOperations(StorageSyncManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) { var ex = new StorageSyncErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -1575,34 +1678,16 @@ internal StorageSyncServicesOperations(StorageSyncManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse,StorageSyncServicesListBySubscriptionHeaders>(); + var _result = new AzureOperationHeaderResponse(); _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); - } - } try { - _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); } catch (JsonException ex) { diff --git a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/StorageSyncServicesOperationsExtensions.cs b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/StorageSyncServicesOperationsExtensions.cs index 891274f71e0e..36e5035fa46e 100644 --- a/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/StorageSyncServicesOperationsExtensions.cs +++ b/sdk/storagesync/Microsoft.Azure.Management.StorageSync/src/Generated/StorageSyncServicesOperationsExtensions.cs @@ -297,5 +297,137 @@ public static IEnumerable ListBySubscription(this IStorageSy } } + /// + /// Create a new StorageSyncService. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Storage Sync Service resource. + /// + /// + /// Storage Sync Service resource name. + /// + public static StorageSyncService BeginCreate(this IStorageSyncServicesOperations operations, string resourceGroupName, string storageSyncServiceName, StorageSyncServiceCreateParameters parameters) + { + return operations.BeginCreateAsync(resourceGroupName, storageSyncServiceName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Create a new StorageSyncService. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Storage Sync Service resource. + /// + /// + /// Storage Sync Service resource name. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateAsync(this IStorageSyncServicesOperations operations, string resourceGroupName, string storageSyncServiceName, StorageSyncServiceCreateParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateWithHttpMessagesAsync(resourceGroupName, storageSyncServiceName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Patch a given StorageSyncService. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Storage Sync Service resource. + /// + /// + /// Storage Sync Service resource. + /// + public static StorageSyncService BeginUpdate(this IStorageSyncServicesOperations operations, string resourceGroupName, string storageSyncServiceName, StorageSyncServiceUpdateParameters parameters = default(StorageSyncServiceUpdateParameters)) + { + return operations.BeginUpdateAsync(resourceGroupName, storageSyncServiceName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Patch a given StorageSyncService. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Storage Sync Service resource. + /// + /// + /// Storage Sync Service resource. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IStorageSyncServicesOperations operations, string resourceGroupName, string storageSyncServiceName, StorageSyncServiceUpdateParameters parameters = default(StorageSyncServiceUpdateParameters), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, storageSyncServiceName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a given StorageSyncService. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Storage Sync Service resource. + /// + public static StorageSyncServicesDeleteHeaders BeginDelete(this IStorageSyncServicesOperations operations, string resourceGroupName, string storageSyncServiceName) + { + return operations.BeginDeleteAsync(resourceGroupName, storageSyncServiceName).GetAwaiter().GetResult(); + } + + /// + /// Delete a given StorageSyncService. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Storage Sync Service resource. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IStorageSyncServicesOperations operations, string resourceGroupName, string storageSyncServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, storageSyncServiceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Headers; + } + } + } }