diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/CHANGELOG.md b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/CHANGELOG.md index 6b275e76061c..323f018c814c 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/CHANGELOG.md +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/CHANGELOG.md @@ -1,14 +1,11 @@ # Release History -## 1.0.0-beta.5 (Unreleased) +## 1.0.0-beta.5 (2023-10-27) ### Features Added -### Breaking Changes - -### Bugs Fixed - -### Other Changes +- Upgraded to API version 2023-01-01 +- Supported snapshot and CMK for ElasticSan ## 1.0.0-beta.4 (2023-07-31) diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/api/Azure.ResourceManager.ElasticSan.netstandard2.0.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/api/Azure.ResourceManager.ElasticSan.netstandard2.0.cs index 2be0b5d7b632..60c04175cd75 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/api/Azure.ResourceManager.ElasticSan.netstandard2.0.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/api/Azure.ResourceManager.ElasticSan.netstandard2.0.cs @@ -25,6 +25,7 @@ public ElasticSanData(Azure.Core.AzureLocation location, Azure.ResourceManager.E public long ExtendedCapacitySizeTiB { get { throw null; } set { } } public System.Collections.Generic.IReadOnlyList PrivateEndpointConnections { get { throw null; } } public Azure.ResourceManager.ElasticSan.Models.ElasticSanProvisioningState? ProvisioningState { get { throw null; } } + public Azure.ResourceManager.ElasticSan.Models.PublicNetworkAccess? PublicNetworkAccess { get { throw null; } set { } } public Azure.ResourceManager.ElasticSan.Models.ElasticSanSku Sku { get { throw null; } set { } } public long? TotalIops { get { throw null; } } public long? TotalMbps { get { throw null; } } @@ -41,6 +42,7 @@ public static partial class ElasticSanExtensions public static Azure.ResourceManager.ElasticSan.ElasticSanCollection GetElasticSans(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } public static Azure.Pageable GetElasticSans(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.AsyncPageable GetElasticSansAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.ElasticSan.ElasticSanSnapshotResource GetElasticSanSnapshotResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } public static Azure.ResourceManager.ElasticSan.ElasticSanVolumeGroupResource GetElasticSanVolumeGroupResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } public static Azure.ResourceManager.ElasticSan.ElasticSanVolumeResource GetElasticSanVolumeResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } public static Azure.Pageable GetSkus(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -113,6 +115,45 @@ protected ElasticSanResource() { } public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.ElasticSan.Models.ElasticSanPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.ElasticSan.Models.ElasticSanPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } + public partial class ElasticSanSnapshotCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected ElasticSanSnapshotCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string snapshotName, Azure.ResourceManager.ElasticSan.ElasticSanSnapshotData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string snapshotName, Azure.ResourceManager.ElasticSan.ElasticSanSnapshotData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string snapshotName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string snapshotName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string snapshotName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string snapshotName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string snapshotName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string snapshotName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public partial class ElasticSanSnapshotData : Azure.ResourceManager.Models.ResourceData + { + public ElasticSanSnapshotData(Azure.ResourceManager.ElasticSan.Models.SnapshotCreationData creationData) { } + public Azure.Core.ResourceIdentifier CreationDataSourceId { get { throw null; } set { } } + public Azure.ResourceManager.ElasticSan.Models.ElasticSanProvisioningState? ProvisioningState { get { throw null; } } + public long? SourceVolumeSizeGiB { get { throw null; } } + public string VolumeName { get { throw null; } } + } + public partial class ElasticSanSnapshotResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected ElasticSanSnapshotResource() { } + public virtual Azure.ResourceManager.ElasticSan.ElasticSanSnapshotData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string snapshotName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.ElasticSan.ElasticSanSnapshotData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.ElasticSan.ElasticSanSnapshotData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } public partial class ElasticSanVolumeCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable { protected ElasticSanVolumeCollection() { } @@ -134,6 +175,8 @@ public partial class ElasticSanVolumeData : Azure.ResourceManager.Models.Resourc { public ElasticSanVolumeData(long sizeGiB) { } public Azure.ResourceManager.ElasticSan.Models.ElasticSanVolumeDataSourceInfo CreationData { get { throw null; } set { } } + public Azure.Core.ResourceIdentifier ManagedByResourceId { get { throw null; } set { } } + public Azure.ResourceManager.ElasticSan.Models.ElasticSanProvisioningState? ProvisioningState { get { throw null; } } public long SizeGiB { get { throw null; } set { } } public Azure.ResourceManager.ElasticSan.Models.IscsiTargetInfo StorageTarget { get { throw null; } } public System.Guid? VolumeId { get { throw null; } } @@ -159,6 +202,8 @@ public partial class ElasticSanVolumeGroupData : Azure.ResourceManager.Models.Re { public ElasticSanVolumeGroupData() { } public Azure.ResourceManager.ElasticSan.Models.ElasticSanEncryptionType? Encryption { get { throw null; } set { } } + public Azure.ResourceManager.ElasticSan.Models.EncryptionProperties EncryptionProperties { get { throw null; } set { } } + public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public System.Collections.Generic.IReadOnlyList PrivateEndpointConnections { get { throw null; } } public Azure.ResourceManager.ElasticSan.Models.StorageTargetType? ProtocolType { get { throw null; } set { } } public Azure.ResourceManager.ElasticSan.Models.ElasticSanProvisioningState? ProvisioningState { get { throw null; } } @@ -175,6 +220,9 @@ protected ElasticSanVolumeGroupResource() { } public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetElasticSanSnapshot(string snapshotName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetElasticSanSnapshotAsync(string snapshotName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ElasticSan.ElasticSanSnapshotCollection GetElasticSanSnapshots() { throw null; } public virtual Azure.Response GetElasticSanVolume(string volumeName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetElasticSanVolumeAsync(string volumeName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.ResourceManager.ElasticSan.ElasticSanVolumeCollection GetElasticSanVolumes() { throw null; } @@ -188,8 +236,8 @@ protected ElasticSanVolumeResource() { } public virtual Azure.ResourceManager.ElasticSan.ElasticSanVolumeData Data { get { throw null; } } public virtual bool HasData { get { throw null; } } public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string volumeName) { throw null; } - public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, Azure.ResourceManager.ElasticSan.Models.XMsDeleteSnapshot? xMsDeleteSnapshots = default(Azure.ResourceManager.ElasticSan.Models.XMsDeleteSnapshot?), Azure.ResourceManager.ElasticSan.Models.XMsForceDelete? xMsForceDelete = default(Azure.ResourceManager.ElasticSan.Models.XMsForceDelete?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.ElasticSan.Models.XMsDeleteSnapshot? xMsDeleteSnapshots = default(Azure.ResourceManager.ElasticSan.Models.XMsDeleteSnapshot?), Azure.ResourceManager.ElasticSan.Models.XMsForceDelete? xMsForceDelete = default(Azure.ResourceManager.ElasticSan.Models.XMsForceDelete?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.ElasticSan.Models.ElasticSanVolumePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -200,16 +248,17 @@ namespace Azure.ResourceManager.ElasticSan.Models { public static partial class ArmElasticSanModelFactory { - public static Azure.ResourceManager.ElasticSan.ElasticSanData ElasticSanData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.ElasticSan.Models.ElasticSanSku sku = null, System.Collections.Generic.IEnumerable availabilityZones = null, Azure.ResourceManager.ElasticSan.Models.ElasticSanProvisioningState? provisioningState = default(Azure.ResourceManager.ElasticSan.Models.ElasticSanProvisioningState?), long baseSizeTiB = (long)0, long extendedCapacitySizeTiB = (long)0, long? totalVolumeSizeGiB = default(long?), long? volumeGroupCount = default(long?), long? totalIops = default(long?), long? totalMbps = default(long?), long? totalSizeTiB = default(long?), System.Collections.Generic.IEnumerable privateEndpointConnections = null) { throw null; } + public static Azure.ResourceManager.ElasticSan.ElasticSanData ElasticSanData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.ElasticSan.Models.ElasticSanSku sku = null, System.Collections.Generic.IEnumerable availabilityZones = null, Azure.ResourceManager.ElasticSan.Models.ElasticSanProvisioningState? provisioningState = default(Azure.ResourceManager.ElasticSan.Models.ElasticSanProvisioningState?), long baseSizeTiB = (long)0, long extendedCapacitySizeTiB = (long)0, long? totalVolumeSizeGiB = default(long?), long? volumeGroupCount = default(long?), long? totalIops = default(long?), long? totalMbps = default(long?), long? totalSizeTiB = default(long?), System.Collections.Generic.IEnumerable privateEndpointConnections = null, Azure.ResourceManager.ElasticSan.Models.PublicNetworkAccess? publicNetworkAccess = default(Azure.ResourceManager.ElasticSan.Models.PublicNetworkAccess?)) { throw null; } public static Azure.ResourceManager.ElasticSan.ElasticSanPrivateEndpointConnectionData ElasticSanPrivateEndpointConnectionData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.ElasticSan.Models.ElasticSanProvisioningState? provisioningState = default(Azure.ResourceManager.ElasticSan.Models.ElasticSanProvisioningState?), Azure.Core.ResourceIdentifier privateEndpointId = null, Azure.ResourceManager.ElasticSan.Models.ElasticSanPrivateLinkServiceConnectionState connectionState = null, System.Collections.Generic.IEnumerable groupIds = null) { throw null; } public static Azure.ResourceManager.ElasticSan.Models.ElasticSanPrivateLinkResource ElasticSanPrivateLinkResource(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string groupId = null, System.Collections.Generic.IEnumerable requiredMembers = null, System.Collections.Generic.IEnumerable requiredZoneNames = null) { throw null; } public static Azure.ResourceManager.ElasticSan.Models.ElasticSanSkuCapability ElasticSanSkuCapability(string name = null, string value = null) { throw null; } public static Azure.ResourceManager.ElasticSan.Models.ElasticSanSkuInformation ElasticSanSkuInformation(Azure.ResourceManager.ElasticSan.Models.ElasticSanSkuName name = default(Azure.ResourceManager.ElasticSan.Models.ElasticSanSkuName), Azure.ResourceManager.ElasticSan.Models.ElasticSanSkuTier? tier = default(Azure.ResourceManager.ElasticSan.Models.ElasticSanSkuTier?), string resourceType = null, System.Collections.Generic.IEnumerable locations = null, System.Collections.Generic.IEnumerable locationInfo = null, System.Collections.Generic.IEnumerable capabilities = null) { throw null; } public static Azure.ResourceManager.ElasticSan.Models.ElasticSanSkuLocationInfo ElasticSanSkuLocationInfo(Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), System.Collections.Generic.IEnumerable zones = null) { throw null; } - public static Azure.ResourceManager.ElasticSan.Models.ElasticSanVirtualNetworkRule ElasticSanVirtualNetworkRule(Azure.Core.ResourceIdentifier virtualNetworkResourceId = null, Azure.ResourceManager.ElasticSan.Models.ElasticSanVirtualNetworkRuleAction? action = default(Azure.ResourceManager.ElasticSan.Models.ElasticSanVirtualNetworkRuleAction?), Azure.ResourceManager.ElasticSan.Models.ElasticSanVirtualNetworkRuleState? state = default(Azure.ResourceManager.ElasticSan.Models.ElasticSanVirtualNetworkRuleState?)) { throw null; } - public static Azure.ResourceManager.ElasticSan.ElasticSanVolumeData ElasticSanVolumeData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Guid? volumeId = default(System.Guid?), Azure.ResourceManager.ElasticSan.Models.ElasticSanVolumeDataSourceInfo creationData = null, long sizeGiB = (long)0, Azure.ResourceManager.ElasticSan.Models.IscsiTargetInfo storageTarget = null) { throw null; } - public static Azure.ResourceManager.ElasticSan.ElasticSanVolumeGroupData ElasticSanVolumeGroupData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.ElasticSan.Models.ElasticSanProvisioningState? provisioningState = default(Azure.ResourceManager.ElasticSan.Models.ElasticSanProvisioningState?), Azure.ResourceManager.ElasticSan.Models.StorageTargetType? protocolType = default(Azure.ResourceManager.ElasticSan.Models.StorageTargetType?), Azure.ResourceManager.ElasticSan.Models.ElasticSanEncryptionType? encryption = default(Azure.ResourceManager.ElasticSan.Models.ElasticSanEncryptionType?), System.Collections.Generic.IEnumerable virtualNetworkRules = null, System.Collections.Generic.IEnumerable privateEndpointConnections = null) { throw null; } + public static Azure.ResourceManager.ElasticSan.ElasticSanSnapshotData ElasticSanSnapshotData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.Core.ResourceIdentifier creationDataSourceId = null, Azure.ResourceManager.ElasticSan.Models.ElasticSanProvisioningState? provisioningState = default(Azure.ResourceManager.ElasticSan.Models.ElasticSanProvisioningState?), long? sourceVolumeSizeGiB = default(long?), string volumeName = null) { throw null; } + public static Azure.ResourceManager.ElasticSan.ElasticSanVolumeData ElasticSanVolumeData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Guid? volumeId = default(System.Guid?), Azure.ResourceManager.ElasticSan.Models.ElasticSanVolumeDataSourceInfo creationData = null, long sizeGiB = (long)0, Azure.ResourceManager.ElasticSan.Models.IscsiTargetInfo storageTarget = null, Azure.Core.ResourceIdentifier managedByResourceId = null, Azure.ResourceManager.ElasticSan.Models.ElasticSanProvisioningState? provisioningState = default(Azure.ResourceManager.ElasticSan.Models.ElasticSanProvisioningState?)) { throw null; } + public static Azure.ResourceManager.ElasticSan.ElasticSanVolumeGroupData ElasticSanVolumeGroupData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.Models.ManagedServiceIdentity identity = null, Azure.ResourceManager.ElasticSan.Models.ElasticSanProvisioningState? provisioningState = default(Azure.ResourceManager.ElasticSan.Models.ElasticSanProvisioningState?), Azure.ResourceManager.ElasticSan.Models.StorageTargetType? protocolType = default(Azure.ResourceManager.ElasticSan.Models.StorageTargetType?), Azure.ResourceManager.ElasticSan.Models.ElasticSanEncryptionType? encryption = default(Azure.ResourceManager.ElasticSan.Models.ElasticSanEncryptionType?), Azure.ResourceManager.ElasticSan.Models.EncryptionProperties encryptionProperties = null, System.Collections.Generic.IEnumerable virtualNetworkRules = null, System.Collections.Generic.IEnumerable privateEndpointConnections = null) { throw null; } public static Azure.ResourceManager.ElasticSan.Models.IscsiTargetInfo IscsiTargetInfo(string targetIqn = null, string targetPortalHostname = null, int? targetPortalPort = default(int?), Azure.ResourceManager.ElasticSan.Models.ElasticSanProvisioningState? provisioningState = default(Azure.ResourceManager.ElasticSan.Models.ElasticSanProvisioningState?), Azure.ResourceManager.ElasticSan.Models.ResourceOperationalStatus? status = default(Azure.ResourceManager.ElasticSan.Models.ResourceOperationalStatus?)) { throw null; } + public static Azure.ResourceManager.ElasticSan.Models.KeyVaultProperties KeyVaultProperties(string keyName = null, string keyVersion = null, System.Uri keyVaultUri = null, string currentVersionedKeyIdentifier = null, System.DateTimeOffset? lastKeyRotationTimestamp = default(System.DateTimeOffset?), System.DateTimeOffset? currentVersionedKeyExpirationTimestamp = default(System.DateTimeOffset?)) { throw null; } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct ElasticSanEncryptionType : System.IEquatable @@ -217,6 +266,7 @@ public static partial class ArmElasticSanModelFactory private readonly object _dummy; private readonly int _dummyPrimitive; public ElasticSanEncryptionType(string value) { throw null; } + public static Azure.ResourceManager.ElasticSan.Models.ElasticSanEncryptionType EncryptionAtRestWithCustomerManagedKey { get { throw null; } } public static Azure.ResourceManager.ElasticSan.Models.ElasticSanEncryptionType EncryptionAtRestWithPlatformKey { get { throw null; } } public bool Equals(Azure.ResourceManager.ElasticSan.Models.ElasticSanEncryptionType other) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] @@ -233,6 +283,7 @@ public partial class ElasticSanPatch public ElasticSanPatch() { } public long? BaseSizeTiB { get { throw null; } set { } } public long? ExtendedCapacitySizeTiB { get { throw null; } set { } } + public Azure.ResourceManager.ElasticSan.Models.PublicNetworkAccess? PublicNetworkAccess { get { throw null; } set { } } public System.Collections.Generic.IDictionary Tags { get { throw null; } } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] @@ -360,7 +411,6 @@ public partial class ElasticSanVirtualNetworkRule { public ElasticSanVirtualNetworkRule(Azure.Core.ResourceIdentifier virtualNetworkResourceId) { } public Azure.ResourceManager.ElasticSan.Models.ElasticSanVirtualNetworkRuleAction? Action { get { throw null; } set { } } - public Azure.ResourceManager.ElasticSan.Models.ElasticSanVirtualNetworkRuleState? State { get { throw null; } } public Azure.Core.ResourceIdentifier VirtualNetworkResourceId { get { throw null; } set { } } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] @@ -380,21 +430,17 @@ public ElasticSanVirtualNetworkRule(Azure.Core.ResourceIdentifier virtualNetwork public static bool operator !=(Azure.ResourceManager.ElasticSan.Models.ElasticSanVirtualNetworkRuleAction left, Azure.ResourceManager.ElasticSan.Models.ElasticSanVirtualNetworkRuleAction right) { throw null; } public override string ToString() { throw null; } } - public enum ElasticSanVirtualNetworkRuleState - { - Provisioning = 0, - Deprovisioning = 1, - Succeeded = 2, - Failed = 3, - NetworkSourceDeleted = 4, - } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct ElasticSanVolumeCreateOption : System.IEquatable { private readonly object _dummy; private readonly int _dummyPrimitive; public ElasticSanVolumeCreateOption(string value) { throw null; } + public static Azure.ResourceManager.ElasticSan.Models.ElasticSanVolumeCreateOption Disk { get { throw null; } } + public static Azure.ResourceManager.ElasticSan.Models.ElasticSanVolumeCreateOption DiskRestorePoint { get { throw null; } } + public static Azure.ResourceManager.ElasticSan.Models.ElasticSanVolumeCreateOption DiskSnapshot { get { throw null; } } public static Azure.ResourceManager.ElasticSan.Models.ElasticSanVolumeCreateOption None { get { throw null; } } + public static Azure.ResourceManager.ElasticSan.Models.ElasticSanVolumeCreateOption VolumeSnapshot { get { throw null; } } public bool Equals(Azure.ResourceManager.ElasticSan.Models.ElasticSanVolumeCreateOption other) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public override bool Equals(object obj) { throw null; } @@ -409,20 +455,29 @@ public partial class ElasticSanVolumeDataSourceInfo { public ElasticSanVolumeDataSourceInfo() { } public Azure.ResourceManager.ElasticSan.Models.ElasticSanVolumeCreateOption? CreateSource { get { throw null; } set { } } - public System.Uri SourceUri { get { throw null; } set { } } + public Azure.Core.ResourceIdentifier SourceId { get { throw null; } set { } } } public partial class ElasticSanVolumeGroupPatch { public ElasticSanVolumeGroupPatch() { } public Azure.ResourceManager.ElasticSan.Models.ElasticSanEncryptionType? Encryption { get { throw null; } set { } } + public Azure.ResourceManager.ElasticSan.Models.EncryptionProperties EncryptionProperties { get { throw null; } set { } } + public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.ElasticSan.Models.StorageTargetType? ProtocolType { get { throw null; } set { } } public System.Collections.Generic.IList VirtualNetworkRules { get { throw null; } } } public partial class ElasticSanVolumePatch { public ElasticSanVolumePatch() { } + public Azure.Core.ResourceIdentifier ManagedByResourceId { get { throw null; } set { } } public long? SizeGiB { get { throw null; } set { } } } + public partial class EncryptionProperties + { + public EncryptionProperties() { } + public string EncryptionUserAssignedIdentity { get { throw null; } set { } } + public Azure.ResourceManager.ElasticSan.Models.KeyVaultProperties KeyVaultProperties { get { throw null; } set { } } + } public partial class IscsiTargetInfo { internal IscsiTargetInfo() { } @@ -432,6 +487,34 @@ internal IscsiTargetInfo() { } public string TargetPortalHostname { get { throw null; } } public int? TargetPortalPort { get { throw null; } } } + public partial class KeyVaultProperties + { + public KeyVaultProperties() { } + public System.DateTimeOffset? CurrentVersionedKeyExpirationTimestamp { get { throw null; } } + public string CurrentVersionedKeyIdentifier { get { throw null; } } + public string KeyName { get { throw null; } set { } } + public System.Uri KeyVaultUri { get { throw null; } set { } } + public string KeyVersion { get { throw null; } set { } } + public System.DateTimeOffset? LastKeyRotationTimestamp { get { throw null; } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct PublicNetworkAccess : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public PublicNetworkAccess(string value) { throw null; } + public static Azure.ResourceManager.ElasticSan.Models.PublicNetworkAccess Disabled { get { throw null; } } + public static Azure.ResourceManager.ElasticSan.Models.PublicNetworkAccess Enabled { get { throw null; } } + public bool Equals(Azure.ResourceManager.ElasticSan.Models.PublicNetworkAccess other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.ElasticSan.Models.PublicNetworkAccess left, Azure.ResourceManager.ElasticSan.Models.PublicNetworkAccess right) { throw null; } + public static implicit operator Azure.ResourceManager.ElasticSan.Models.PublicNetworkAccess (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.ElasticSan.Models.PublicNetworkAccess left, Azure.ResourceManager.ElasticSan.Models.PublicNetworkAccess right) { throw null; } + public override string ToString() { throw null; } + } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct ResourceOperationalStatus : System.IEquatable { @@ -456,6 +539,11 @@ internal IscsiTargetInfo() { } public static bool operator !=(Azure.ResourceManager.ElasticSan.Models.ResourceOperationalStatus left, Azure.ResourceManager.ElasticSan.Models.ResourceOperationalStatus right) { throw null; } public override string ToString() { throw null; } } + public partial class SnapshotCreationData + { + public SnapshotCreationData(Azure.Core.ResourceIdentifier sourceId) { } + public Azure.Core.ResourceIdentifier SourceId { get { throw null; } set { } } + } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct StorageTargetType : System.IEquatable { @@ -474,4 +562,40 @@ internal IscsiTargetInfo() { } public static bool operator !=(Azure.ResourceManager.ElasticSan.Models.StorageTargetType left, Azure.ResourceManager.ElasticSan.Models.StorageTargetType right) { throw null; } public override string ToString() { throw null; } } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct XMsDeleteSnapshot : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public XMsDeleteSnapshot(string value) { throw null; } + public static Azure.ResourceManager.ElasticSan.Models.XMsDeleteSnapshot False { get { throw null; } } + public static Azure.ResourceManager.ElasticSan.Models.XMsDeleteSnapshot True { get { throw null; } } + public bool Equals(Azure.ResourceManager.ElasticSan.Models.XMsDeleteSnapshot other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.ElasticSan.Models.XMsDeleteSnapshot left, Azure.ResourceManager.ElasticSan.Models.XMsDeleteSnapshot right) { throw null; } + public static implicit operator Azure.ResourceManager.ElasticSan.Models.XMsDeleteSnapshot (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.ElasticSan.Models.XMsDeleteSnapshot left, Azure.ResourceManager.ElasticSan.Models.XMsDeleteSnapshot right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct XMsForceDelete : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public XMsForceDelete(string value) { throw null; } + public static Azure.ResourceManager.ElasticSan.Models.XMsForceDelete False { get { throw null; } } + public static Azure.ResourceManager.ElasticSan.Models.XMsForceDelete True { get { throw null; } } + public bool Equals(Azure.ResourceManager.ElasticSan.Models.XMsForceDelete other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.ElasticSan.Models.XMsForceDelete left, Azure.ResourceManager.ElasticSan.Models.XMsForceDelete right) { throw null; } + public static implicit operator Azure.ResourceManager.ElasticSan.Models.XMsForceDelete (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.ElasticSan.Models.XMsForceDelete left, Azure.ResourceManager.ElasticSan.Models.XMsForceDelete right) { throw null; } + public override string ToString() { throw null; } + } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/assets.json b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/assets.json index 1c614d0950da..8681f4b83632 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/assets.json +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "net", "TagPrefix": "net/elasticsan/Azure.ResourceManager.ElasticSan", - "Tag": "net/elasticsan/Azure.ResourceManager.ElasticSan_229c79a266" + "Tag": "net/elasticsan/Azure.ResourceManager.ElasticSan_d7981da140" } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanCollection.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanCollection.cs index e5d955b8f081..8059f61aa254 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanCollection.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanCollection.cs @@ -24,7 +24,7 @@ public partial class Sample_ElasticSanCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ElasticSansListByResourceGroupMaximumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/ElasticSans_ListByResourceGroup_MaximumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/ElasticSans_ListByResourceGroup_MaximumSet_Gen.json // this example is just showing the usage of "ElasticSans_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -60,7 +60,7 @@ public async Task GetAll_ElasticSansListByResourceGroupMaximumSetGen() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ElasticSansListByResourceGroupMinimumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/ElasticSans_ListByResourceGroup_MinimumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/ElasticSans_ListByResourceGroup_MinimumSet_Gen.json // this example is just showing the usage of "ElasticSans_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -96,7 +96,7 @@ public async Task GetAll_ElasticSansListByResourceGroupMinimumSetGen() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ElasticSansCreateMaximumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/ElasticSans_Create_MaximumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/ElasticSans_Create_MaximumSet_Gen.json // this example is just showing the usage of "ElasticSans_Create" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -116,7 +116,7 @@ public async Task CreateOrUpdate_ElasticSansCreateMaximumSetGen() // invoke the operation string elasticSanName = "elasticsanname"; - ElasticSanData data = new ElasticSanData(new AzureLocation("South Central US"), new ElasticSanSku(ElasticSanSkuName.PremiumLrs) + ElasticSanData data = new ElasticSanData(new AzureLocation("France Central"), new ElasticSanSku(ElasticSanSkuName.PremiumLrs) { Tier = ElasticSanSkuTier.Premium, }, 5, 25) @@ -125,6 +125,7 @@ public async Task CreateOrUpdate_ElasticSansCreateMaximumSetGen() { "1" }, + PublicNetworkAccess = PublicNetworkAccess.Enabled, Tags = { ["key9316"] = "ihndtieqibtob", @@ -145,7 +146,7 @@ public async Task CreateOrUpdate_ElasticSansCreateMaximumSetGen() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ElasticSansCreateMinimumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/ElasticSans_Create_MinimumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/ElasticSans_Create_MinimumSet_Gen.json // this example is just showing the usage of "ElasticSans_Create" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -165,7 +166,7 @@ public async Task CreateOrUpdate_ElasticSansCreateMinimumSetGen() // invoke the operation string elasticSanName = "elasticsanname"; - ElasticSanData data = new ElasticSanData(new AzureLocation("South Central US"), new ElasticSanSku(ElasticSanSkuName.PremiumLrs), 5, 25); + ElasticSanData data = new ElasticSanData(new AzureLocation("France Central"), new ElasticSanSku(ElasticSanSkuName.PremiumLrs), 15, 27); ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, elasticSanName, data); ElasticSanResource result = lro.Value; @@ -181,7 +182,7 @@ public async Task CreateOrUpdate_ElasticSansCreateMinimumSetGen() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ElasticSansGetMaximumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/ElasticSans_Get_MaximumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/ElasticSans_Get_MaximumSet_Gen.json // this example is just showing the usage of "ElasticSans_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -215,7 +216,7 @@ public async Task Get_ElasticSansGetMaximumSetGen() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_ElasticSansGetMaximumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/ElasticSans_Get_MaximumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/ElasticSans_Get_MaximumSet_Gen.json // this example is just showing the usage of "ElasticSans_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -245,7 +246,7 @@ public async Task Exists_ElasticSansGetMaximumSetGen() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_ElasticSansGetMaximumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/ElasticSans_Get_MaximumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/ElasticSans_Get_MaximumSet_Gen.json // this example is just showing the usage of "ElasticSans_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -287,7 +288,7 @@ public async Task GetIfExists_ElasticSansGetMaximumSetGen() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ElasticSansGetMinimumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/ElasticSans_Get_MinimumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/ElasticSans_Get_MinimumSet_Gen.json // this example is just showing the usage of "ElasticSans_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -321,7 +322,7 @@ public async Task Get_ElasticSansGetMinimumSetGen() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_ElasticSansGetMinimumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/ElasticSans_Get_MinimumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/ElasticSans_Get_MinimumSet_Gen.json // this example is just showing the usage of "ElasticSans_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -351,7 +352,7 @@ public async Task Exists_ElasticSansGetMinimumSetGen() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_ElasticSansGetMinimumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/ElasticSans_Get_MinimumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/ElasticSans_Get_MinimumSet_Gen.json // this example is just showing the usage of "ElasticSans_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanPrivateEndpointConnectionCollection.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanPrivateEndpointConnectionCollection.cs index 3b2b954382c7..ffaa26b5579b 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanPrivateEndpointConnectionCollection.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanPrivateEndpointConnectionCollection.cs @@ -23,7 +23,7 @@ public partial class Sample_ElasticSanPrivateEndpointConnectionCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_PrivateEndpointConnectionsCreateMaximumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/PrivateEndpointConnections_Create_MaximumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/PrivateEndpointConnections_Create_MaximumSet_Gen.json // this example is just showing the usage of "PrivateEndpointConnections_Create" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -47,13 +47,13 @@ public async Task CreateOrUpdate_PrivateEndpointConnectionsCreateMaximumSetGen() ElasticSanPrivateEndpointConnectionData data = new ElasticSanPrivateEndpointConnectionData(new ElasticSanPrivateLinkServiceConnectionState() { Status = ElasticSanPrivateEndpointServiceConnectionStatus.Pending, - Description = "Auto-Approved", - ActionsRequired = "None", + Description = "dxl", + ActionsRequired = "jhjdpwvyzipggtn", }) { GroupIds = { -"sytxzqlcoapcaywthgwvwcw" +"jdwrzpemdjrpiwzvy" }, }; ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, privateEndpointConnectionName, data); @@ -71,7 +71,7 @@ public async Task CreateOrUpdate_PrivateEndpointConnectionsCreateMaximumSetGen() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_PrivateEndpointConnectionsCreateMinimumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/PrivateEndpointConnections_Create_MinimumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/PrivateEndpointConnections_Create_MinimumSet_Gen.json // this example is just showing the usage of "PrivateEndpointConnections_Create" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -92,12 +92,7 @@ public async Task CreateOrUpdate_PrivateEndpointConnectionsCreateMinimumSetGen() // invoke the operation string privateEndpointConnectionName = "privateendpointconnectionname"; - ElasticSanPrivateEndpointConnectionData data = new ElasticSanPrivateEndpointConnectionData(new ElasticSanPrivateLinkServiceConnectionState() - { - Status = ElasticSanPrivateEndpointServiceConnectionStatus.Pending, - Description = "Auto-Approved", - ActionsRequired = "None", - }); + ElasticSanPrivateEndpointConnectionData data = new ElasticSanPrivateEndpointConnectionData(new ElasticSanPrivateLinkServiceConnectionState()); ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, privateEndpointConnectionName, data); ElasticSanPrivateEndpointConnectionResource result = lro.Value; @@ -113,7 +108,7 @@ public async Task CreateOrUpdate_PrivateEndpointConnectionsCreateMinimumSetGen() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_PrivateEndpointConnectionsGetMaximumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/PrivateEndpointConnections_Get_MaximumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/PrivateEndpointConnections_Get_MaximumSet_Gen.json // this example is just showing the usage of "PrivateEndpointConnections_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -148,7 +143,7 @@ public async Task Get_PrivateEndpointConnectionsGetMaximumSetGen() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_PrivateEndpointConnectionsGetMaximumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/PrivateEndpointConnections_Get_MaximumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/PrivateEndpointConnections_Get_MaximumSet_Gen.json // this example is just showing the usage of "PrivateEndpointConnections_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -179,7 +174,7 @@ public async Task Exists_PrivateEndpointConnectionsGetMaximumSetGen() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_PrivateEndpointConnectionsGetMaximumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/PrivateEndpointConnections_Get_MaximumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/PrivateEndpointConnections_Get_MaximumSet_Gen.json // this example is just showing the usage of "PrivateEndpointConnections_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -222,7 +217,7 @@ public async Task GetIfExists_PrivateEndpointConnectionsGetMaximumSetGen() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_PrivateEndpointConnectionsGetMinimumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/PrivateEndpointConnections_Get_MinimumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/PrivateEndpointConnections_Get_MinimumSet_Gen.json // this example is just showing the usage of "PrivateEndpointConnections_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -257,7 +252,7 @@ public async Task Get_PrivateEndpointConnectionsGetMinimumSetGen() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_PrivateEndpointConnectionsGetMinimumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/PrivateEndpointConnections_Get_MinimumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/PrivateEndpointConnections_Get_MinimumSet_Gen.json // this example is just showing the usage of "PrivateEndpointConnections_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -288,7 +283,7 @@ public async Task Exists_PrivateEndpointConnectionsGetMinimumSetGen() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_PrivateEndpointConnectionsGetMinimumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/PrivateEndpointConnections_Get_MinimumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/PrivateEndpointConnections_Get_MinimumSet_Gen.json // this example is just showing the usage of "PrivateEndpointConnections_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -331,7 +326,7 @@ public async Task GetIfExists_PrivateEndpointConnectionsGetMinimumSetGen() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_PrivateEndpointConnectionsListMaximumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/PrivateEndpointConnections_List_MaximumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/PrivateEndpointConnections_List_MaximumSet_Gen.json // this example is just showing the usage of "PrivateEndpointConnections_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -368,7 +363,7 @@ public async Task GetAll_PrivateEndpointConnectionsListMaximumSetGen() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_PrivateEndpointConnectionsListMinimumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/PrivateEndpointConnections_List_MinimumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/PrivateEndpointConnections_List_MinimumSet_Gen.json // this example is just showing the usage of "PrivateEndpointConnections_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanPrivateEndpointConnectionResource.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanPrivateEndpointConnectionResource.cs index 0753f7a63bd9..468f61eb1b78 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanPrivateEndpointConnectionResource.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanPrivateEndpointConnectionResource.cs @@ -23,7 +23,7 @@ public partial class Sample_ElasticSanPrivateEndpointConnectionResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_PrivateEndpointConnectionsCreateMaximumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/PrivateEndpointConnections_Create_MaximumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/PrivateEndpointConnections_Create_MaximumSet_Gen.json // this example is just showing the usage of "PrivateEndpointConnections_Create" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -44,13 +44,13 @@ public async Task Update_PrivateEndpointConnectionsCreateMaximumSetGen() ElasticSanPrivateEndpointConnectionData data = new ElasticSanPrivateEndpointConnectionData(new ElasticSanPrivateLinkServiceConnectionState() { Status = ElasticSanPrivateEndpointServiceConnectionStatus.Pending, - Description = "Auto-Approved", - ActionsRequired = "None", + Description = "dxl", + ActionsRequired = "jhjdpwvyzipggtn", }) { GroupIds = { -"sytxzqlcoapcaywthgwvwcw" +"jdwrzpemdjrpiwzvy" }, }; ArmOperation lro = await elasticSanPrivateEndpointConnection.UpdateAsync(WaitUntil.Completed, data); @@ -68,7 +68,7 @@ public async Task Update_PrivateEndpointConnectionsCreateMaximumSetGen() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_PrivateEndpointConnectionsCreateMinimumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/PrivateEndpointConnections_Create_MinimumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/PrivateEndpointConnections_Create_MinimumSet_Gen.json // this example is just showing the usage of "PrivateEndpointConnections_Create" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -86,12 +86,7 @@ public async Task Update_PrivateEndpointConnectionsCreateMinimumSetGen() ElasticSanPrivateEndpointConnectionResource elasticSanPrivateEndpointConnection = client.GetElasticSanPrivateEndpointConnectionResource(elasticSanPrivateEndpointConnectionResourceId); // invoke the operation - ElasticSanPrivateEndpointConnectionData data = new ElasticSanPrivateEndpointConnectionData(new ElasticSanPrivateLinkServiceConnectionState() - { - Status = ElasticSanPrivateEndpointServiceConnectionStatus.Pending, - Description = "Auto-Approved", - ActionsRequired = "None", - }); + ElasticSanPrivateEndpointConnectionData data = new ElasticSanPrivateEndpointConnectionData(new ElasticSanPrivateLinkServiceConnectionState()); ArmOperation lro = await elasticSanPrivateEndpointConnection.UpdateAsync(WaitUntil.Completed, data); ElasticSanPrivateEndpointConnectionResource result = lro.Value; @@ -107,7 +102,7 @@ public async Task Update_PrivateEndpointConnectionsCreateMinimumSetGen() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_PrivateEndpointConnectionsGetMaximumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/PrivateEndpointConnections_Get_MaximumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/PrivateEndpointConnections_Get_MaximumSet_Gen.json // this example is just showing the usage of "PrivateEndpointConnections_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -139,7 +134,7 @@ public async Task Get_PrivateEndpointConnectionsGetMaximumSetGen() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_PrivateEndpointConnectionsGetMinimumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/PrivateEndpointConnections_Get_MinimumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/PrivateEndpointConnections_Get_MinimumSet_Gen.json // this example is just showing the usage of "PrivateEndpointConnections_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -171,7 +166,7 @@ public async Task Get_PrivateEndpointConnectionsGetMinimumSetGen() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_PrivateEndpointConnectionsDeleteMaximumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/PrivateEndpointConnections_Delete_MaximumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/PrivateEndpointConnections_Delete_MaximumSet_Gen.json // this example is just showing the usage of "PrivateEndpointConnections_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -199,7 +194,7 @@ public async Task Delete_PrivateEndpointConnectionsDeleteMaximumSetGen() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_PrivateEndpointConnectionsDeleteMinimumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/PrivateEndpointConnections_Delete_MinimumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/PrivateEndpointConnections_Delete_MinimumSet_Gen.json // this example is just showing the usage of "PrivateEndpointConnections_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanResource.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanResource.cs index 46afadd2bd90..d3a606681655 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanResource.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanResource.cs @@ -24,7 +24,7 @@ public partial class Sample_ElasticSanResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetElasticSans_ElasticSansListBySubscriptionMaximumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/ElasticSans_ListBySubscription_MaximumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/ElasticSans_ListBySubscription_MaximumSet_Gen.json // this example is just showing the usage of "ElasticSans_ListBySubscription" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -56,7 +56,7 @@ public async Task GetElasticSans_ElasticSansListBySubscriptionMaximumSetGen() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetElasticSans_ElasticSansListBySubscriptionMinimumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/ElasticSans_ListBySubscription_MinimumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/ElasticSans_ListBySubscription_MinimumSet_Gen.json // this example is just showing the usage of "ElasticSans_ListBySubscription" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -88,7 +88,7 @@ public async Task GetElasticSans_ElasticSansListBySubscriptionMinimumSetGen() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_ElasticSansUpdateMaximumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/ElasticSans_Update_MaximumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/ElasticSans_Update_MaximumSet_Gen.json // this example is just showing the usage of "ElasticSans_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -109,10 +109,11 @@ public async Task Update_ElasticSansUpdateMaximumSetGen() { Tags = { -["key4212"] = "cqvcnwfefljntgeio", +["key1931"] = "yhjwkgmrrwrcoxblgwgzjqusch", }, - BaseSizeTiB = 10, - ExtendedCapacitySizeTiB = 22, + BaseSizeTiB = 13, + ExtendedCapacitySizeTiB = 29, + PublicNetworkAccess = PublicNetworkAccess.Enabled, }; ArmOperation lro = await elasticSan.UpdateAsync(WaitUntil.Completed, patch); ElasticSanResource result = lro.Value; @@ -129,7 +130,7 @@ public async Task Update_ElasticSansUpdateMaximumSetGen() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_ElasticSansUpdateMinimumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/ElasticSans_Update_MinimumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/ElasticSans_Update_MinimumSet_Gen.json // this example is just showing the usage of "ElasticSans_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -162,7 +163,7 @@ public async Task Update_ElasticSansUpdateMinimumSetGen() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_ElasticSansDeleteMaximumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/ElasticSans_Delete_MaximumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/ElasticSans_Delete_MaximumSet_Gen.json // this example is just showing the usage of "ElasticSans_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -189,7 +190,7 @@ public async Task Delete_ElasticSansDeleteMaximumSetGen() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_ElasticSansDeleteMinimumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/ElasticSans_Delete_MinimumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/ElasticSans_Delete_MinimumSet_Gen.json // this example is just showing the usage of "ElasticSans_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -216,7 +217,7 @@ public async Task Delete_ElasticSansDeleteMinimumSetGen() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ElasticSansGetMaximumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/ElasticSans_Get_MaximumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/ElasticSans_Get_MaximumSet_Gen.json // this example is just showing the usage of "ElasticSans_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -247,7 +248,7 @@ public async Task Get_ElasticSansGetMaximumSetGen() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_ElasticSansGetMinimumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/ElasticSans_Get_MinimumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/ElasticSans_Get_MinimumSet_Gen.json // this example is just showing the usage of "ElasticSans_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -278,7 +279,7 @@ public async Task Get_ElasticSansGetMinimumSetGen() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetPrivateLinkResources_PrivateLinkResourcesListByElasticSanMaximumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/PrivateLinkResources_ListByElasticSan_MaximumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/PrivateLinkResources_ListByElasticSan_MaximumSet_Gen.json // this example is just showing the usage of "PrivateLinkResources_ListByElasticSan" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -308,7 +309,7 @@ public async Task GetPrivateLinkResources_PrivateLinkResourcesListByElasticSanMa [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetPrivateLinkResources_PrivateLinkResourcesListByElasticSanMinimumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/PrivateLinkResources_ListByElasticSan_MinimumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/PrivateLinkResources_ListByElasticSan_MinimumSet_Gen.json // this example is just showing the usage of "PrivateLinkResources_ListByElasticSan" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanSnapshotCollection.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanSnapshotCollection.cs new file mode 100644 index 000000000000..42000bf14802 --- /dev/null +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanSnapshotCollection.cs @@ -0,0 +1,398 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ElasticSan; +using Azure.ResourceManager.ElasticSan.Models; + +namespace Azure.ResourceManager.ElasticSan.Samples +{ + public partial class Sample_ElasticSanSnapshotCollection + { + // VolumeSnapshots_ListByVolumeGroup_MaximumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_VolumeSnapshotsListByVolumeGroupMaximumSetGen() + { + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/VolumeSnapshots_ListByVolumeGroup_MaximumSet_Gen.json + // this example is just showing the usage of "VolumeSnapshots_ListByVolumeGroup" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ElasticSanVolumeGroupResource created on azure + // for more information of creating ElasticSanVolumeGroupResource, please refer to the document of ElasticSanVolumeGroupResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + string volumeGroupName = "volumegroupname"; + ResourceIdentifier elasticSanVolumeGroupResourceId = ElasticSanVolumeGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName); + ElasticSanVolumeGroupResource elasticSanVolumeGroup = client.GetElasticSanVolumeGroupResource(elasticSanVolumeGroupResourceId); + + // get the collection of this ElasticSanSnapshotResource + ElasticSanSnapshotCollection collection = elasticSanVolumeGroup.GetElasticSanSnapshots(); + + // invoke the operation and iterate over the result + string filter = "volumeName eq "; + await foreach (ElasticSanSnapshotResource item in collection.GetAllAsync(filter: filter)) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ElasticSanSnapshotData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // VolumeSnapshots_ListByVolumeGroup_MinimumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_VolumeSnapshotsListByVolumeGroupMinimumSetGen() + { + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/VolumeSnapshots_ListByVolumeGroup_MinimumSet_Gen.json + // this example is just showing the usage of "VolumeSnapshots_ListByVolumeGroup" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ElasticSanVolumeGroupResource created on azure + // for more information of creating ElasticSanVolumeGroupResource, please refer to the document of ElasticSanVolumeGroupResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + string volumeGroupName = "volumegroupname"; + ResourceIdentifier elasticSanVolumeGroupResourceId = ElasticSanVolumeGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName); + ElasticSanVolumeGroupResource elasticSanVolumeGroup = client.GetElasticSanVolumeGroupResource(elasticSanVolumeGroupResourceId); + + // get the collection of this ElasticSanSnapshotResource + ElasticSanSnapshotCollection collection = elasticSanVolumeGroup.GetElasticSanSnapshots(); + + // invoke the operation and iterate over the result + await foreach (ElasticSanSnapshotResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ElasticSanSnapshotData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // VolumeSnapshots_Create_MaximumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_VolumeSnapshotsCreateMaximumSetGen() + { + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/VolumeSnapshots_Create_MaximumSet_Gen.json + // this example is just showing the usage of "VolumeSnapshots_Create" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ElasticSanVolumeGroupResource created on azure + // for more information of creating ElasticSanVolumeGroupResource, please refer to the document of ElasticSanVolumeGroupResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + string volumeGroupName = "volumegroupname"; + ResourceIdentifier elasticSanVolumeGroupResourceId = ElasticSanVolumeGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName); + ElasticSanVolumeGroupResource elasticSanVolumeGroup = client.GetElasticSanVolumeGroupResource(elasticSanVolumeGroupResourceId); + + // get the collection of this ElasticSanSnapshotResource + ElasticSanSnapshotCollection collection = elasticSanVolumeGroup.GetElasticSanSnapshots(); + + // invoke the operation + string snapshotName = "snapshotname"; + ElasticSanSnapshotData data = new ElasticSanSnapshotData(new SnapshotCreationData(new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/volumes/{volumeName}"))); + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, snapshotName, data); + ElasticSanSnapshotResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ElasticSanSnapshotData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // VolumeSnapshots_Create_MinimumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_VolumeSnapshotsCreateMinimumSetGen() + { + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/VolumeSnapshots_Create_MinimumSet_Gen.json + // this example is just showing the usage of "VolumeSnapshots_Create" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ElasticSanVolumeGroupResource created on azure + // for more information of creating ElasticSanVolumeGroupResource, please refer to the document of ElasticSanVolumeGroupResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + string volumeGroupName = "volumegroupname"; + ResourceIdentifier elasticSanVolumeGroupResourceId = ElasticSanVolumeGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName); + ElasticSanVolumeGroupResource elasticSanVolumeGroup = client.GetElasticSanVolumeGroupResource(elasticSanVolumeGroupResourceId); + + // get the collection of this ElasticSanSnapshotResource + ElasticSanSnapshotCollection collection = elasticSanVolumeGroup.GetElasticSanSnapshots(); + + // invoke the operation + string snapshotName = "snapshotname"; + ElasticSanSnapshotData data = new ElasticSanSnapshotData(new SnapshotCreationData(new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/volumes/{volumeName}"))); + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, snapshotName, data); + ElasticSanSnapshotResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ElasticSanSnapshotData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // VolumeSnapshots_Get_MaximumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_VolumeSnapshotsGetMaximumSetGen() + { + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/VolumeSnapshots_Get_MaximumSet_Gen.json + // this example is just showing the usage of "VolumeSnapshots_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ElasticSanVolumeGroupResource created on azure + // for more information of creating ElasticSanVolumeGroupResource, please refer to the document of ElasticSanVolumeGroupResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + string volumeGroupName = "volumegroupname"; + ResourceIdentifier elasticSanVolumeGroupResourceId = ElasticSanVolumeGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName); + ElasticSanVolumeGroupResource elasticSanVolumeGroup = client.GetElasticSanVolumeGroupResource(elasticSanVolumeGroupResourceId); + + // get the collection of this ElasticSanSnapshotResource + ElasticSanSnapshotCollection collection = elasticSanVolumeGroup.GetElasticSanSnapshots(); + + // invoke the operation + string snapshotName = "snapshotname"; + ElasticSanSnapshotResource result = await collection.GetAsync(snapshotName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ElasticSanSnapshotData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // VolumeSnapshots_Get_MaximumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_VolumeSnapshotsGetMaximumSetGen() + { + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/VolumeSnapshots_Get_MaximumSet_Gen.json + // this example is just showing the usage of "VolumeSnapshots_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ElasticSanVolumeGroupResource created on azure + // for more information of creating ElasticSanVolumeGroupResource, please refer to the document of ElasticSanVolumeGroupResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + string volumeGroupName = "volumegroupname"; + ResourceIdentifier elasticSanVolumeGroupResourceId = ElasticSanVolumeGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName); + ElasticSanVolumeGroupResource elasticSanVolumeGroup = client.GetElasticSanVolumeGroupResource(elasticSanVolumeGroupResourceId); + + // get the collection of this ElasticSanSnapshotResource + ElasticSanSnapshotCollection collection = elasticSanVolumeGroup.GetElasticSanSnapshots(); + + // invoke the operation + string snapshotName = "snapshotname"; + bool result = await collection.ExistsAsync(snapshotName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // VolumeSnapshots_Get_MaximumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_VolumeSnapshotsGetMaximumSetGen() + { + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/VolumeSnapshots_Get_MaximumSet_Gen.json + // this example is just showing the usage of "VolumeSnapshots_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ElasticSanVolumeGroupResource created on azure + // for more information of creating ElasticSanVolumeGroupResource, please refer to the document of ElasticSanVolumeGroupResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + string volumeGroupName = "volumegroupname"; + ResourceIdentifier elasticSanVolumeGroupResourceId = ElasticSanVolumeGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName); + ElasticSanVolumeGroupResource elasticSanVolumeGroup = client.GetElasticSanVolumeGroupResource(elasticSanVolumeGroupResourceId); + + // get the collection of this ElasticSanSnapshotResource + ElasticSanSnapshotCollection collection = elasticSanVolumeGroup.GetElasticSanSnapshots(); + + // invoke the operation + string snapshotName = "snapshotname"; + NullableResponse response = await collection.GetIfExistsAsync(snapshotName); + ElasticSanSnapshotResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ElasticSanSnapshotData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // VolumeSnapshots_Get_MinimumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_VolumeSnapshotsGetMinimumSetGen() + { + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/VolumeSnapshots_Get_MinimumSet_Gen.json + // this example is just showing the usage of "VolumeSnapshots_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ElasticSanVolumeGroupResource created on azure + // for more information of creating ElasticSanVolumeGroupResource, please refer to the document of ElasticSanVolumeGroupResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + string volumeGroupName = "volumegroupname"; + ResourceIdentifier elasticSanVolumeGroupResourceId = ElasticSanVolumeGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName); + ElasticSanVolumeGroupResource elasticSanVolumeGroup = client.GetElasticSanVolumeGroupResource(elasticSanVolumeGroupResourceId); + + // get the collection of this ElasticSanSnapshotResource + ElasticSanSnapshotCollection collection = elasticSanVolumeGroup.GetElasticSanSnapshots(); + + // invoke the operation + string snapshotName = "snapshotname"; + ElasticSanSnapshotResource result = await collection.GetAsync(snapshotName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ElasticSanSnapshotData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // VolumeSnapshots_Get_MinimumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_VolumeSnapshotsGetMinimumSetGen() + { + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/VolumeSnapshots_Get_MinimumSet_Gen.json + // this example is just showing the usage of "VolumeSnapshots_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ElasticSanVolumeGroupResource created on azure + // for more information of creating ElasticSanVolumeGroupResource, please refer to the document of ElasticSanVolumeGroupResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + string volumeGroupName = "volumegroupname"; + ResourceIdentifier elasticSanVolumeGroupResourceId = ElasticSanVolumeGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName); + ElasticSanVolumeGroupResource elasticSanVolumeGroup = client.GetElasticSanVolumeGroupResource(elasticSanVolumeGroupResourceId); + + // get the collection of this ElasticSanSnapshotResource + ElasticSanSnapshotCollection collection = elasticSanVolumeGroup.GetElasticSanSnapshots(); + + // invoke the operation + string snapshotName = "snapshotname"; + bool result = await collection.ExistsAsync(snapshotName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // VolumeSnapshots_Get_MinimumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_VolumeSnapshotsGetMinimumSetGen() + { + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/VolumeSnapshots_Get_MinimumSet_Gen.json + // this example is just showing the usage of "VolumeSnapshots_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ElasticSanVolumeGroupResource created on azure + // for more information of creating ElasticSanVolumeGroupResource, please refer to the document of ElasticSanVolumeGroupResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + string volumeGroupName = "volumegroupname"; + ResourceIdentifier elasticSanVolumeGroupResourceId = ElasticSanVolumeGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName); + ElasticSanVolumeGroupResource elasticSanVolumeGroup = client.GetElasticSanVolumeGroupResource(elasticSanVolumeGroupResourceId); + + // get the collection of this ElasticSanSnapshotResource + ElasticSanSnapshotCollection collection = elasticSanVolumeGroup.GetElasticSanSnapshots(); + + // invoke the operation + string snapshotName = "snapshotname"; + NullableResponse response = await collection.GetIfExistsAsync(snapshotName); + ElasticSanSnapshotResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ElasticSanSnapshotData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanSnapshotResource.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanSnapshotResource.cs new file mode 100644 index 000000000000..3cf195024e66 --- /dev/null +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanSnapshotResource.cs @@ -0,0 +1,215 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ElasticSan; +using Azure.ResourceManager.ElasticSan.Models; + +namespace Azure.ResourceManager.ElasticSan.Samples +{ + public partial class Sample_ElasticSanSnapshotResource + { + // VolumeSnapshots_Create_MaximumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_VolumeSnapshotsCreateMaximumSetGen() + { + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/VolumeSnapshots_Create_MaximumSet_Gen.json + // this example is just showing the usage of "VolumeSnapshots_Create" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ElasticSanSnapshotResource created on azure + // for more information of creating ElasticSanSnapshotResource, please refer to the document of ElasticSanSnapshotResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + string volumeGroupName = "volumegroupname"; + string snapshotName = "snapshotname"; + ResourceIdentifier elasticSanSnapshotResourceId = ElasticSanSnapshotResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, snapshotName); + ElasticSanSnapshotResource elasticSanSnapshot = client.GetElasticSanSnapshotResource(elasticSanSnapshotResourceId); + + // invoke the operation + ElasticSanSnapshotData data = new ElasticSanSnapshotData(new SnapshotCreationData(new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/volumes/{volumeName}"))); + ArmOperation lro = await elasticSanSnapshot.UpdateAsync(WaitUntil.Completed, data); + ElasticSanSnapshotResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ElasticSanSnapshotData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // VolumeSnapshots_Create_MinimumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_VolumeSnapshotsCreateMinimumSetGen() + { + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/VolumeSnapshots_Create_MinimumSet_Gen.json + // this example is just showing the usage of "VolumeSnapshots_Create" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ElasticSanSnapshotResource created on azure + // for more information of creating ElasticSanSnapshotResource, please refer to the document of ElasticSanSnapshotResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + string volumeGroupName = "volumegroupname"; + string snapshotName = "snapshotname"; + ResourceIdentifier elasticSanSnapshotResourceId = ElasticSanSnapshotResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, snapshotName); + ElasticSanSnapshotResource elasticSanSnapshot = client.GetElasticSanSnapshotResource(elasticSanSnapshotResourceId); + + // invoke the operation + ElasticSanSnapshotData data = new ElasticSanSnapshotData(new SnapshotCreationData(new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/volumes/{volumeName}"))); + ArmOperation lro = await elasticSanSnapshot.UpdateAsync(WaitUntil.Completed, data); + ElasticSanSnapshotResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ElasticSanSnapshotData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // VolumeSnapshots_Delete_MaximumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_VolumeSnapshotsDeleteMaximumSetGen() + { + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/VolumeSnapshots_Delete_MaximumSet_Gen.json + // this example is just showing the usage of "VolumeSnapshots_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ElasticSanSnapshotResource created on azure + // for more information of creating ElasticSanSnapshotResource, please refer to the document of ElasticSanSnapshotResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + string volumeGroupName = "volumegroupname"; + string snapshotName = "snapshotname"; + ResourceIdentifier elasticSanSnapshotResourceId = ElasticSanSnapshotResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, snapshotName); + ElasticSanSnapshotResource elasticSanSnapshot = client.GetElasticSanSnapshotResource(elasticSanSnapshotResourceId); + + // invoke the operation + await elasticSanSnapshot.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // VolumeSnapshots_Delete_MinimumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_VolumeSnapshotsDeleteMinimumSetGen() + { + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/VolumeSnapshots_Delete_MinimumSet_Gen.json + // this example is just showing the usage of "VolumeSnapshots_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ElasticSanSnapshotResource created on azure + // for more information of creating ElasticSanSnapshotResource, please refer to the document of ElasticSanSnapshotResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + string volumeGroupName = "volumegroupname"; + string snapshotName = "snapshotname"; + ResourceIdentifier elasticSanSnapshotResourceId = ElasticSanSnapshotResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, snapshotName); + ElasticSanSnapshotResource elasticSanSnapshot = client.GetElasticSanSnapshotResource(elasticSanSnapshotResourceId); + + // invoke the operation + await elasticSanSnapshot.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // VolumeSnapshots_Get_MaximumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_VolumeSnapshotsGetMaximumSetGen() + { + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/VolumeSnapshots_Get_MaximumSet_Gen.json + // this example is just showing the usage of "VolumeSnapshots_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ElasticSanSnapshotResource created on azure + // for more information of creating ElasticSanSnapshotResource, please refer to the document of ElasticSanSnapshotResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + string volumeGroupName = "volumegroupname"; + string snapshotName = "snapshotname"; + ResourceIdentifier elasticSanSnapshotResourceId = ElasticSanSnapshotResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, snapshotName); + ElasticSanSnapshotResource elasticSanSnapshot = client.GetElasticSanSnapshotResource(elasticSanSnapshotResourceId); + + // invoke the operation + ElasticSanSnapshotResource result = await elasticSanSnapshot.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ElasticSanSnapshotData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // VolumeSnapshots_Get_MinimumSet_Gen + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_VolumeSnapshotsGetMinimumSetGen() + { + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/VolumeSnapshots_Get_MinimumSet_Gen.json + // this example is just showing the usage of "VolumeSnapshots_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ElasticSanSnapshotResource created on azure + // for more information of creating ElasticSanSnapshotResource, please refer to the document of ElasticSanSnapshotResource + string subscriptionId = "subscriptionid"; + string resourceGroupName = "resourcegroupname"; + string elasticSanName = "elasticsanname"; + string volumeGroupName = "volumegroupname"; + string snapshotName = "snapshotname"; + ResourceIdentifier elasticSanSnapshotResourceId = ElasticSanSnapshotResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, snapshotName); + ElasticSanSnapshotResource elasticSanSnapshot = client.GetElasticSanSnapshotResource(elasticSanSnapshotResourceId); + + // invoke the operation + ElasticSanSnapshotResource result = await elasticSanSnapshot.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ElasticSanSnapshotData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanVolumeCollection.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanVolumeCollection.cs index 2d7d8dd8feaf..9cb6fb58ccdc 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanVolumeCollection.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanVolumeCollection.cs @@ -23,7 +23,7 @@ public partial class Sample_ElasticSanVolumeCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_VolumesCreateMaximumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/Volumes_Create_MaximumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/Volumes_Create_MaximumSet_Gen.json // this example is just showing the usage of "Volumes_Create" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -45,13 +45,14 @@ public async Task CreateOrUpdate_VolumesCreateMaximumSetGen() // invoke the operation string volumeName = "volumename"; - ElasticSanVolumeData data = new ElasticSanVolumeData(23) + ElasticSanVolumeData data = new ElasticSanVolumeData(9) { CreationData = new ElasticSanVolumeDataSourceInfo() { CreateSource = ElasticSanVolumeCreateOption.None, - SourceUri = new Uri(" ARM Id of resource"), + SourceId = new ResourceIdentifier("ARM Id of Resource"), }, + ManagedByResourceId = new ResourceIdentifier("mtkeip"), }; ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, volumeName, data); ElasticSanVolumeResource result = lro.Value; @@ -68,7 +69,7 @@ public async Task CreateOrUpdate_VolumesCreateMaximumSetGen() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_VolumesCreateMinimumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/Volumes_Create_MinimumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/Volumes_Create_MinimumSet_Gen.json // this example is just showing the usage of "Volumes_Create" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -90,7 +91,7 @@ public async Task CreateOrUpdate_VolumesCreateMinimumSetGen() // invoke the operation string volumeName = "volumename"; - ElasticSanVolumeData data = new ElasticSanVolumeData(23); + ElasticSanVolumeData data = new ElasticSanVolumeData(9); ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, volumeName, data); ElasticSanVolumeResource result = lro.Value; @@ -106,7 +107,7 @@ public async Task CreateOrUpdate_VolumesCreateMinimumSetGen() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_VolumesGetMaximumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/Volumes_Get_MaximumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/Volumes_Get_MaximumSet_Gen.json // this example is just showing the usage of "Volumes_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -142,7 +143,7 @@ public async Task Get_VolumesGetMaximumSetGen() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_VolumesGetMaximumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/Volumes_Get_MaximumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/Volumes_Get_MaximumSet_Gen.json // this example is just showing the usage of "Volumes_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -174,7 +175,7 @@ public async Task Exists_VolumesGetMaximumSetGen() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_VolumesGetMaximumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/Volumes_Get_MaximumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/Volumes_Get_MaximumSet_Gen.json // this example is just showing the usage of "Volumes_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -218,7 +219,7 @@ public async Task GetIfExists_VolumesGetMaximumSetGen() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_VolumesGetMinimumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/Volumes_Get_MinimumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/Volumes_Get_MinimumSet_Gen.json // this example is just showing the usage of "Volumes_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -254,7 +255,7 @@ public async Task Get_VolumesGetMinimumSetGen() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_VolumesGetMinimumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/Volumes_Get_MinimumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/Volumes_Get_MinimumSet_Gen.json // this example is just showing the usage of "Volumes_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -286,7 +287,7 @@ public async Task Exists_VolumesGetMinimumSetGen() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_VolumesGetMinimumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/Volumes_Get_MinimumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/Volumes_Get_MinimumSet_Gen.json // this example is just showing the usage of "Volumes_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -330,7 +331,7 @@ public async Task GetIfExists_VolumesGetMinimumSetGen() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_VolumesListByVolumeGroupMaximumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/Volumes_ListByVolumeGroup_MaximumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/Volumes_ListByVolumeGroup_MaximumSet_Gen.json // this example is just showing the usage of "Volumes_ListByVolumeGroup" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -368,7 +369,7 @@ public async Task GetAll_VolumesListByVolumeGroupMaximumSetGen() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_VolumesListByVolumeGroupMinimumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/Volumes_ListByVolumeGroup_MinimumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/Volumes_ListByVolumeGroup_MinimumSet_Gen.json // this example is just showing the usage of "Volumes_ListByVolumeGroup" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanVolumeGroupCollection.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanVolumeGroupCollection.cs index be498f61678c..2dc1278b8c64 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanVolumeGroupCollection.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanVolumeGroupCollection.cs @@ -13,6 +13,7 @@ using Azure.ResourceManager; using Azure.ResourceManager.ElasticSan; using Azure.ResourceManager.ElasticSan.Models; +using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ElasticSan.Samples { @@ -23,7 +24,7 @@ public partial class Sample_ElasticSanVolumeGroupCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_VolumeGroupsListByElasticSanMaximumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/VolumeGroups_ListByElasticSan_MaximumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/VolumeGroups_ListByElasticSan_MaximumSet_Gen.json // this example is just showing the usage of "VolumeGroups_ListByElasticSan" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -60,7 +61,7 @@ public async Task GetAll_VolumeGroupsListByElasticSanMaximumSetGen() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_VolumeGroupsListByElasticSanMinimumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/VolumeGroups_ListByElasticSan_MinimumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/VolumeGroups_ListByElasticSan_MinimumSet_Gen.json // this example is just showing the usage of "VolumeGroups_ListByElasticSan" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -97,7 +98,7 @@ public async Task GetAll_VolumeGroupsListByElasticSanMinimumSetGen() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_VolumeGroupsCreateMaximumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/VolumeGroups_Create_MaximumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/VolumeGroups_Create_MaximumSet_Gen.json // this example is just showing the usage of "VolumeGroups_Create" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -120,8 +121,25 @@ public async Task CreateOrUpdate_VolumeGroupsCreateMaximumSetGen() string volumeGroupName = "volumegroupname"; ElasticSanVolumeGroupData data = new ElasticSanVolumeGroupData() { + Identity = new ManagedServiceIdentity("None") + { + UserAssignedIdentities = +{ +[new ResourceIdentifier("key7482")] = new UserAssignedIdentity(), +}, + }, ProtocolType = StorageTargetType.Iscsi, - Encryption = ElasticSanEncryptionType.EncryptionAtRestWithPlatformKey, + Encryption = ElasticSanEncryptionType.EncryptionAtRestWithCustomerManagedKey, + EncryptionProperties = new Models.EncryptionProperties() + { + KeyVaultProperties = new Models.KeyVaultProperties() + { + KeyName = "sftaiernmrzypnrkpakrrawxcbsqzc", + KeyVersion = "c", + KeyVaultUri = new Uri("https://microsoft.com/axmblwp"), + }, + EncryptionUserAssignedIdentity = "im", + }, VirtualNetworkRules = { new ElasticSanVirtualNetworkRule(new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}")) @@ -145,7 +163,7 @@ public async Task CreateOrUpdate_VolumeGroupsCreateMaximumSetGen() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_VolumeGroupsCreateMinimumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/VolumeGroups_Create_MinimumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/VolumeGroups_Create_MinimumSet_Gen.json // this example is just showing the usage of "VolumeGroups_Create" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -182,7 +200,7 @@ public async Task CreateOrUpdate_VolumeGroupsCreateMinimumSetGen() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_VolumeGroupsGetMaximumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/VolumeGroups_Get_MaximumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/VolumeGroups_Get_MaximumSet_Gen.json // this example is just showing the usage of "VolumeGroups_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -217,7 +235,7 @@ public async Task Get_VolumeGroupsGetMaximumSetGen() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_VolumeGroupsGetMaximumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/VolumeGroups_Get_MaximumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/VolumeGroups_Get_MaximumSet_Gen.json // this example is just showing the usage of "VolumeGroups_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -248,7 +266,7 @@ public async Task Exists_VolumeGroupsGetMaximumSetGen() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_VolumeGroupsGetMaximumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/VolumeGroups_Get_MaximumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/VolumeGroups_Get_MaximumSet_Gen.json // this example is just showing the usage of "VolumeGroups_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -291,7 +309,7 @@ public async Task GetIfExists_VolumeGroupsGetMaximumSetGen() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_VolumeGroupsGetMinimumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/VolumeGroups_Get_MinimumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/VolumeGroups_Get_MinimumSet_Gen.json // this example is just showing the usage of "VolumeGroups_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -326,7 +344,7 @@ public async Task Get_VolumeGroupsGetMinimumSetGen() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_VolumeGroupsGetMinimumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/VolumeGroups_Get_MinimumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/VolumeGroups_Get_MinimumSet_Gen.json // this example is just showing the usage of "VolumeGroups_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -357,7 +375,7 @@ public async Task Exists_VolumeGroupsGetMinimumSetGen() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_VolumeGroupsGetMinimumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/VolumeGroups_Get_MinimumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/VolumeGroups_Get_MinimumSet_Gen.json // this example is just showing the usage of "VolumeGroups_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanVolumeGroupResource.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanVolumeGroupResource.cs index c4d971fa0c0d..25480f534543 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanVolumeGroupResource.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanVolumeGroupResource.cs @@ -13,6 +13,7 @@ using Azure.ResourceManager; using Azure.ResourceManager.ElasticSan; using Azure.ResourceManager.ElasticSan.Models; +using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ElasticSan.Samples { @@ -23,7 +24,7 @@ public partial class Sample_ElasticSanVolumeGroupResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_VolumeGroupsUpdateMaximumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/VolumeGroups_Update_MaximumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/VolumeGroups_Update_MaximumSet_Gen.json // this example is just showing the usage of "VolumeGroups_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -43,8 +44,25 @@ public async Task Update_VolumeGroupsUpdateMaximumSetGen() // invoke the operation ElasticSanVolumeGroupPatch patch = new ElasticSanVolumeGroupPatch() { + Identity = new ManagedServiceIdentity("None") + { + UserAssignedIdentities = +{ +[new ResourceIdentifier("key7482")] = new UserAssignedIdentity(), +}, + }, ProtocolType = StorageTargetType.Iscsi, Encryption = ElasticSanEncryptionType.EncryptionAtRestWithPlatformKey, + EncryptionProperties = new Models.EncryptionProperties() + { + KeyVaultProperties = new Models.KeyVaultProperties() + { + KeyName = "sftaiernmrzypnrkpakrrawxcbsqzc", + KeyVersion = "c", + KeyVaultUri = new Uri("https://microsoft.com/axmblwp"), + }, + EncryptionUserAssignedIdentity = "im", + }, VirtualNetworkRules = { new ElasticSanVirtualNetworkRule(new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}")) @@ -68,7 +86,7 @@ public async Task Update_VolumeGroupsUpdateMaximumSetGen() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_VolumeGroupsUpdateMinimumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/VolumeGroups_Update_MinimumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/VolumeGroups_Update_MinimumSet_Gen.json // this example is just showing the usage of "VolumeGroups_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -102,7 +120,7 @@ public async Task Update_VolumeGroupsUpdateMinimumSetGen() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_VolumeGroupsDeleteMaximumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/VolumeGroups_Delete_MaximumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/VolumeGroups_Delete_MaximumSet_Gen.json // this example is just showing the usage of "VolumeGroups_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -130,7 +148,7 @@ public async Task Delete_VolumeGroupsDeleteMaximumSetGen() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_VolumeGroupsDeleteMinimumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/VolumeGroups_Delete_MinimumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/VolumeGroups_Delete_MinimumSet_Gen.json // this example is just showing the usage of "VolumeGroups_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -158,7 +176,7 @@ public async Task Delete_VolumeGroupsDeleteMinimumSetGen() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_VolumeGroupsGetMaximumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/VolumeGroups_Get_MaximumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/VolumeGroups_Get_MaximumSet_Gen.json // this example is just showing the usage of "VolumeGroups_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -190,7 +208,7 @@ public async Task Get_VolumeGroupsGetMaximumSetGen() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_VolumeGroupsGetMinimumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/VolumeGroups_Get_MinimumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/VolumeGroups_Get_MinimumSet_Gen.json // this example is just showing the usage of "VolumeGroups_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanVolumeResource.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanVolumeResource.cs index ce8710505d90..43f9e2a9c832 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanVolumeResource.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_ElasticSanVolumeResource.cs @@ -23,7 +23,7 @@ public partial class Sample_ElasticSanVolumeResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_VolumesUpdateMaximumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/Volumes_Update_MaximumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/Volumes_Update_MaximumSet_Gen.json // this example is just showing the usage of "Volumes_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -61,7 +61,7 @@ public async Task Update_VolumesUpdateMaximumSetGen() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_VolumesUpdateMinimumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/Volumes_Update_MinimumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/Volumes_Update_MinimumSet_Gen.json // this example is just showing the usage of "Volumes_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -96,7 +96,7 @@ public async Task Update_VolumesUpdateMinimumSetGen() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_VolumesDeleteMaximumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/Volumes_Delete_MaximumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/Volumes_Delete_MaximumSet_Gen.json // this example is just showing the usage of "Volumes_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -115,7 +115,9 @@ public async Task Delete_VolumesDeleteMaximumSetGen() ElasticSanVolumeResource elasticSanVolume = client.GetElasticSanVolumeResource(elasticSanVolumeResourceId); // invoke the operation - await elasticSanVolume.DeleteAsync(WaitUntil.Completed); + XMsDeleteSnapshot? xMsDeleteSnapshots = XMsDeleteSnapshot.True; + XMsForceDelete? xMsForceDelete = XMsForceDelete.True; + await elasticSanVolume.DeleteAsync(WaitUntil.Completed, xMsDeleteSnapshots: xMsDeleteSnapshots, xMsForceDelete: xMsForceDelete); Console.WriteLine($"Succeeded"); } @@ -125,7 +127,7 @@ public async Task Delete_VolumesDeleteMaximumSetGen() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_VolumesDeleteMinimumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/Volumes_Delete_MinimumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/Volumes_Delete_MinimumSet_Gen.json // this example is just showing the usage of "Volumes_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -154,7 +156,7 @@ public async Task Delete_VolumesDeleteMinimumSetGen() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_VolumesGetMaximumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/Volumes_Get_MaximumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/Volumes_Get_MaximumSet_Gen.json // this example is just showing the usage of "Volumes_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -187,7 +189,7 @@ public async Task Get_VolumesGetMaximumSetGen() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_VolumesGetMinimumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/Volumes_Get_MinimumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/Volumes_Get_MinimumSet_Gen.json // this example is just showing the usage of "Volumes_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs index f222a0f412e6..6a2a37b33d88 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs @@ -23,7 +23,7 @@ public partial class Sample_SubscriptionResourceExtensions [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetSkus_SkusListMaximumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/Skus_List_MaximumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/Skus_List_MaximumSet_Gen.json // this example is just showing the usage of "Skus_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -38,7 +38,7 @@ public async Task GetSkus_SkusListMaximumSetGen() SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); // invoke the operation and iterate over the result - string filter = "dtycml"; + string filter = "obwwdrkq"; await foreach (ElasticSanSkuInformation item in subscriptionResource.GetSkusAsync(filter: filter)) { Console.WriteLine($"Succeeded: {item}"); @@ -52,7 +52,7 @@ public async Task GetSkus_SkusListMaximumSetGen() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetSkus_SkusListMinimumSetGen() { - // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/preview/2022-12-01-preview/examples/Skus_List_MinimumSet_Gen.json + // Generated from example definition: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/Skus_List_MinimumSet_Gen.json // this example is just showing the usage of "Skus_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ArmElasticSanModelFactory.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ArmElasticSanModelFactory.cs index 3eb73b6865a4..25858dc2f4bd 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ArmElasticSanModelFactory.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ArmElasticSanModelFactory.cs @@ -72,14 +72,15 @@ public static ElasticSanSkuCapability ElasticSanSkuCapability(string name = null /// Total Provisioned MBps Elastic San appliance. /// Total size of the Elastic San appliance in TB. /// The list of Private Endpoint Connections. + /// Allow or disallow public network access to ElasticSan. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. /// A new instance for mocking. - public static ElasticSanData ElasticSanData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ElasticSanSku sku = null, IEnumerable availabilityZones = null, ElasticSanProvisioningState? provisioningState = null, long baseSizeTiB = default, long extendedCapacitySizeTiB = default, long? totalVolumeSizeGiB = null, long? volumeGroupCount = null, long? totalIops = null, long? totalMbps = null, long? totalSizeTiB = null, IEnumerable privateEndpointConnections = null) + public static ElasticSanData ElasticSanData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ElasticSanSku sku = null, IEnumerable availabilityZones = null, ElasticSanProvisioningState? provisioningState = null, long baseSizeTiB = default, long extendedCapacitySizeTiB = default, long? totalVolumeSizeGiB = null, long? volumeGroupCount = null, long? totalIops = null, long? totalMbps = null, long? totalSizeTiB = null, IEnumerable privateEndpointConnections = null, PublicNetworkAccess? publicNetworkAccess = null) { tags ??= new Dictionary(); availabilityZones ??= new List(); privateEndpointConnections ??= new List(); - return new ElasticSanData(id, name, resourceType, systemData, tags, location, sku, availabilityZones?.ToList(), provisioningState, baseSizeTiB, extendedCapacitySizeTiB, totalVolumeSizeGiB, volumeGroupCount, totalIops, totalMbps, totalSizeTiB, privateEndpointConnections?.ToList()); + return new ElasticSanData(id, name, resourceType, systemData, tags, location, sku, availabilityZones?.ToList(), provisioningState, baseSizeTiB, extendedCapacitySizeTiB, totalVolumeSizeGiB, volumeGroupCount, totalIops, totalMbps, totalSizeTiB, privateEndpointConnections?.ToList(), publicNetworkAccess); } /// Initializes a new instance of ElasticSanPrivateEndpointConnectionData. @@ -104,28 +105,33 @@ public static ElasticSanPrivateEndpointConnectionData ElasticSanPrivateEndpointC /// The name. /// The resourceType. /// The systemData. + /// The identity of the resource. Current supported identity types: None, SystemAssigned, UserAssigned. /// State of the operation on the resource. /// Type of storage target. /// Type of encryption. + /// Encryption Properties describing Key Vault and Identity information. /// A collection of rules governing the accessibility from specific network locations. /// The list of Private Endpoint Connections. /// A new instance for mocking. - public static ElasticSanVolumeGroupData ElasticSanVolumeGroupData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ElasticSanProvisioningState? provisioningState = null, StorageTargetType? protocolType = null, ElasticSanEncryptionType? encryption = null, IEnumerable virtualNetworkRules = null, IEnumerable privateEndpointConnections = null) + public static ElasticSanVolumeGroupData ElasticSanVolumeGroupData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ManagedServiceIdentity identity = null, ElasticSanProvisioningState? provisioningState = null, StorageTargetType? protocolType = null, ElasticSanEncryptionType? encryption = null, EncryptionProperties encryptionProperties = null, IEnumerable virtualNetworkRules = null, IEnumerable privateEndpointConnections = null) { virtualNetworkRules ??= new List(); privateEndpointConnections ??= new List(); - return new ElasticSanVolumeGroupData(id, name, resourceType, systemData, provisioningState, protocolType, encryption, virtualNetworkRules != null ? new NetworkRuleSet(virtualNetworkRules?.ToList()) : null, privateEndpointConnections?.ToList()); + return new ElasticSanVolumeGroupData(id, name, resourceType, systemData, identity, provisioningState, protocolType, encryption, encryptionProperties, virtualNetworkRules != null ? new NetworkRuleSet(virtualNetworkRules?.ToList()) : null, privateEndpointConnections?.ToList()); } - /// Initializes a new instance of ElasticSanVirtualNetworkRule. - /// Resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. - /// The action of virtual network rule. - /// Gets the state of virtual network rule. - /// A new instance for mocking. - public static ElasticSanVirtualNetworkRule ElasticSanVirtualNetworkRule(ResourceIdentifier virtualNetworkResourceId = null, ElasticSanVirtualNetworkRuleAction? action = null, ElasticSanVirtualNetworkRuleState? state = null) + /// Initializes a new instance of KeyVaultProperties. + /// The name of KeyVault key. + /// The version of KeyVault key. + /// The Uri of KeyVault. + /// The object identifier of the current versioned Key Vault Key in use. + /// Timestamp of last rotation of the Key Vault Key. + /// This is a read only property that represents the expiration time of the current version of the customer managed key used for encryption. + /// A new instance for mocking. + public static KeyVaultProperties KeyVaultProperties(string keyName = null, string keyVersion = null, Uri keyVaultUri = null, string currentVersionedKeyIdentifier = null, DateTimeOffset? lastKeyRotationTimestamp = null, DateTimeOffset? currentVersionedKeyExpirationTimestamp = null) { - return new ElasticSanVirtualNetworkRule(virtualNetworkResourceId, action, state); + return new KeyVaultProperties(keyName, keyVersion, keyVaultUri, currentVersionedKeyIdentifier, lastKeyRotationTimestamp, currentVersionedKeyExpirationTimestamp); } /// Initializes a new instance of ElasticSanVolumeData. @@ -137,10 +143,12 @@ public static ElasticSanVirtualNetworkRule ElasticSanVirtualNetworkRule(Resource /// State of the operation on the resource. /// Volume size. /// Storage target information. + /// Parent resource information. + /// State of the operation on the resource. /// A new instance for mocking. - public static ElasticSanVolumeData ElasticSanVolumeData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, Guid? volumeId = null, ElasticSanVolumeDataSourceInfo creationData = null, long sizeGiB = default, IscsiTargetInfo storageTarget = null) + public static ElasticSanVolumeData ElasticSanVolumeData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, Guid? volumeId = null, ElasticSanVolumeDataSourceInfo creationData = null, long sizeGiB = default, IscsiTargetInfo storageTarget = null, ResourceIdentifier managedByResourceId = null, ElasticSanProvisioningState? provisioningState = null) { - return new ElasticSanVolumeData(id, name, resourceType, systemData, volumeId, creationData, sizeGiB, storageTarget); + return new ElasticSanVolumeData(id, name, resourceType, systemData, volumeId, creationData, sizeGiB, storageTarget, managedByResourceId != null ? new ManagedByInfo(managedByResourceId) : null, provisioningState); } /// Initializes a new instance of IscsiTargetInfo. @@ -171,5 +179,20 @@ public static ElasticSanPrivateLinkResource ElasticSanPrivateLinkResource(Resour return new ElasticSanPrivateLinkResource(id, name, resourceType, systemData, groupId, requiredMembers?.ToList(), requiredZoneNames?.ToList()); } + + /// Initializes a new instance of ElasticSanSnapshotData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Data used when creating a volume snapshot. + /// State of the operation on the resource. + /// Size of Source Volume. + /// Source Volume Name of a snapshot. + /// A new instance for mocking. + public static ElasticSanSnapshotData ElasticSanSnapshotData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ResourceIdentifier creationDataSourceId = null, ElasticSanProvisioningState? provisioningState = null, long? sourceVolumeSizeGiB = null, string volumeName = null) + { + return new ElasticSanSnapshotData(id, name, resourceType, systemData, creationDataSourceId != null ? new SnapshotCreationData(creationDataSourceId) : null, provisioningState, sourceVolumeSizeGiB, volumeName); + } } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanData.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanData.cs index 0a8a4b399bce..17b4304126c0 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanData.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanData.cs @@ -54,7 +54,8 @@ public ElasticSanData(AzureLocation location, ElasticSanSku sku, long baseSizeTi /// Total Provisioned MBps Elastic San appliance. /// Total size of the Elastic San appliance in TB. /// The list of Private Endpoint Connections. - internal ElasticSanData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ElasticSanSku sku, IList availabilityZones, ElasticSanProvisioningState? provisioningState, long baseSizeTiB, long extendedCapacitySizeTiB, long? totalVolumeSizeGiB, long? volumeGroupCount, long? totalIops, long? totalMbps, long? totalSizeTiB, IReadOnlyList privateEndpointConnections) : base(id, name, resourceType, systemData, tags, location) + /// Allow or disallow public network access to ElasticSan. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. + internal ElasticSanData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ElasticSanSku sku, IList availabilityZones, ElasticSanProvisioningState? provisioningState, long baseSizeTiB, long extendedCapacitySizeTiB, long? totalVolumeSizeGiB, long? volumeGroupCount, long? totalIops, long? totalMbps, long? totalSizeTiB, IReadOnlyList privateEndpointConnections, PublicNetworkAccess? publicNetworkAccess) : base(id, name, resourceType, systemData, tags, location) { Sku = sku; AvailabilityZones = availabilityZones; @@ -67,6 +68,7 @@ internal ElasticSanData(ResourceIdentifier id, string name, ResourceType resourc TotalMbps = totalMbps; TotalSizeTiB = totalSizeTiB; PrivateEndpointConnections = privateEndpointConnections; + PublicNetworkAccess = publicNetworkAccess; } /// resource sku. @@ -91,5 +93,7 @@ internal ElasticSanData(ResourceIdentifier id, string name, ResourceType resourc public long? TotalSizeTiB { get; } /// The list of Private Endpoint Connections. public IReadOnlyList PrivateEndpointConnections { get; } + /// Allow or disallow public network access to ElasticSan. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. + public PublicNetworkAccess? PublicNetworkAccess { get; set; } } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanSnapshotCollection.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanSnapshotCollection.cs new file mode 100644 index 000000000000..3565fbf3d243 --- /dev/null +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanSnapshotCollection.cs @@ -0,0 +1,417 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ElasticSan +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get an instance call the GetElasticSanSnapshots method from an instance of . + /// + public partial class ElasticSanSnapshotCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _elasticSanSnapshotVolumeSnapshotsClientDiagnostics; + private readonly VolumeSnapshotsRestOperations _elasticSanSnapshotVolumeSnapshotsRestClient; + + /// Initializes a new instance of the class for mocking. + protected ElasticSanSnapshotCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ElasticSanSnapshotCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _elasticSanSnapshotVolumeSnapshotsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ElasticSan", ElasticSanSnapshotResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ElasticSanSnapshotResource.ResourceType, out string elasticSanSnapshotVolumeSnapshotsApiVersion); + _elasticSanSnapshotVolumeSnapshotsRestClient = new VolumeSnapshotsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, elasticSanSnapshotVolumeSnapshotsApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ElasticSanVolumeGroupResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ElasticSanVolumeGroupResource.ResourceType), nameof(id)); + } + + /// + /// Create a Volume Snapshot. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/snapshots/{snapshotName} + /// + /// + /// Operation Id + /// VolumeSnapshots_Create + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the volume snapshot within the given volume group. + /// Snapshot object. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string snapshotName, ElasticSanSnapshotData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _elasticSanSnapshotVolumeSnapshotsClientDiagnostics.CreateScope("ElasticSanSnapshotCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _elasticSanSnapshotVolumeSnapshotsRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, snapshotName, data, cancellationToken).ConfigureAwait(false); + var operation = new ElasticSanArmOperation(new ElasticSanSnapshotOperationSource(Client), _elasticSanSnapshotVolumeSnapshotsClientDiagnostics, Pipeline, _elasticSanSnapshotVolumeSnapshotsRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, snapshotName, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a Volume Snapshot. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/snapshots/{snapshotName} + /// + /// + /// Operation Id + /// VolumeSnapshots_Create + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the volume snapshot within the given volume group. + /// Snapshot object. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string snapshotName, ElasticSanSnapshotData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _elasticSanSnapshotVolumeSnapshotsClientDiagnostics.CreateScope("ElasticSanSnapshotCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _elasticSanSnapshotVolumeSnapshotsRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, snapshotName, data, cancellationToken); + var operation = new ElasticSanArmOperation(new ElasticSanSnapshotOperationSource(Client), _elasticSanSnapshotVolumeSnapshotsClientDiagnostics, Pipeline, _elasticSanSnapshotVolumeSnapshotsRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, snapshotName, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a Volume Snapshot. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/snapshots/{snapshotName} + /// + /// + /// Operation Id + /// VolumeSnapshots_Get + /// + /// + /// + /// The name of the volume snapshot within the given volume group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string snapshotName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); + + using var scope = _elasticSanSnapshotVolumeSnapshotsClientDiagnostics.CreateScope("ElasticSanSnapshotCollection.Get"); + scope.Start(); + try + { + var response = await _elasticSanSnapshotVolumeSnapshotsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, snapshotName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ElasticSanSnapshotResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a Volume Snapshot. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/snapshots/{snapshotName} + /// + /// + /// Operation Id + /// VolumeSnapshots_Get + /// + /// + /// + /// The name of the volume snapshot within the given volume group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string snapshotName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); + + using var scope = _elasticSanSnapshotVolumeSnapshotsClientDiagnostics.CreateScope("ElasticSanSnapshotCollection.Get"); + scope.Start(); + try + { + var response = _elasticSanSnapshotVolumeSnapshotsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, snapshotName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ElasticSanSnapshotResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List Snapshots in a VolumeGroup or List Snapshots by Volume (name) in a VolumeGroup using filter + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/snapshots + /// + /// + /// Operation Id + /// VolumeSnapshots_ListByVolumeGroup + /// + /// + /// + /// Specify $filter='volumeName eq <volume name>' to filter on volume. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _elasticSanSnapshotVolumeSnapshotsRestClient.CreateListByVolumeGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _elasticSanSnapshotVolumeSnapshotsRestClient.CreateListByVolumeGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ElasticSanSnapshotResource(Client, ElasticSanSnapshotData.DeserializeElasticSanSnapshotData(e)), _elasticSanSnapshotVolumeSnapshotsClientDiagnostics, Pipeline, "ElasticSanSnapshotCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List Snapshots in a VolumeGroup or List Snapshots by Volume (name) in a VolumeGroup using filter + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/snapshots + /// + /// + /// Operation Id + /// VolumeSnapshots_ListByVolumeGroup + /// + /// + /// + /// Specify $filter='volumeName eq <volume name>' to filter on volume. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _elasticSanSnapshotVolumeSnapshotsRestClient.CreateListByVolumeGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _elasticSanSnapshotVolumeSnapshotsRestClient.CreateListByVolumeGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ElasticSanSnapshotResource(Client, ElasticSanSnapshotData.DeserializeElasticSanSnapshotData(e)), _elasticSanSnapshotVolumeSnapshotsClientDiagnostics, Pipeline, "ElasticSanSnapshotCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/snapshots/{snapshotName} + /// + /// + /// Operation Id + /// VolumeSnapshots_Get + /// + /// + /// + /// The name of the volume snapshot within the given volume group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string snapshotName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); + + using var scope = _elasticSanSnapshotVolumeSnapshotsClientDiagnostics.CreateScope("ElasticSanSnapshotCollection.Exists"); + scope.Start(); + try + { + var response = await _elasticSanSnapshotVolumeSnapshotsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, snapshotName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/snapshots/{snapshotName} + /// + /// + /// Operation Id + /// VolumeSnapshots_Get + /// + /// + /// + /// The name of the volume snapshot within the given volume group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string snapshotName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); + + using var scope = _elasticSanSnapshotVolumeSnapshotsClientDiagnostics.CreateScope("ElasticSanSnapshotCollection.Exists"); + scope.Start(); + try + { + var response = _elasticSanSnapshotVolumeSnapshotsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, snapshotName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/snapshots/{snapshotName} + /// + /// + /// Operation Id + /// VolumeSnapshots_Get + /// + /// + /// + /// The name of the volume snapshot within the given volume group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string snapshotName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); + + using var scope = _elasticSanSnapshotVolumeSnapshotsClientDiagnostics.CreateScope("ElasticSanSnapshotCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _elasticSanSnapshotVolumeSnapshotsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, snapshotName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ElasticSanSnapshotResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/snapshots/{snapshotName} + /// + /// + /// Operation Id + /// VolumeSnapshots_Get + /// + /// + /// + /// The name of the volume snapshot within the given volume group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string snapshotName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); + + using var scope = _elasticSanSnapshotVolumeSnapshotsClientDiagnostics.CreateScope("ElasticSanSnapshotCollection.GetIfExists"); + scope.Start(); + try + { + var response = _elasticSanSnapshotVolumeSnapshotsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, snapshotName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ElasticSanSnapshotResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanSnapshotData.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanSnapshotData.cs new file mode 100644 index 000000000000..8c59764f1f01 --- /dev/null +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanSnapshotData.cs @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; +using Azure.ResourceManager.ElasticSan.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ElasticSan +{ + /// + /// A class representing the ElasticSanSnapshot data model. + /// Response for Volume Snapshot request. + /// + public partial class ElasticSanSnapshotData : ResourceData + { + /// Initializes a new instance of ElasticSanSnapshotData. + /// Data used when creating a volume snapshot. + /// is null. + public ElasticSanSnapshotData(SnapshotCreationData creationData) + { + Argument.AssertNotNull(creationData, nameof(creationData)); + + CreationData = creationData; + } + + /// Initializes a new instance of ElasticSanSnapshotData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Data used when creating a volume snapshot. + /// State of the operation on the resource. + /// Size of Source Volume. + /// Source Volume Name of a snapshot. + internal ElasticSanSnapshotData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, SnapshotCreationData creationData, ElasticSanProvisioningState? provisioningState, long? sourceVolumeSizeGiB, string volumeName) : base(id, name, resourceType, systemData) + { + CreationData = creationData; + ProvisioningState = provisioningState; + SourceVolumeSizeGiB = sourceVolumeSizeGiB; + VolumeName = volumeName; + } + + /// Data used when creating a volume snapshot. + internal SnapshotCreationData CreationData { get; set; } + /// Fully qualified resource ID of the volume. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/volumes/{volumeName}". + public ResourceIdentifier CreationDataSourceId + { + get => CreationData is null ? default : CreationData.SourceId; + set => CreationData = new SnapshotCreationData(value); + } + + /// State of the operation on the resource. + public ElasticSanProvisioningState? ProvisioningState { get; } + /// Size of Source Volume. + public long? SourceVolumeSizeGiB { get; } + /// Source Volume Name of a snapshot. + public string VolumeName { get; } + } +} diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanSnapshotResource.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanSnapshotResource.cs new file mode 100644 index 000000000000..c732b6f8cf03 --- /dev/null +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanSnapshotResource.cs @@ -0,0 +1,297 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ElasticSan +{ + /// + /// A Class representing an ElasticSanSnapshot along with the instance operations that can be performed on it. + /// If you have a you can construct an + /// from an instance of using the GetElasticSanSnapshotResource method. + /// Otherwise you can get one from its parent resource using the GetElasticSanSnapshot method. + /// + public partial class ElasticSanSnapshotResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string snapshotName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/snapshots/{snapshotName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _elasticSanSnapshotVolumeSnapshotsClientDiagnostics; + private readonly VolumeSnapshotsRestOperations _elasticSanSnapshotVolumeSnapshotsRestClient; + private readonly ElasticSanSnapshotData _data; + + /// Initializes a new instance of the class for mocking. + protected ElasticSanSnapshotResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ElasticSanSnapshotResource(ArmClient client, ElasticSanSnapshotData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ElasticSanSnapshotResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _elasticSanSnapshotVolumeSnapshotsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ElasticSan", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string elasticSanSnapshotVolumeSnapshotsApiVersion); + _elasticSanSnapshotVolumeSnapshotsRestClient = new VolumeSnapshotsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, elasticSanSnapshotVolumeSnapshotsApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ElasticSan/elasticSans/volumegroups/snapshots"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual ElasticSanSnapshotData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Get a Volume Snapshot. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/snapshots/{snapshotName} + /// + /// + /// Operation Id + /// VolumeSnapshots_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _elasticSanSnapshotVolumeSnapshotsClientDiagnostics.CreateScope("ElasticSanSnapshotResource.Get"); + scope.Start(); + try + { + var response = await _elasticSanSnapshotVolumeSnapshotsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ElasticSanSnapshotResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a Volume Snapshot. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/snapshots/{snapshotName} + /// + /// + /// Operation Id + /// VolumeSnapshots_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _elasticSanSnapshotVolumeSnapshotsClientDiagnostics.CreateScope("ElasticSanSnapshotResource.Get"); + scope.Start(); + try + { + var response = _elasticSanSnapshotVolumeSnapshotsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ElasticSanSnapshotResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a Volume Snapshot. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/snapshots/{snapshotName} + /// + /// + /// Operation Id + /// VolumeSnapshots_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _elasticSanSnapshotVolumeSnapshotsClientDiagnostics.CreateScope("ElasticSanSnapshotResource.Delete"); + scope.Start(); + try + { + var response = await _elasticSanSnapshotVolumeSnapshotsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new ElasticSanArmOperation(_elasticSanSnapshotVolumeSnapshotsClientDiagnostics, Pipeline, _elasticSanSnapshotVolumeSnapshotsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a Volume Snapshot. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/snapshots/{snapshotName} + /// + /// + /// Operation Id + /// VolumeSnapshots_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _elasticSanSnapshotVolumeSnapshotsClientDiagnostics.CreateScope("ElasticSanSnapshotResource.Delete"); + scope.Start(); + try + { + var response = _elasticSanSnapshotVolumeSnapshotsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new ElasticSanArmOperation(_elasticSanSnapshotVolumeSnapshotsClientDiagnostics, Pipeline, _elasticSanSnapshotVolumeSnapshotsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a Volume Snapshot. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/snapshots/{snapshotName} + /// + /// + /// Operation Id + /// VolumeSnapshots_Create + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Snapshot object. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, ElasticSanSnapshotData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _elasticSanSnapshotVolumeSnapshotsClientDiagnostics.CreateScope("ElasticSanSnapshotResource.Update"); + scope.Start(); + try + { + var response = await _elasticSanSnapshotVolumeSnapshotsRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new ElasticSanArmOperation(new ElasticSanSnapshotOperationSource(Client), _elasticSanSnapshotVolumeSnapshotsClientDiagnostics, Pipeline, _elasticSanSnapshotVolumeSnapshotsRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a Volume Snapshot. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/snapshots/{snapshotName} + /// + /// + /// Operation Id + /// VolumeSnapshots_Create + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Snapshot object. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, ElasticSanSnapshotData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _elasticSanSnapshotVolumeSnapshotsClientDiagnostics.CreateScope("ElasticSanSnapshotResource.Update"); + scope.Start(); + try + { + var response = _elasticSanSnapshotVolumeSnapshotsRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new ElasticSanArmOperation(new ElasticSanSnapshotOperationSource(Client), _elasticSanSnapshotVolumeSnapshotsClientDiagnostics, Pipeline, _elasticSanSnapshotVolumeSnapshotsRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeData.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeData.cs index 175544419196..b0cf5b50c3a7 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeData.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeData.cs @@ -34,12 +34,16 @@ public ElasticSanVolumeData(long sizeGiB) /// State of the operation on the resource. /// Volume size. /// Storage target information. - internal ElasticSanVolumeData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, Guid? volumeId, ElasticSanVolumeDataSourceInfo creationData, long sizeGiB, IscsiTargetInfo storageTarget) : base(id, name, resourceType, systemData) + /// Parent resource information. + /// State of the operation on the resource. + internal ElasticSanVolumeData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, Guid? volumeId, ElasticSanVolumeDataSourceInfo creationData, long sizeGiB, IscsiTargetInfo storageTarget, ManagedByInfo managedBy, ElasticSanProvisioningState? provisioningState) : base(id, name, resourceType, systemData) { VolumeId = volumeId; CreationData = creationData; SizeGiB = sizeGiB; StorageTarget = storageTarget; + ManagedBy = managedBy; + ProvisioningState = provisioningState; } /// Unique Id of the volume in GUID format. @@ -50,5 +54,21 @@ internal ElasticSanVolumeData(ResourceIdentifier id, string name, ResourceType r public long SizeGiB { get; set; } /// Storage target information. public IscsiTargetInfo StorageTarget { get; } + /// Parent resource information. + internal ManagedByInfo ManagedBy { get; set; } + /// Resource ID of the resource managing the volume, this is a restricted field and can only be set for internal use. + public ResourceIdentifier ManagedByResourceId + { + get => ManagedBy is null ? default : ManagedBy.ResourceId; + set + { + if (ManagedBy is null) + ManagedBy = new ManagedByInfo(); + ManagedBy.ResourceId = value; + } + } + + /// State of the operation on the resource. + public ElasticSanProvisioningState? ProvisioningState { get; } } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeGroupData.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeGroupData.cs index 6344fd39c3ea..c0adb833f8d6 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeGroupData.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeGroupData.cs @@ -29,26 +29,34 @@ public ElasticSanVolumeGroupData() /// The name. /// The resourceType. /// The systemData. + /// The identity of the resource. Current supported identity types: None, SystemAssigned, UserAssigned. /// State of the operation on the resource. /// Type of storage target. /// Type of encryption. + /// Encryption Properties describing Key Vault and Identity information. /// A collection of rules governing the accessibility from specific network locations. /// The list of Private Endpoint Connections. - internal ElasticSanVolumeGroupData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ElasticSanProvisioningState? provisioningState, StorageTargetType? protocolType, ElasticSanEncryptionType? encryption, NetworkRuleSet networkAcls, IReadOnlyList privateEndpointConnections) : base(id, name, resourceType, systemData) + internal ElasticSanVolumeGroupData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ManagedServiceIdentity identity, ElasticSanProvisioningState? provisioningState, StorageTargetType? protocolType, ElasticSanEncryptionType? encryption, Models.EncryptionProperties encryptionProperties, NetworkRuleSet networkAcls, IReadOnlyList privateEndpointConnections) : base(id, name, resourceType, systemData) { + Identity = identity; ProvisioningState = provisioningState; ProtocolType = protocolType; Encryption = encryption; + EncryptionProperties = encryptionProperties; NetworkAcls = networkAcls; PrivateEndpointConnections = privateEndpointConnections; } + /// The identity of the resource. Current supported identity types: None, SystemAssigned, UserAssigned. + public ManagedServiceIdentity Identity { get; set; } /// State of the operation on the resource. public ElasticSanProvisioningState? ProvisioningState { get; } /// Type of storage target. public StorageTargetType? ProtocolType { get; set; } /// Type of encryption. public ElasticSanEncryptionType? Encryption { get; set; } + /// Encryption Properties describing Key Vault and Identity information. + public Models.EncryptionProperties EncryptionProperties { get; set; } /// A collection of rules governing the accessibility from specific network locations. internal NetworkRuleSet NetworkAcls { get; set; } /// The list of virtual network rules. diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeGroupResource.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeGroupResource.cs index 50f065ce9f32..1777fb05476c 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeGroupResource.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeGroupResource.cs @@ -140,6 +140,59 @@ public virtual Response GetElasticSanVolume(string vol return GetElasticSanVolumes().Get(volumeName, cancellationToken); } + /// Gets a collection of ElasticSanSnapshotResources in the ElasticSanVolumeGroup. + /// An object representing collection of ElasticSanSnapshotResources and their operations over a ElasticSanSnapshotResource. + public virtual ElasticSanSnapshotCollection GetElasticSanSnapshots() + { + return GetCachedClient(Client => new ElasticSanSnapshotCollection(Client, Id)); + } + + /// + /// Get a Volume Snapshot. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/snapshots/{snapshotName} + /// + /// + /// Operation Id + /// VolumeSnapshots_Get + /// + /// + /// + /// The name of the volume snapshot within the given volume group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetElasticSanSnapshotAsync(string snapshotName, CancellationToken cancellationToken = default) + { + return await GetElasticSanSnapshots().GetAsync(snapshotName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a Volume Snapshot. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/snapshots/{snapshotName} + /// + /// + /// Operation Id + /// VolumeSnapshots_Get + /// + /// + /// + /// The name of the volume snapshot within the given volume group. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetElasticSanSnapshot(string snapshotName, CancellationToken cancellationToken = default) + { + return GetElasticSanSnapshots().Get(snapshotName, cancellationToken); + } + /// /// Get an VolumeGroups. /// diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeResource.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeResource.cs index b025f574b74b..2c100aca7126 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeResource.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeResource.cs @@ -165,15 +165,17 @@ public virtual Response Get(CancellationToken cancella /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Optional, used to delete snapshots under volume. Allowed value are only true or false. Default value is false. + /// Optional, used to delete volume if active sessions present. Allowed value are only true or false. Default value is false. /// The cancellation token to use. - public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + public virtual async Task DeleteAsync(WaitUntil waitUntil, XMsDeleteSnapshot? xMsDeleteSnapshots = null, XMsForceDelete? xMsForceDelete = null, CancellationToken cancellationToken = default) { using var scope = _elasticSanVolumeVolumesClientDiagnostics.CreateScope("ElasticSanVolumeResource.Delete"); scope.Start(); try { - var response = await _elasticSanVolumeVolumesRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new ElasticSanArmOperation(_elasticSanVolumeVolumesClientDiagnostics, Pipeline, _elasticSanVolumeVolumesRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = await _elasticSanVolumeVolumesRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, xMsDeleteSnapshots, xMsForceDelete, cancellationToken).ConfigureAwait(false); + var operation = new ElasticSanArmOperation(_elasticSanVolumeVolumesClientDiagnostics, Pipeline, _elasticSanVolumeVolumesRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, xMsDeleteSnapshots, xMsForceDelete).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -199,15 +201,17 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Optional, used to delete snapshots under volume. Allowed value are only true or false. Default value is false. + /// Optional, used to delete volume if active sessions present. Allowed value are only true or false. Default value is false. /// The cancellation token to use. - public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + public virtual ArmOperation Delete(WaitUntil waitUntil, XMsDeleteSnapshot? xMsDeleteSnapshots = null, XMsForceDelete? xMsForceDelete = null, CancellationToken cancellationToken = default) { using var scope = _elasticSanVolumeVolumesClientDiagnostics.CreateScope("ElasticSanVolumeResource.Delete"); scope.Start(); try { - var response = _elasticSanVolumeVolumesRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new ElasticSanArmOperation(_elasticSanVolumeVolumesClientDiagnostics, Pipeline, _elasticSanVolumeVolumesRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = _elasticSanVolumeVolumesRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, xMsDeleteSnapshots, xMsForceDelete, cancellationToken); + var operation = new ElasticSanArmOperation(_elasticSanVolumeVolumesClientDiagnostics, Pipeline, _elasticSanVolumeVolumesRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, xMsDeleteSnapshots, xMsForceDelete).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); return operation; diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Extensions/ElasticSanExtensions.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Extensions/ElasticSanExtensions.cs index 46c8d8d790bb..69b72688e23b 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Extensions/ElasticSanExtensions.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Extensions/ElasticSanExtensions.cs @@ -126,6 +126,25 @@ public static ElasticSanPrivateEndpointConnectionResource GetElasticSanPrivateEn } #endregion + #region ElasticSanSnapshotResource + /// + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ElasticSanSnapshotResource GetElasticSanSnapshotResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + ElasticSanSnapshotResource.ValidateResourceId(id); + return new ElasticSanSnapshotResource(client, id); + } + ); + } + #endregion + /// Gets a collection of ElasticSanResources in the ResourceGroupResource. /// The instance the method will execute against. /// An object representing collection of ElasticSanResources and their operations over a ElasticSanResource. diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/LongRunningOperation/ElasticSanSnapshotOperationSource.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/LongRunningOperation/ElasticSanSnapshotOperationSource.cs new file mode 100644 index 000000000000..70065722d954 --- /dev/null +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/LongRunningOperation/ElasticSanSnapshotOperationSource.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ElasticSan +{ + internal class ElasticSanSnapshotOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal ElasticSanSnapshotOperationSource(ArmClient client) + { + _client = client; + } + + ElasticSanSnapshotResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = ElasticSanSnapshotData.DeserializeElasticSanSnapshotData(document.RootElement); + return new ElasticSanSnapshotResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = ElasticSanSnapshotData.DeserializeElasticSanSnapshotData(document.RootElement); + return new ElasticSanSnapshotResource(_client, data); + } + } +} diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanData.Serialization.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanData.Serialization.cs index 127b3e93e1c5..a84f747d9959 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanData.Serialization.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanData.Serialization.cs @@ -49,6 +49,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteNumberValue(BaseSizeTiB); writer.WritePropertyName("extendedCapacitySizeTiB"u8); writer.WriteNumberValue(ExtendedCapacitySizeTiB); + if (Optional.IsDefined(PublicNetworkAccess)) + { + writer.WritePropertyName("publicNetworkAccess"u8); + writer.WriteStringValue(PublicNetworkAccess.Value.ToString()); + } writer.WriteEndObject(); writer.WriteEndObject(); } @@ -76,6 +81,7 @@ internal static ElasticSanData DeserializeElasticSanData(JsonElement element) Optional totalMbps = default; Optional totalSizeTiB = default; Optional> privateEndpointConnections = default; + Optional publicNetworkAccess = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("tags"u8)) @@ -227,11 +233,20 @@ internal static ElasticSanData DeserializeElasticSanData(JsonElement element) privateEndpointConnections = array; continue; } + if (property0.NameEquals("publicNetworkAccess"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + publicNetworkAccess = new PublicNetworkAccess(property0.Value.GetString()); + continue; + } } continue; } } - return new ElasticSanData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, sku, Optional.ToList(availabilityZones), Optional.ToNullable(provisioningState), baseSizeTiB, extendedCapacitySizeTiB, Optional.ToNullable(totalVolumeSizeGiB), Optional.ToNullable(volumeGroupCount), Optional.ToNullable(totalIops), Optional.ToNullable(totalMbps), Optional.ToNullable(totalSizeTiB), Optional.ToList(privateEndpointConnections)); + return new ElasticSanData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, sku, Optional.ToList(availabilityZones), Optional.ToNullable(provisioningState), baseSizeTiB, extendedCapacitySizeTiB, Optional.ToNullable(totalVolumeSizeGiB), Optional.ToNullable(volumeGroupCount), Optional.ToNullable(totalIops), Optional.ToNullable(totalMbps), Optional.ToNullable(totalSizeTiB), Optional.ToList(privateEndpointConnections), Optional.ToNullable(publicNetworkAccess)); } } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanEncryptionType.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanEncryptionType.cs index 6bf47961d07f..984fb049f439 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanEncryptionType.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanEncryptionType.cs @@ -23,9 +23,12 @@ public ElasticSanEncryptionType(string value) } private const string EncryptionAtRestWithPlatformKeyValue = "EncryptionAtRestWithPlatformKey"; + private const string EncryptionAtRestWithCustomerManagedKeyValue = "EncryptionAtRestWithCustomerManagedKey"; /// Volume is encrypted at rest with Platform managed key. It is the default encryption type. public static ElasticSanEncryptionType EncryptionAtRestWithPlatformKey { get; } = new ElasticSanEncryptionType(EncryptionAtRestWithPlatformKeyValue); + /// Volume is encrypted at rest with Customer managed key that can be changed and revoked by a customer. + public static ElasticSanEncryptionType EncryptionAtRestWithCustomerManagedKey { get; } = new ElasticSanEncryptionType(EncryptionAtRestWithCustomerManagedKeyValue); /// Determines if two values are the same. public static bool operator ==(ElasticSanEncryptionType left, ElasticSanEncryptionType right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanPatch.Serialization.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanPatch.Serialization.cs index e823d0b85312..a68d9201eb3c 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanPatch.Serialization.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanPatch.Serialization.cs @@ -38,6 +38,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("extendedCapacitySizeTiB"u8); writer.WriteNumberValue(ExtendedCapacitySizeTiB.Value); } + if (Optional.IsDefined(PublicNetworkAccess)) + { + writer.WritePropertyName("publicNetworkAccess"u8); + writer.WriteStringValue(PublicNetworkAccess.Value.ToString()); + } writer.WriteEndObject(); writer.WriteEndObject(); } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanPatch.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanPatch.cs index 026fe6c1c2bb..82bf7dba1611 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanPatch.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanPatch.cs @@ -25,5 +25,7 @@ public ElasticSanPatch() public long? BaseSizeTiB { get; set; } /// Extended size of the Elastic San appliance in TiB. public long? ExtendedCapacitySizeTiB { get; set; } + /// Allow or disallow public network access to ElasticSan Account. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. + public PublicNetworkAccess? PublicNetworkAccess { get; set; } } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanSnapshotData.Serialization.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanSnapshotData.Serialization.cs new file mode 100644 index 000000000000..b609820643af --- /dev/null +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanSnapshotData.Serialization.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.ElasticSan.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ElasticSan +{ + public partial class ElasticSanSnapshotData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + writer.WritePropertyName("creationData"u8); + writer.WriteObjectValue(CreationData); + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static ElasticSanSnapshotData DeserializeElasticSanSnapshotData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + SnapshotCreationData creationData = default; + Optional provisioningState = default; + Optional sourceVolumeSizeGiB = default; + Optional volumeName = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("creationData"u8)) + { + creationData = SnapshotCreationData.DeserializeSnapshotCreationData(property0.Value); + continue; + } + if (property0.NameEquals("provisioningState"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ElasticSanProvisioningState(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("sourceVolumeSizeGiB"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sourceVolumeSizeGiB = property0.Value.GetInt64(); + continue; + } + if (property0.NameEquals("volumeName"u8)) + { + volumeName = property0.Value.GetString(); + continue; + } + } + continue; + } + } + return new ElasticSanSnapshotData(id, name, type, systemData.Value, creationData, Optional.ToNullable(provisioningState), Optional.ToNullable(sourceVolumeSizeGiB), volumeName.Value); + } + } +} diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVirtualNetworkRule.Serialization.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVirtualNetworkRule.Serialization.cs index bc93ca01d887..e87102e76014 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVirtualNetworkRule.Serialization.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVirtualNetworkRule.Serialization.cs @@ -33,7 +33,6 @@ internal static ElasticSanVirtualNetworkRule DeserializeElasticSanVirtualNetwork } ResourceIdentifier id = default; Optional action = default; - Optional state = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -50,17 +49,8 @@ internal static ElasticSanVirtualNetworkRule DeserializeElasticSanVirtualNetwork action = new ElasticSanVirtualNetworkRuleAction(property.Value.GetString()); continue; } - if (property.NameEquals("state"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - state = property.Value.GetString().ToElasticSanVirtualNetworkRuleState(); - continue; - } } - return new ElasticSanVirtualNetworkRule(id, Optional.ToNullable(action), Optional.ToNullable(state)); + return new ElasticSanVirtualNetworkRule(id, Optional.ToNullable(action)); } } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVirtualNetworkRule.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVirtualNetworkRule.cs index 23d2a0cf0be8..b8c34d58c89e 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVirtualNetworkRule.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVirtualNetworkRule.cs @@ -26,19 +26,15 @@ public ElasticSanVirtualNetworkRule(ResourceIdentifier virtualNetworkResourceId) /// Initializes a new instance of ElasticSanVirtualNetworkRule. /// Resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. /// The action of virtual network rule. - /// Gets the state of virtual network rule. - internal ElasticSanVirtualNetworkRule(ResourceIdentifier virtualNetworkResourceId, ElasticSanVirtualNetworkRuleAction? action, ElasticSanVirtualNetworkRuleState? state) + internal ElasticSanVirtualNetworkRule(ResourceIdentifier virtualNetworkResourceId, ElasticSanVirtualNetworkRuleAction? action) { VirtualNetworkResourceId = virtualNetworkResourceId; Action = action; - State = state; } /// Resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. public ResourceIdentifier VirtualNetworkResourceId { get; set; } /// The action of virtual network rule. public ElasticSanVirtualNetworkRuleAction? Action { get; set; } - /// Gets the state of virtual network rule. - public ElasticSanVirtualNetworkRuleState? State { get; } } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVirtualNetworkRuleState.Serialization.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVirtualNetworkRuleState.Serialization.cs deleted file mode 100644 index ba588f2c42bb..000000000000 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVirtualNetworkRuleState.Serialization.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.ResourceManager.ElasticSan.Models -{ - internal static partial class ElasticSanVirtualNetworkRuleStateExtensions - { - public static string ToSerialString(this ElasticSanVirtualNetworkRuleState value) => value switch - { - ElasticSanVirtualNetworkRuleState.Provisioning => "provisioning", - ElasticSanVirtualNetworkRuleState.Deprovisioning => "deprovisioning", - ElasticSanVirtualNetworkRuleState.Succeeded => "succeeded", - ElasticSanVirtualNetworkRuleState.Failed => "failed", - ElasticSanVirtualNetworkRuleState.NetworkSourceDeleted => "networkSourceDeleted", - _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown ElasticSanVirtualNetworkRuleState value.") - }; - - public static ElasticSanVirtualNetworkRuleState ToElasticSanVirtualNetworkRuleState(this string value) - { - if (StringComparer.OrdinalIgnoreCase.Equals(value, "provisioning")) return ElasticSanVirtualNetworkRuleState.Provisioning; - if (StringComparer.OrdinalIgnoreCase.Equals(value, "deprovisioning")) return ElasticSanVirtualNetworkRuleState.Deprovisioning; - if (StringComparer.OrdinalIgnoreCase.Equals(value, "succeeded")) return ElasticSanVirtualNetworkRuleState.Succeeded; - if (StringComparer.OrdinalIgnoreCase.Equals(value, "failed")) return ElasticSanVirtualNetworkRuleState.Failed; - if (StringComparer.OrdinalIgnoreCase.Equals(value, "networkSourceDeleted")) return ElasticSanVirtualNetworkRuleState.NetworkSourceDeleted; - throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown ElasticSanVirtualNetworkRuleState value."); - } - } -} diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVirtualNetworkRuleState.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVirtualNetworkRuleState.cs deleted file mode 100644 index 4fa765e5085b..000000000000 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVirtualNetworkRuleState.cs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.ResourceManager.ElasticSan.Models -{ - /// Gets the state of virtual network rule. - public enum ElasticSanVirtualNetworkRuleState - { - /// provisioning. - Provisioning, - /// deprovisioning. - Deprovisioning, - /// succeeded. - Succeeded, - /// failed. - Failed, - /// networkSourceDeleted. - NetworkSourceDeleted - } -} diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeCreateOption.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeCreateOption.cs index d7efe57a76bc..08efcd09feda 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeCreateOption.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeCreateOption.cs @@ -23,9 +23,21 @@ public ElasticSanVolumeCreateOption(string value) } private const string NoneValue = "None"; + private const string VolumeSnapshotValue = "VolumeSnapshot"; + private const string DiskSnapshotValue = "DiskSnapshot"; + private const string DiskValue = "Disk"; + private const string DiskRestorePointValue = "DiskRestorePoint"; /// None. public static ElasticSanVolumeCreateOption None { get; } = new ElasticSanVolumeCreateOption(NoneValue); + /// VolumeSnapshot. + public static ElasticSanVolumeCreateOption VolumeSnapshot { get; } = new ElasticSanVolumeCreateOption(VolumeSnapshotValue); + /// DiskSnapshot. + public static ElasticSanVolumeCreateOption DiskSnapshot { get; } = new ElasticSanVolumeCreateOption(DiskSnapshotValue); + /// Disk. + public static ElasticSanVolumeCreateOption Disk { get; } = new ElasticSanVolumeCreateOption(DiskValue); + /// DiskRestorePoint. + public static ElasticSanVolumeCreateOption DiskRestorePoint { get; } = new ElasticSanVolumeCreateOption(DiskRestorePointValue); /// Determines if two values are the same. public static bool operator ==(ElasticSanVolumeCreateOption left, ElasticSanVolumeCreateOption right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeData.Serialization.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeData.Serialization.cs index c53b7701a310..a8dd37de42af 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeData.Serialization.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeData.Serialization.cs @@ -27,6 +27,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("sizeGiB"u8); writer.WriteNumberValue(SizeGiB); + if (Optional.IsDefined(ManagedBy)) + { + writer.WritePropertyName("managedBy"u8); + writer.WriteObjectValue(ManagedBy); + } writer.WriteEndObject(); writer.WriteEndObject(); } @@ -45,6 +50,8 @@ internal static ElasticSanVolumeData DeserializeElasticSanVolumeData(JsonElement Optional creationData = default; long sizeGiB = default; Optional storageTarget = default; + Optional managedBy = default; + Optional provisioningState = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -112,11 +119,29 @@ internal static ElasticSanVolumeData DeserializeElasticSanVolumeData(JsonElement storageTarget = IscsiTargetInfo.DeserializeIscsiTargetInfo(property0.Value); continue; } + if (property0.NameEquals("managedBy"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + managedBy = ManagedByInfo.DeserializeManagedByInfo(property0.Value); + continue; + } + if (property0.NameEquals("provisioningState"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ElasticSanProvisioningState(property0.Value.GetString()); + continue; + } } continue; } } - return new ElasticSanVolumeData(id, name, type, systemData.Value, Optional.ToNullable(volumeId), creationData.Value, sizeGiB, storageTarget.Value); + return new ElasticSanVolumeData(id, name, type, systemData.Value, Optional.ToNullable(volumeId), creationData.Value, sizeGiB, storageTarget.Value, managedBy.Value, Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeDataSourceInfo.Serialization.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeDataSourceInfo.Serialization.cs index 466c2c668c4b..14bb4bfebc6f 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeDataSourceInfo.Serialization.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeDataSourceInfo.Serialization.cs @@ -5,7 +5,6 @@ #nullable disable -using System; using System.Text.Json; using Azure.Core; @@ -21,10 +20,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("createSource"u8); writer.WriteStringValue(CreateSource.Value.ToString()); } - if (Optional.IsDefined(SourceUri)) + if (Optional.IsDefined(SourceId)) { - writer.WritePropertyName("sourceUri"u8); - writer.WriteStringValue(SourceUri.AbsoluteUri); + writer.WritePropertyName("sourceId"u8); + writer.WriteStringValue(SourceId); } writer.WriteEndObject(); } @@ -36,7 +35,7 @@ internal static ElasticSanVolumeDataSourceInfo DeserializeElasticSanVolumeDataSo return null; } Optional createSource = default; - Optional sourceUri = default; + Optional sourceId = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("createSource"u8)) @@ -48,17 +47,17 @@ internal static ElasticSanVolumeDataSourceInfo DeserializeElasticSanVolumeDataSo createSource = new ElasticSanVolumeCreateOption(property.Value.GetString()); continue; } - if (property.NameEquals("sourceUri"u8)) + if (property.NameEquals("sourceId"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - sourceUri = new Uri(property.Value.GetString()); + sourceId = new ResourceIdentifier(property.Value.GetString()); continue; } } - return new ElasticSanVolumeDataSourceInfo(Optional.ToNullable(createSource), sourceUri.Value); + return new ElasticSanVolumeDataSourceInfo(Optional.ToNullable(createSource), sourceId.Value); } } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeDataSourceInfo.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeDataSourceInfo.cs index 3902ebbd1df6..567729f3b46d 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeDataSourceInfo.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeDataSourceInfo.cs @@ -5,7 +5,7 @@ #nullable disable -using System; +using Azure.Core; namespace Azure.ResourceManager.ElasticSan.Models { @@ -19,16 +19,16 @@ public ElasticSanVolumeDataSourceInfo() /// Initializes a new instance of ElasticSanVolumeDataSourceInfo. /// This enumerates the possible sources of a volume creation. - /// If createOption is Copy, this is the ARM id of the source snapshot or disk. If createOption is Restore, this is the ARM-like id of the source disk restore point. - internal ElasticSanVolumeDataSourceInfo(ElasticSanVolumeCreateOption? createSource, Uri sourceUri) + /// Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + internal ElasticSanVolumeDataSourceInfo(ElasticSanVolumeCreateOption? createSource, ResourceIdentifier sourceId) { CreateSource = createSource; - SourceUri = sourceUri; + SourceId = sourceId; } /// This enumerates the possible sources of a volume creation. public ElasticSanVolumeCreateOption? CreateSource { get; set; } - /// If createOption is Copy, this is the ARM id of the source snapshot or disk. If createOption is Restore, this is the ARM-like id of the source disk restore point. - public Uri SourceUri { get; set; } + /// Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + public ResourceIdentifier SourceId { get; set; } } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeGroupData.Serialization.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeGroupData.Serialization.cs index e551cb582dce..1a70bee6b607 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeGroupData.Serialization.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeGroupData.Serialization.cs @@ -18,6 +18,11 @@ public partial class ElasticSanVolumeGroupData : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"u8); + JsonSerializer.Serialize(writer, Identity); + } writer.WritePropertyName("properties"u8); writer.WriteStartObject(); if (Optional.IsDefined(ProtocolType)) @@ -30,6 +35,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("encryption"u8); writer.WriteStringValue(Encryption.Value.ToString()); } + if (Optional.IsDefined(EncryptionProperties)) + { + writer.WritePropertyName("encryptionProperties"u8); + writer.WriteObjectValue(EncryptionProperties); + } if (Optional.IsDefined(NetworkAcls)) { writer.WritePropertyName("networkAcls"u8); @@ -45,6 +55,7 @@ internal static ElasticSanVolumeGroupData DeserializeElasticSanVolumeGroupData(J { return null; } + Optional identity = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; @@ -52,10 +63,20 @@ internal static ElasticSanVolumeGroupData DeserializeElasticSanVolumeGroupData(J Optional provisioningState = default; Optional protocolType = default; Optional encryption = default; + Optional encryptionProperties = default; Optional networkAcls = default; Optional> privateEndpointConnections = default; foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("identity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identity = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } if (property.NameEquals("id"u8)) { id = new ResourceIdentifier(property.Value.GetString()); @@ -116,6 +137,15 @@ internal static ElasticSanVolumeGroupData DeserializeElasticSanVolumeGroupData(J encryption = new ElasticSanEncryptionType(property0.Value.GetString()); continue; } + if (property0.NameEquals("encryptionProperties"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + encryptionProperties = Models.EncryptionProperties.DeserializeEncryptionProperties(property0.Value); + continue; + } if (property0.NameEquals("networkAcls"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -143,7 +173,7 @@ internal static ElasticSanVolumeGroupData DeserializeElasticSanVolumeGroupData(J continue; } } - return new ElasticSanVolumeGroupData(id, name, type, systemData.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(protocolType), Optional.ToNullable(encryption), networkAcls.Value, Optional.ToList(privateEndpointConnections)); + return new ElasticSanVolumeGroupData(id, name, type, systemData.Value, identity, Optional.ToNullable(provisioningState), Optional.ToNullable(protocolType), Optional.ToNullable(encryption), encryptionProperties.Value, networkAcls.Value, Optional.ToList(privateEndpointConnections)); } } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeGroupPatch.Serialization.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeGroupPatch.Serialization.cs index 604d32952973..8df85506632a 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeGroupPatch.Serialization.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeGroupPatch.Serialization.cs @@ -15,6 +15,11 @@ public partial class ElasticSanVolumeGroupPatch : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"u8); + JsonSerializer.Serialize(writer, Identity); + } writer.WritePropertyName("properties"u8); writer.WriteStartObject(); if (Optional.IsDefined(ProtocolType)) @@ -27,6 +32,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("encryption"u8); writer.WriteStringValue(Encryption.Value.ToString()); } + if (Optional.IsDefined(EncryptionProperties)) + { + writer.WritePropertyName("encryptionProperties"u8); + writer.WriteObjectValue(EncryptionProperties); + } if (Optional.IsDefined(NetworkAcls)) { writer.WritePropertyName("networkAcls"u8); diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeGroupPatch.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeGroupPatch.cs index 6abd0fa60b6a..f733439f2de8 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeGroupPatch.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeGroupPatch.cs @@ -6,6 +6,7 @@ #nullable disable using System.Collections.Generic; +using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ElasticSan.Models { @@ -17,10 +18,14 @@ public ElasticSanVolumeGroupPatch() { } + /// The identity of the resource. Current supported identity types: None, SystemAssigned, UserAssigned. + public ManagedServiceIdentity Identity { get; set; } /// Type of storage target. public StorageTargetType? ProtocolType { get; set; } /// Type of encryption. public ElasticSanEncryptionType? Encryption { get; set; } + /// Encryption Properties describing Key Vault and Identity information. + public EncryptionProperties EncryptionProperties { get; set; } /// A collection of rules governing the accessibility from specific network locations. internal NetworkRuleSet NetworkAcls { get; set; } /// The list of virtual network rules. diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumePatch.Serialization.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumePatch.Serialization.cs index 697acc6bec9e..1489e8d3b046 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumePatch.Serialization.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumePatch.Serialization.cs @@ -22,6 +22,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("sizeGiB"u8); writer.WriteNumberValue(SizeGiB.Value); } + if (Optional.IsDefined(ManagedBy)) + { + writer.WritePropertyName("managedBy"u8); + writer.WriteObjectValue(ManagedBy); + } writer.WriteEndObject(); writer.WriteEndObject(); } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumePatch.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumePatch.cs index 38d6f7472c45..aaf7a7b86221 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumePatch.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumePatch.cs @@ -5,6 +5,8 @@ #nullable disable +using Azure.Core; + namespace Azure.ResourceManager.ElasticSan.Models { /// Response for Volume request. @@ -17,5 +19,18 @@ public ElasticSanVolumePatch() /// Volume size. public long? SizeGiB { get; set; } + /// Parent resource information. + internal ManagedByInfo ManagedBy { get; set; } + /// Resource ID of the resource managing the volume, this is a restricted field and can only be set for internal use. + public ResourceIdentifier ManagedByResourceId + { + get => ManagedBy is null ? default : ManagedBy.ResourceId; + set + { + if (ManagedBy is null) + ManagedBy = new ManagedByInfo(); + ManagedBy.ResourceId = value; + } + } } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/EncryptionIdentity.Serialization.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/EncryptionIdentity.Serialization.cs new file mode 100644 index 000000000000..f7b0d29d12dc --- /dev/null +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/EncryptionIdentity.Serialization.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ElasticSan.Models +{ + internal partial class EncryptionIdentity : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(EncryptionUserAssignedIdentity)) + { + writer.WritePropertyName("userAssignedIdentity"u8); + writer.WriteStringValue(EncryptionUserAssignedIdentity); + } + writer.WriteEndObject(); + } + + internal static EncryptionIdentity DeserializeEncryptionIdentity(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional userAssignedIdentity = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("userAssignedIdentity"u8)) + { + userAssignedIdentity = property.Value.GetString(); + continue; + } + } + return new EncryptionIdentity(userAssignedIdentity.Value); + } + } +} diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/EncryptionIdentity.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/EncryptionIdentity.cs new file mode 100644 index 000000000000..1d724189588f --- /dev/null +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/EncryptionIdentity.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.ElasticSan.Models +{ + /// Encryption identity for the volume group. + internal partial class EncryptionIdentity + { + /// Initializes a new instance of EncryptionIdentity. + public EncryptionIdentity() + { + } + + /// Initializes a new instance of EncryptionIdentity. + /// Resource identifier of the UserAssigned identity to be associated with server-side encryption on the volume group. + internal EncryptionIdentity(string encryptionUserAssignedIdentity) + { + EncryptionUserAssignedIdentity = encryptionUserAssignedIdentity; + } + + /// Resource identifier of the UserAssigned identity to be associated with server-side encryption on the volume group. + public string EncryptionUserAssignedIdentity { get; set; } + } +} diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/EncryptionProperties.Serialization.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/EncryptionProperties.Serialization.cs new file mode 100644 index 000000000000..b810ec0b1ac7 --- /dev/null +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/EncryptionProperties.Serialization.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ElasticSan.Models +{ + public partial class EncryptionProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(KeyVaultProperties)) + { + writer.WritePropertyName("keyVaultProperties"u8); + writer.WriteObjectValue(KeyVaultProperties); + } + if (Optional.IsDefined(EncryptionIdentity)) + { + writer.WritePropertyName("identity"u8); + writer.WriteObjectValue(EncryptionIdentity); + } + writer.WriteEndObject(); + } + + internal static EncryptionProperties DeserializeEncryptionProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional keyVaultProperties = default; + Optional identity = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("keyVaultProperties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + keyVaultProperties = KeyVaultProperties.DeserializeKeyVaultProperties(property.Value); + continue; + } + if (property.NameEquals("identity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identity = EncryptionIdentity.DeserializeEncryptionIdentity(property.Value); + continue; + } + } + return new EncryptionProperties(keyVaultProperties.Value, identity.Value); + } + } +} diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/EncryptionProperties.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/EncryptionProperties.cs new file mode 100644 index 000000000000..6cd259f5147e --- /dev/null +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/EncryptionProperties.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.ElasticSan.Models +{ + /// The encryption settings on the volume group. + public partial class EncryptionProperties + { + /// Initializes a new instance of EncryptionProperties. + public EncryptionProperties() + { + } + + /// Initializes a new instance of EncryptionProperties. + /// Properties provided by key vault. + /// The identity to be used with service-side encryption at rest. + internal EncryptionProperties(KeyVaultProperties keyVaultProperties, EncryptionIdentity encryptionIdentity) + { + KeyVaultProperties = keyVaultProperties; + EncryptionIdentity = encryptionIdentity; + } + + /// Properties provided by key vault. + public KeyVaultProperties KeyVaultProperties { get; set; } + /// The identity to be used with service-side encryption at rest. + internal EncryptionIdentity EncryptionIdentity { get; set; } + /// Resource identifier of the UserAssigned identity to be associated with server-side encryption on the volume group. + public string EncryptionUserAssignedIdentity + { + get => EncryptionIdentity is null ? default : EncryptionIdentity.EncryptionUserAssignedIdentity; + set + { + if (EncryptionIdentity is null) + EncryptionIdentity = new EncryptionIdentity(); + EncryptionIdentity.EncryptionUserAssignedIdentity = value; + } + } + } +} diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/KeyVaultProperties.Serialization.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/KeyVaultProperties.Serialization.cs new file mode 100644 index 000000000000..ba725b0c0125 --- /dev/null +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/KeyVaultProperties.Serialization.cs @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ElasticSan.Models +{ + public partial class KeyVaultProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(KeyName)) + { + writer.WritePropertyName("keyName"u8); + writer.WriteStringValue(KeyName); + } + if (Optional.IsDefined(KeyVersion)) + { + writer.WritePropertyName("keyVersion"u8); + writer.WriteStringValue(KeyVersion); + } + if (Optional.IsDefined(KeyVaultUri)) + { + writer.WritePropertyName("keyVaultUri"u8); + writer.WriteStringValue(KeyVaultUri.AbsoluteUri); + } + writer.WriteEndObject(); + } + + internal static KeyVaultProperties DeserializeKeyVaultProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional keyName = default; + Optional keyVersion = default; + Optional keyVaultUri = default; + Optional currentVersionedKeyIdentifier = default; + Optional lastKeyRotationTimestamp = default; + Optional currentVersionedKeyExpirationTimestamp = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("keyName"u8)) + { + keyName = property.Value.GetString(); + continue; + } + if (property.NameEquals("keyVersion"u8)) + { + keyVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("keyVaultUri"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + keyVaultUri = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("currentVersionedKeyIdentifier"u8)) + { + currentVersionedKeyIdentifier = property.Value.GetString(); + continue; + } + if (property.NameEquals("lastKeyRotationTimestamp"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastKeyRotationTimestamp = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("currentVersionedKeyExpirationTimestamp"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + currentVersionedKeyExpirationTimestamp = property.Value.GetDateTimeOffset("O"); + continue; + } + } + return new KeyVaultProperties(keyName.Value, keyVersion.Value, keyVaultUri.Value, currentVersionedKeyIdentifier.Value, Optional.ToNullable(lastKeyRotationTimestamp), Optional.ToNullable(currentVersionedKeyExpirationTimestamp)); + } + } +} diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/KeyVaultProperties.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/KeyVaultProperties.cs new file mode 100644 index 000000000000..88f87dbddf56 --- /dev/null +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/KeyVaultProperties.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.ElasticSan.Models +{ + /// Properties of key vault. + public partial class KeyVaultProperties + { + /// Initializes a new instance of KeyVaultProperties. + public KeyVaultProperties() + { + } + + /// Initializes a new instance of KeyVaultProperties. + /// The name of KeyVault key. + /// The version of KeyVault key. + /// The Uri of KeyVault. + /// The object identifier of the current versioned Key Vault Key in use. + /// Timestamp of last rotation of the Key Vault Key. + /// This is a read only property that represents the expiration time of the current version of the customer managed key used for encryption. + internal KeyVaultProperties(string keyName, string keyVersion, Uri keyVaultUri, string currentVersionedKeyIdentifier, DateTimeOffset? lastKeyRotationTimestamp, DateTimeOffset? currentVersionedKeyExpirationTimestamp) + { + KeyName = keyName; + KeyVersion = keyVersion; + KeyVaultUri = keyVaultUri; + CurrentVersionedKeyIdentifier = currentVersionedKeyIdentifier; + LastKeyRotationTimestamp = lastKeyRotationTimestamp; + CurrentVersionedKeyExpirationTimestamp = currentVersionedKeyExpirationTimestamp; + } + + /// The name of KeyVault key. + public string KeyName { get; set; } + /// The version of KeyVault key. + public string KeyVersion { get; set; } + /// The Uri of KeyVault. + public Uri KeyVaultUri { get; set; } + /// The object identifier of the current versioned Key Vault Key in use. + public string CurrentVersionedKeyIdentifier { get; } + /// Timestamp of last rotation of the Key Vault Key. + public DateTimeOffset? LastKeyRotationTimestamp { get; } + /// This is a read only property that represents the expiration time of the current version of the customer managed key used for encryption. + public DateTimeOffset? CurrentVersionedKeyExpirationTimestamp { get; } + } +} diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ManagedByInfo.Serialization.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ManagedByInfo.Serialization.cs new file mode 100644 index 000000000000..0b7a2d9138e3 --- /dev/null +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ManagedByInfo.Serialization.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ElasticSan.Models +{ + internal partial class ManagedByInfo : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ResourceId)) + { + writer.WritePropertyName("resourceId"u8); + writer.WriteStringValue(ResourceId); + } + writer.WriteEndObject(); + } + + internal static ManagedByInfo DeserializeManagedByInfo(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional resourceId = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("resourceId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + } + return new ManagedByInfo(resourceId.Value); + } + } +} diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ManagedByInfo.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ManagedByInfo.cs new file mode 100644 index 000000000000..e13488e7756b --- /dev/null +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ManagedByInfo.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; + +namespace Azure.ResourceManager.ElasticSan.Models +{ + /// Parent resource information. + internal partial class ManagedByInfo + { + /// Initializes a new instance of ManagedByInfo. + public ManagedByInfo() + { + } + + /// Initializes a new instance of ManagedByInfo. + /// Resource ID of the resource managing the volume, this is a restricted field and can only be set for internal use. + internal ManagedByInfo(ResourceIdentifier resourceId) + { + ResourceId = resourceId; + } + + /// Resource ID of the resource managing the volume, this is a restricted field and can only be set for internal use. + public ResourceIdentifier ResourceId { get; set; } + } +} diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/PublicNetworkAccess.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/PublicNetworkAccess.cs new file mode 100644 index 000000000000..cebfce84f67b --- /dev/null +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/PublicNetworkAccess.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ElasticSan.Models +{ + /// Allow or disallow public network access to ElasticSan. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. + public readonly partial struct PublicNetworkAccess : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public PublicNetworkAccess(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string EnabledValue = "Enabled"; + private const string DisabledValue = "Disabled"; + + /// Enabled. + public static PublicNetworkAccess Enabled { get; } = new PublicNetworkAccess(EnabledValue); + /// Disabled. + public static PublicNetworkAccess Disabled { get; } = new PublicNetworkAccess(DisabledValue); + /// Determines if two values are the same. + public static bool operator ==(PublicNetworkAccess left, PublicNetworkAccess right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PublicNetworkAccess left, PublicNetworkAccess right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator PublicNetworkAccess(string value) => new PublicNetworkAccess(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PublicNetworkAccess other && Equals(other); + /// + public bool Equals(PublicNetworkAccess other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/SnapshotCreationData.Serialization.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/SnapshotCreationData.Serialization.cs new file mode 100644 index 000000000000..8d20a55fb32f --- /dev/null +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/SnapshotCreationData.Serialization.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ElasticSan.Models +{ + public partial class SnapshotCreationData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("sourceId"u8); + writer.WriteStringValue(SourceId); + writer.WriteEndObject(); + } + + internal static SnapshotCreationData DeserializeSnapshotCreationData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier sourceId = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("sourceId"u8)) + { + sourceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + } + return new SnapshotCreationData(sourceId); + } + } +} diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/SnapshotCreationData.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/SnapshotCreationData.cs new file mode 100644 index 000000000000..d82b8d70e1d1 --- /dev/null +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/SnapshotCreationData.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.ResourceManager.ElasticSan.Models +{ + /// Data used when creating a volume snapshot. + public partial class SnapshotCreationData + { + /// Initializes a new instance of SnapshotCreationData. + /// Fully qualified resource ID of the volume. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/volumes/{volumeName}". + /// is null. + public SnapshotCreationData(ResourceIdentifier sourceId) + { + Argument.AssertNotNull(sourceId, nameof(sourceId)); + + SourceId = sourceId; + } + + /// Fully qualified resource ID of the volume. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/volumes/{volumeName}". + public ResourceIdentifier SourceId { get; set; } + } +} diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/SnapshotList.Serialization.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/SnapshotList.Serialization.cs new file mode 100644 index 000000000000..6f78b1c7a0d4 --- /dev/null +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/SnapshotList.Serialization.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.ElasticSan; + +namespace Azure.ResourceManager.ElasticSan.Models +{ + internal partial class SnapshotList + { + internal static SnapshotList DeserializeSnapshotList(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ElasticSanSnapshotData.DeserializeElasticSanSnapshotData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new SnapshotList(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/SnapshotList.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/SnapshotList.cs new file mode 100644 index 000000000000..2ddc9f755e22 --- /dev/null +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/SnapshotList.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.ElasticSan; + +namespace Azure.ResourceManager.ElasticSan.Models +{ + /// List of Snapshots. + internal partial class SnapshotList + { + /// Initializes a new instance of SnapshotList. + internal SnapshotList() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of SnapshotList. + /// An array of Snapshot objects. + /// URI to fetch the next section of the paginated response. + internal SnapshotList(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// An array of Snapshot objects. + public IReadOnlyList Value { get; } + /// URI to fetch the next section of the paginated response. + public string NextLink { get; } + } +} diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/XMsDeleteSnapshot.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/XMsDeleteSnapshot.cs new file mode 100644 index 000000000000..7fe4080fd5d7 --- /dev/null +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/XMsDeleteSnapshot.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ElasticSan.Models +{ + /// The XMsDeleteSnapshot. + public readonly partial struct XMsDeleteSnapshot : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public XMsDeleteSnapshot(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string TrueValue = "true"; + private const string FalseValue = "false"; + + /// true. + public static XMsDeleteSnapshot True { get; } = new XMsDeleteSnapshot(TrueValue); + /// false. + public static XMsDeleteSnapshot False { get; } = new XMsDeleteSnapshot(FalseValue); + /// Determines if two values are the same. + public static bool operator ==(XMsDeleteSnapshot left, XMsDeleteSnapshot right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(XMsDeleteSnapshot left, XMsDeleteSnapshot right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator XMsDeleteSnapshot(string value) => new XMsDeleteSnapshot(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is XMsDeleteSnapshot other && Equals(other); + /// + public bool Equals(XMsDeleteSnapshot other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/XMsForceDelete.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/XMsForceDelete.cs new file mode 100644 index 000000000000..249ada673f8a --- /dev/null +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/XMsForceDelete.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ElasticSan.Models +{ + /// The XMsForceDelete. + public readonly partial struct XMsForceDelete : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public XMsForceDelete(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string TrueValue = "true"; + private const string FalseValue = "false"; + + /// true. + public static XMsForceDelete True { get; } = new XMsForceDelete(TrueValue); + /// false. + public static XMsForceDelete False { get; } = new XMsForceDelete(FalseValue); + /// Determines if two values are the same. + public static bool operator ==(XMsForceDelete left, XMsForceDelete right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(XMsForceDelete left, XMsForceDelete right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator XMsForceDelete(string value) => new XMsForceDelete(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is XMsForceDelete other && Equals(other); + /// + public bool Equals(XMsForceDelete other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/RestOperations/ElasticSansRestOperations.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/RestOperations/ElasticSansRestOperations.cs index 2076dabe041c..de8ef0403c49 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/RestOperations/ElasticSansRestOperations.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/RestOperations/ElasticSansRestOperations.cs @@ -33,7 +33,7 @@ public ElasticSansRestOperations(HttpPipeline pipeline, string applicationId, Ur { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-12-01-preview"; + _apiVersion = apiVersion ?? "2023-01-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs index 51cbca844db4..f8d0e561dfa0 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs @@ -33,7 +33,7 @@ public PrivateEndpointConnectionsRestOperations(HttpPipeline pipeline, string ap { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-12-01-preview"; + _apiVersion = apiVersion ?? "2023-01-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs index 60b10d3b92ea..45ba629150dd 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs @@ -33,7 +33,7 @@ public PrivateLinkResourcesRestOperations(HttpPipeline pipeline, string applicat { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-12-01-preview"; + _apiVersion = apiVersion ?? "2023-01-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/RestOperations/SkusRestOperations.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/RestOperations/SkusRestOperations.cs index 9b1843f114dd..5dd80b5fd195 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/RestOperations/SkusRestOperations.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/RestOperations/SkusRestOperations.cs @@ -33,7 +33,7 @@ public SkusRestOperations(HttpPipeline pipeline, string applicationId, Uri endpo { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-12-01-preview"; + _apiVersion = apiVersion ?? "2023-01-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/RestOperations/VolumeGroupsRestOperations.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/RestOperations/VolumeGroupsRestOperations.cs index 9d860c2d7278..16f7a5c0ae1f 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/RestOperations/VolumeGroupsRestOperations.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/RestOperations/VolumeGroupsRestOperations.cs @@ -33,7 +33,7 @@ public VolumeGroupsRestOperations(HttpPipeline pipeline, string applicationId, U { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-12-01-preview"; + _apiVersion = apiVersion ?? "2023-01-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/RestOperations/VolumeSnapshotsRestOperations.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/RestOperations/VolumeSnapshotsRestOperations.cs new file mode 100644 index 000000000000..3d3049686e58 --- /dev/null +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/RestOperations/VolumeSnapshotsRestOperations.cs @@ -0,0 +1,481 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ElasticSan.Models; + +namespace Azure.ResourceManager.ElasticSan +{ + internal partial class VolumeSnapshotsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of VolumeSnapshotsRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public VolumeSnapshotsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-01-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByVolumeGroupRequest(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string filter) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ElasticSan/elasticSans/", false); + uri.AppendPath(elasticSanName, true); + uri.AppendPath("/volumegroups/", false); + uri.AppendPath(volumeGroupName, true); + uri.AppendPath("/snapshots", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List Snapshots in a VolumeGroup or List Snapshots by Volume (name) in a VolumeGroup using filter. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the ElasticSan. + /// The name of the VolumeGroup. + /// Specify $filter='volumeName eq <volume name>' to filter on volume. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByVolumeGroupAsync(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(elasticSanName, nameof(elasticSanName)); + Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); + + using var message = CreateListByVolumeGroupRequest(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SnapshotList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SnapshotList.DeserializeSnapshotList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List Snapshots in a VolumeGroup or List Snapshots by Volume (name) in a VolumeGroup using filter. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the ElasticSan. + /// The name of the VolumeGroup. + /// Specify $filter='volumeName eq <volume name>' to filter on volume. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByVolumeGroup(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(elasticSanName, nameof(elasticSanName)); + Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); + + using var message = CreateListByVolumeGroupRequest(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SnapshotList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SnapshotList.DeserializeSnapshotList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string snapshotName, ElasticSanSnapshotData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ElasticSan/elasticSans/", false); + uri.AppendPath(elasticSanName, true); + uri.AppendPath("/volumegroups/", false); + uri.AppendPath(volumeGroupName, true); + uri.AppendPath("/snapshots/", false); + uri.AppendPath(snapshotName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Create a Volume Snapshot. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the ElasticSan. + /// The name of the VolumeGroup. + /// The name of the volume snapshot within the given volume group. + /// Snapshot object. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task CreateAsync(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string snapshotName, ElasticSanSnapshotData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(elasticSanName, nameof(elasticSanName)); + Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); + Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, snapshotName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Create a Volume Snapshot. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the ElasticSan. + /// The name of the VolumeGroup. + /// The name of the volume snapshot within the given volume group. + /// Snapshot object. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Create(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string snapshotName, ElasticSanSnapshotData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(elasticSanName, nameof(elasticSanName)); + Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); + Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, snapshotName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string snapshotName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ElasticSan/elasticSans/", false); + uri.AppendPath(elasticSanName, true); + uri.AppendPath("/volumegroups/", false); + uri.AppendPath(volumeGroupName, true); + uri.AppendPath("/snapshots/", false); + uri.AppendPath(snapshotName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete a Volume Snapshot. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the ElasticSan. + /// The name of the VolumeGroup. + /// The name of the volume snapshot within the given volume group. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string snapshotName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(elasticSanName, nameof(elasticSanName)); + Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); + Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, snapshotName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete a Volume Snapshot. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the ElasticSan. + /// The name of the VolumeGroup. + /// The name of the volume snapshot within the given volume group. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string snapshotName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(elasticSanName, nameof(elasticSanName)); + Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); + Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, snapshotName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string snapshotName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ElasticSan/elasticSans/", false); + uri.AppendPath(elasticSanName, true); + uri.AppendPath("/volumegroups/", false); + uri.AppendPath(volumeGroupName, true); + uri.AppendPath("/snapshots/", false); + uri.AppendPath(snapshotName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a Volume Snapshot. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the ElasticSan. + /// The name of the VolumeGroup. + /// The name of the volume snapshot within the given volume group. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string snapshotName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(elasticSanName, nameof(elasticSanName)); + Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); + Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, snapshotName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ElasticSanSnapshotData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ElasticSanSnapshotData.DeserializeElasticSanSnapshotData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ElasticSanSnapshotData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a Volume Snapshot. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the ElasticSan. + /// The name of the VolumeGroup. + /// The name of the volume snapshot within the given volume group. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string snapshotName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(elasticSanName, nameof(elasticSanName)); + Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); + Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, snapshotName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ElasticSanSnapshotData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ElasticSanSnapshotData.DeserializeElasticSanSnapshotData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ElasticSanSnapshotData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByVolumeGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string filter) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List Snapshots in a VolumeGroup or List Snapshots by Volume (name) in a VolumeGroup using filter. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the ElasticSan. + /// The name of the VolumeGroup. + /// Specify $filter='volumeName eq <volume name>' to filter on volume. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByVolumeGroupNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(elasticSanName, nameof(elasticSanName)); + Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); + + using var message = CreateListByVolumeGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SnapshotList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SnapshotList.DeserializeSnapshotList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List Snapshots in a VolumeGroup or List Snapshots by Volume (name) in a VolumeGroup using filter. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the ElasticSan. + /// The name of the VolumeGroup. + /// Specify $filter='volumeName eq <volume name>' to filter on volume. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByVolumeGroupNextPage(string nextLink, string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(elasticSanName, nameof(elasticSanName)); + Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); + + using var message = CreateListByVolumeGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SnapshotList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SnapshotList.DeserializeSnapshotList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/RestOperations/VolumesRestOperations.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/RestOperations/VolumesRestOperations.cs index 83ba2cb1df2c..16aa1ff47c3c 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/RestOperations/VolumesRestOperations.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/RestOperations/VolumesRestOperations.cs @@ -33,7 +33,7 @@ public VolumesRestOperations(HttpPipeline pipeline, string applicationId, Uri en { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-12-01-preview"; + _apiVersion = apiVersion ?? "2023-01-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -217,7 +217,7 @@ public Response Update(string subscriptionId, string resourceGroupName, string e } } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string volumeName) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string volumeName, XMsDeleteSnapshot? xMsDeleteSnapshots, XMsForceDelete? xMsForceDelete) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -236,6 +236,14 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG uri.AppendPath(volumeName, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; + if (xMsDeleteSnapshots != null) + { + request.Headers.Add("x-ms-delete-snapshots", xMsDeleteSnapshots.Value.ToString()); + } + if (xMsForceDelete != null) + { + request.Headers.Add("x-ms-force-delete", xMsForceDelete.Value.ToString()); + } request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; @@ -247,10 +255,12 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG /// The name of the ElasticSan. /// The name of the VolumeGroup. /// The name of the Volume. + /// Optional, used to delete snapshots under volume. Allowed value are only true or false. Default value is false. + /// Optional, used to delete volume if active sessions present. Allowed value are only true or false. Default value is false. /// The cancellation token to use. /// , , , or is null. /// , , , or is an empty string, and was expected to be non-empty. - public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string volumeName, CancellationToken cancellationToken = default) + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string volumeName, XMsDeleteSnapshot? xMsDeleteSnapshots = null, XMsForceDelete? xMsForceDelete = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -258,7 +268,7 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, volumeName); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, volumeName, xMsDeleteSnapshots, xMsForceDelete); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -277,10 +287,12 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr /// The name of the ElasticSan. /// The name of the VolumeGroup. /// The name of the Volume. + /// Optional, used to delete snapshots under volume. Allowed value are only true or false. Default value is false. + /// Optional, used to delete volume if active sessions present. Allowed value are only true or false. Default value is false. /// The cancellation token to use. /// , , , or is null. /// , , , or is an empty string, and was expected to be non-empty. - public Response Delete(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string volumeName, CancellationToken cancellationToken = default) + public Response Delete(string subscriptionId, string resourceGroupName, string elasticSanName, string volumeGroupName, string volumeName, XMsDeleteSnapshot? xMsDeleteSnapshots = null, XMsForceDelete? xMsForceDelete = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -288,7 +300,7 @@ public Response Delete(string subscriptionId, string resourceGroupName, string e Argument.AssertNotNullOrEmpty(volumeGroupName, nameof(volumeGroupName)); Argument.AssertNotNullOrEmpty(volumeName, nameof(volumeName)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, volumeName); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, elasticSanName, volumeGroupName, volumeName, xMsDeleteSnapshots, xMsForceDelete); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/autorest.md b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/autorest.md index 87b5c7d27979..eb797426dca9 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/autorest.md +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/autorest.md @@ -9,7 +9,7 @@ csharp: true library-name: ElasticSan namespace: Azure.ResourceManager.ElasticSan # default tag is a preview version -require: https://github.com/Azure/azure-rest-api-specs/blob/1af2861030243b06ee35172c95899f4809eedfc7/specification/elasticsan/resource-manager/readme.md +require: https://github.com/Azure/azure-rest-api-specs/blob/afa158ef56a05f6603924f4a493817cec332b113/specification/elasticsan/resource-manager/readme.md output-folder: $(this-folder)/Generated clear-output-folder: true sample-gen: @@ -63,6 +63,7 @@ prepend-rp-prefix: - VolumeList - SkuInformationList - SkuLocationInfo + - Snapshot rename-mapping: Volume.properties.volumeId: -|uuid @@ -75,4 +76,14 @@ rename-mapping: SourceCreationData: ElasticSanVolumeDataSourceInfo VirtualNetworkRule: ElasticSanVirtualNetworkRule +directive: +- from: elasticsan.json + where: $.definitions.SourceCreationData.properties.sourceId + transform: $["x-ms-format"] = "arm-id"; +- from: elasticsan.json + where: $.definitions.SnapshotCreationData.properties.sourceId + transform: $["x-ms-format"] = "arm-id"; +- from: elasticsan.json + where: $.definitions.ManagedByInfo.properties.resourceId + transform: $["x-ms-format"] = "arm-id"; ``` diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/tests/ElasticSanTestBase.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/tests/ElasticSanTestBase.cs index 4a168fb19a4e..4b873bce4358 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/tests/ElasticSanTestBase.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/tests/ElasticSanTestBase.cs @@ -29,8 +29,8 @@ public ElasticSanTestBase(bool isAsync, RecordedTestMode mode) : base(isAsync, m { } - protected readonly string ResourceGroupName = "testelasticsan"; - protected readonly string ElasticSanName = "testsan1"; + protected readonly string ResourceGroupName = "testelasticsanrg"; + protected readonly string ElasticSanName = "testelasticsan1"; protected AzureLocation TestLocation = new("eastus2euap"); [SetUp] @@ -40,7 +40,7 @@ public async Task CreateCommonClient() DefaultSubscription = await Client.GetDefaultSubscriptionAsync(); } - public static ElasticSanData GetDefaultElasticSanParameters(string location = null, long baseSizeTib = 6, long extendedCapacitySizeTib = 1) + public static ElasticSanData GetDefaultElasticSanParameters(string location = null, long baseSizeTib = 1, long extendedCapacitySizeTib = 6) { string locationParameter = location ?? DefaultLocation; ElasticSanData parameters = new ElasticSanData(locationParameter, @@ -52,7 +52,7 @@ public static ElasticSanData GetDefaultElasticSanParameters(string location = nu public static ElasticSanVolumeData GetDefaultElasticSanVolumeData() { - ElasticSanVolumeData parameters = new ElasticSanVolumeData(100); + ElasticSanVolumeData parameters = new(100); return parameters; } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/tests/Scenario/ElasticSanCollectionTests.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/tests/Scenario/ElasticSanCollectionTests.cs index 57e7f240273c..fde371a1e770 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/tests/Scenario/ElasticSanCollectionTests.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/tests/Scenario/ElasticSanCollectionTests.cs @@ -4,22 +4,19 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.Data; using System.Data.SqlTypes; using System.Linq; using System.Text; using System.Threading.Tasks; using Azure.Core; using Azure.Core.TestFramework; -using Azure.ResourceManager.Resources; -using Azure.ResourceManager.Resources.Models; using NUnit.Framework; namespace Azure.ResourceManager.ElasticSan.Tests.Scenario { public class ElasticSanCollectionTests : ElasticSanTestBase { - private ResourceGroupResource _resourceGroup; - public ElasticSanCollectionTests(bool isAsync) : base(isAsync) //, RecordedTestMode.Record) { @@ -29,27 +26,31 @@ public ElasticSanCollectionTests(bool isAsync) [RecordedTest] public async Task CreateOrUpdate() { - _resourceGroup = await CreateResourceGroupResourceAsync(); - ElasticSanCollection elasticSanCollection = _resourceGroup.GetElasticSans(); + ElasticSanCollection elasticSanCollection = (await GetResourceGroupAsync(ResourceGroupName)).GetElasticSans(); ElasticSanData data = GetDefaultElasticSanParameters(TestLocation); data.Tags.Add("tag1", "value1"); + data.PublicNetworkAccess = Models.PublicNetworkAccess.Enabled; string elasticSanName = Recording.GenerateAssetName("testsan-"); ElasticSanResource elasticSan1 = (await elasticSanCollection.CreateOrUpdateAsync(WaitUntil.Completed, elasticSanName, data)).Value; Assert.AreEqual(elasticSanName, elasticSan1.Id.Name); - Assert.AreEqual(6, elasticSan1.Data.BaseSizeTiB); - Assert.AreEqual(1, elasticSan1.Data.ExtendedCapacitySizeTiB); + Assert.AreEqual(1, elasticSan1.Data.BaseSizeTiB); + Assert.AreEqual(6, elasticSan1.Data.ExtendedCapacitySizeTiB); Assert.IsTrue(elasticSan1.Data.Tags.ContainsKey("tag1")); Assert.AreEqual("value1", elasticSan1.Data.Tags["tag1"]); + Assert.AreEqual("Enabled", elasticSan1.Data.PublicNetworkAccess.Value.ToString()); // Skip the validation for AvailabilityZone as the server won't return the property - elasticSan1 = (await elasticSanCollection.CreateOrUpdateAsync(WaitUntil.Completed, elasticSanName, GetDefaultElasticSanParameters(TestLocation, 7, 2))).Value; + elasticSan1 = (await elasticSanCollection.CreateOrUpdateAsync(WaitUntil.Completed, elasticSanName, GetDefaultElasticSanParameters(TestLocation, 2, 7))).Value; Assert.AreEqual(elasticSanName, elasticSan1.Id.Name); - Assert.AreEqual(7, elasticSan1.Data.BaseSizeTiB); - Assert.AreEqual(2, elasticSan1.Data.ExtendedCapacitySizeTiB); + Assert.AreEqual(2, elasticSan1.Data.BaseSizeTiB); + Assert.AreEqual(7, elasticSan1.Data.ExtendedCapacitySizeTiB); Assert.IsEmpty(elasticSan1.Data.Tags); Assert.IsEmpty(elasticSan1.Data.AvailabilityZones); + Assert.AreEqual(null, elasticSan1.Data.PublicNetworkAccess); + + await elasticSan1.DeleteAsync(WaitUntil.Completed); } [Test] @@ -63,8 +64,6 @@ public async Task Get() Assert.AreEqual(6, elasticSan1.Data.ExtendedCapacitySizeTiB); // Test for ElasticSan PE properties - elasticSanCollection = (await GetResourceGroupAsync("yifanz1")).GetElasticSans(); - elasticSan1 = (await elasticSanCollection.GetAsync("testpreviewes2")).Value; Assert.AreEqual(3, elasticSan1.Data.PrivateEndpointConnections.Count); Assert.IsNotEmpty(elasticSan1.Data.PrivateEndpointConnections[0].Name); Assert.IsNotEmpty(elasticSan1.Data.PrivateEndpointConnections[0].PrivateEndpointId); diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/tests/Scenario/ElasticSanResourceTests.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/tests/Scenario/ElasticSanResourceTests.cs index e719a30b8837..f6eabef63191 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/tests/Scenario/ElasticSanResourceTests.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/tests/Scenario/ElasticSanResourceTests.cs @@ -10,8 +10,6 @@ using Azure.Core.TestFramework; using Azure.ResourceManager.ElasticSan.Models; using Azure.ResourceManager.Resources; -using Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal; -using Microsoft.Identity.Client; using NUnit.Framework; namespace Azure.ResourceManager.ElasticSan.Tests.Scenario @@ -51,37 +49,60 @@ public async Task Get() Assert.AreEqual(elasticSan1.Data.ExtendedCapacitySizeTiB, elasticSan2.Data.ExtendedCapacitySizeTiB); Assert.AreEqual(elasticSan1.Data.AvailabilityZones, elasticSan2.Data.AvailabilityZones); Assert.AreEqual(elasticSan1.Data.Tags, elasticSan2.Data.Tags); + Assert.AreEqual(3, elasticSan1.Data.PrivateEndpointConnections.Count); + Assert.IsNotEmpty(elasticSan1.Data.PrivateEndpointConnections[0].Name); + Assert.IsNotEmpty(elasticSan1.Data.PrivateEndpointConnections[0].PrivateEndpointId); + Assert.AreEqual("Approved", elasticSan1.Data.PrivateEndpointConnections[0].ConnectionState.Status.ToString()); + Assert.IsNotEmpty(elasticSan1.Data.PrivateEndpointConnections[1].Name); + Assert.AreEqual("Approved", elasticSan1.Data.PrivateEndpointConnections[1].ConnectionState.Status.ToString()); + Assert.IsNotEmpty(elasticSan1.Data.PrivateEndpointConnections[1].PrivateEndpointId); + Assert.IsNotEmpty(elasticSan1.Data.PrivateEndpointConnections[2].Name); + Assert.AreEqual("Pending", elasticSan1.Data.PrivateEndpointConnections[2].ConnectionState.Status.ToString()); + Assert.IsNotEmpty(elasticSan1.Data.PrivateEndpointConnections[2].PrivateEndpointId); } [Test] [RecordedTest] - public async Task Delete() + public async Task UpdateAndDelete() { string elasticSanName = Recording.GenerateAssetName("testsan-"); ElasticSanResource elasticSan1 = await CreateElasticSanAsync(elasticSanName); - await elasticSan1.DeleteAsync(WaitUntil.Completed); - Assert.IsFalse(await _collection.ExistsAsync(elasticSanName)); - } - - [Test] - [RecordedTest] - public async Task Update() - { - ElasticSanCollection elasticSanCollection = (await GetResourceGroupAsync(ResourceGroupName)).GetElasticSans(); - ElasticSanResource elasticSan1 = (await elasticSanCollection.GetAsync(ElasticSanName)).Value; - ElasticSanPatch patch = new ElasticSanPatch() + ElasticSanPatch patch = new() { BaseSizeTiB = 2, ExtendedCapacitySizeTiB = 7, }; patch.Tags.Add("tag3", "val3"); - ElasticSanResource elasticSan2 = (await elasticSan1.UpdateAsync(WaitUntil.Completed, patch)).Value; - Assert.AreEqual(elasticSan1.Data.Name, elasticSan2.Data.Name); Assert.AreEqual(2, elasticSan2.Data.BaseSizeTiB); Assert.AreEqual(7, elasticSan2.Data.ExtendedCapacitySizeTiB); + Assert.AreEqual(elasticSan1.Id.Name, elasticSan2.Id.Name); + Assert.AreEqual(elasticSan1.Data.Name, elasticSan2.Data.Name); Assert.GreaterOrEqual(elasticSan2.Data.Tags.Count, 1); - Assert.AreEqual("val3", elasticSan2.Data.Tags["tag3"]); + + await elasticSan1.DeleteAsync(WaitUntil.Completed); + Assert.IsFalse(await _collection.ExistsAsync(elasticSanName)); } + + //[Test] + //[RecordedTest] + //public async Task Update() + //{ + // ElasticSanCollection elasticSanCollection = (await GetResourceGroupAsync(ResourceGroupName)).GetElasticSans(); + // ElasticSanResource elasticSan1 = (await elasticSanCollection.GetAsync(ElasticSanName)).Value; + // ElasticSanPatch patch = new ElasticSanPatch() + // { + // BaseSizeTiB = 2, + // ExtendedCapacitySizeTiB = 7, + // }; + // patch.Tags.Add("tag3", "val3"); + + // ElasticSanResource elasticSan2 = (await elasticSan1.UpdateAsync(WaitUntil.Completed, patch)).Value; + // Assert.AreEqual(elasticSan1.Data.Name, elasticSan2.Data.Name); + // Assert.AreEqual(2, elasticSan2.Data.BaseSizeTiB); + // Assert.AreEqual(7, elasticSan2.Data.ExtendedCapacitySizeTiB); + // Assert.GreaterOrEqual(elasticSan2.Data.Tags.Count, 1); + // Assert.AreEqual("val3", elasticSan2.Data.Tags["tag3"]); + //} } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/tests/Scenario/ElasticSanSnapshotCollectionTests.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/tests/Scenario/ElasticSanSnapshotCollectionTests.cs new file mode 100644 index 000000000000..0347bc7eb21e --- /dev/null +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/tests/Scenario/ElasticSanSnapshotCollectionTests.cs @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.Data.SqlTypes; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.TestFramework; +using Azure.ResourceManager.ElasticSan.Models; +using Azure.ResourceManager.Models; +using Microsoft.Identity.Client; +using NUnit.Framework; + +namespace Azure.ResourceManager.ElasticSan.Tests.Scenario +{ + public class ElasticSanSnapshotCollectionTests : ElasticSanTestBase + { + public ElasticSanSnapshotCollectionTests(bool isAsync) + : base(isAsync) //, RecordedTestMode.Record) + { + } + + [Test] + [RecordedTest] + public async Task CreateGetExists() + { + string volumeGroupName = Recording.GenerateAssetName("testsnapshotvg-"); + string volumeName = Recording.GenerateAssetName("testsnapshotvol-"); + string snapshotName1 = Recording.GenerateAssetName("testsnapshot1-"); + string snapshotName2 = Recording.GenerateAssetName("testsnapshot2-"); + ElasticSanCollection elasticSanCollection = (await GetResourceGroupAsync(ResourceGroupName)).GetElasticSans(); + ElasticSanVolumeGroupCollection volumeGroupCollection = (await elasticSanCollection.GetAsync(ElasticSanName)).Value.GetElasticSanVolumeGroups(); + ElasticSanVolumeGroupResource volumeGroup = (await volumeGroupCollection.CreateOrUpdateAsync(WaitUntil.Completed, volumeGroupName, new ElasticSanVolumeGroupData())).Value; + ElasticSanVolumeCollection volumeCollection = volumeGroup.GetElasticSanVolumes(); + ElasticSanVolumeResource volume = (await volumeCollection.CreateOrUpdateAsync(WaitUntil.Completed, volumeName, GetDefaultElasticSanVolumeData())).Value; + ElasticSanSnapshotCollection snapshotCollection = volumeGroup.GetElasticSanSnapshots(); + + ElasticSanSnapshotData data = new ElasticSanSnapshotData(new SnapshotCreationData(volume.Id)); + ElasticSanSnapshotResource snapshot = (await snapshotCollection.CreateOrUpdateAsync(WaitUntil.Completed, snapshotName1, data)).Value; + _ = (await snapshotCollection.CreateOrUpdateAsync(WaitUntil.Completed, snapshotName2, data)).Value; + Assert.AreEqual(snapshot.Id.Name, snapshotName1); + Assert.AreEqual(snapshot.Data.VolumeName, volume.Id.Name); + Assert.AreEqual(snapshot.Data.SourceVolumeSizeGiB, volume.Data.SizeGiB); + + ElasticSanSnapshotResource snapshot2 = (await snapshotCollection.GetAsync(snapshotName1)).Value; + Assert.AreEqual(snapshot.Id.Name, snapshot2.Id.Name); + Assert.AreEqual(snapshot.Id.ResourceGroupName, snapshot2.Id.ResourceGroupName); + Assert.AreEqual(snapshot.Data.Name, snapshot2.Data.Name); + Assert.AreEqual(snapshot.Data.VolumeName, snapshot2.Data.VolumeName); + Assert.AreEqual(snapshot.Data.CreationDataSourceId, snapshot2.Data.CreationDataSourceId); + Assert.AreEqual(snapshot.Data.SourceVolumeSizeGiB, snapshot2.Data.SourceVolumeSizeGiB); + + int count = 0; + await foreach (ElasticSanSnapshotResource _ in snapshotCollection.GetAllAsync()) + { + count++; + } + Assert.GreaterOrEqual(count, 2); + + Assert.IsTrue(await snapshotCollection.ExistsAsync(snapshotName1)); + Assert.IsFalse(await snapshotCollection.ExistsAsync(snapshotName1 + "abcd")); + } + } +} diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/tests/Scenario/ElasticSanSnapshotResourceTests.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/tests/Scenario/ElasticSanSnapshotResourceTests.cs new file mode 100644 index 000000000000..c622e156ddca --- /dev/null +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/tests/Scenario/ElasticSanSnapshotResourceTests.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.Data.SqlTypes; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.TestFramework; +using Azure.ResourceManager.ElasticSan.Models; +using Azure.ResourceManager.Models; +using Microsoft.Identity.Client; +using NUnit.Framework; + +namespace Azure.ResourceManager.ElasticSan.Tests.Scenario +{ + public class ElasticSanSnapshotResourceTests : ElasticSanTestBase + { + public ElasticSanSnapshotResourceTests(bool isAsync) + : base(isAsync) //, RecordedTestMode.Record) + { + } + + [Test] + [RecordedTest] + public async Task CreateGetExists() + { + string volumeGroupName = Recording.GenerateAssetName("testsnapshotvg-"); + string volumeName = Recording.GenerateAssetName("testsnapshotvol-"); + string snapshotName1 = Recording.GenerateAssetName("testsnapshot1-"); + ElasticSanCollection elasticSanCollection = (await GetResourceGroupAsync(ResourceGroupName)).GetElasticSans(); + ElasticSanVolumeGroupCollection volumeGroupCollection = (await elasticSanCollection.GetAsync(ElasticSanName)).Value.GetElasticSanVolumeGroups(); + ElasticSanVolumeGroupResource volumeGroup = (await volumeGroupCollection.CreateOrUpdateAsync(WaitUntil.Completed, volumeGroupName, new ElasticSanVolumeGroupData())).Value; + ElasticSanVolumeCollection volumeCollection = volumeGroup.GetElasticSanVolumes(); + ElasticSanVolumeResource volume = (await volumeCollection.CreateOrUpdateAsync(WaitUntil.Completed, volumeName, GetDefaultElasticSanVolumeData())).Value; + ElasticSanSnapshotCollection snapshotCollection = volumeGroup.GetElasticSanSnapshots(); + + ElasticSanSnapshotData data = new ElasticSanSnapshotData(new SnapshotCreationData(volume.Id)); + ElasticSanSnapshotResource snapshot = (await snapshotCollection.CreateOrUpdateAsync(WaitUntil.Completed, snapshotName1, data)).Value; + Assert.AreEqual(snapshot.Id.Name, snapshotName1); + Assert.AreEqual(snapshot.Data.VolumeName, volumeName); + Assert.AreEqual(snapshot.Data.Name, snapshotName1); + + ElasticSanSnapshotResource snapshot2 = (await snapshot.GetAsync()).Value; + Assert.AreEqual(snapshot2.Id.Name, snapshot.Id.Name); + Assert.AreEqual(snapshot2.Data.VolumeName, snapshot.Data.VolumeName); + Assert.AreEqual(snapshot2.Data.CreationDataSourceId, snapshot.Data.CreationDataSourceId); + + await snapshot.DeleteAsync(WaitUntil.Completed); + } + } +} diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/tests/Scenario/ElasticSanVolumeCollectionTests.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/tests/Scenario/ElasticSanVolumeCollectionTests.cs index d70567826d46..5bd130a4826e 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/tests/Scenario/ElasticSanVolumeCollectionTests.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/tests/Scenario/ElasticSanVolumeCollectionTests.cs @@ -35,47 +35,28 @@ public async Task GetVolumeCollection() [Test] [RecordedTest] - public async Task CreateOrUpdate() + public async Task CreateUpdateGetExistsGet() { _collection = await GetVolumeCollection(); string volumeName = Recording.GenerateAssetName("testvolume-"); ElasticSanVolumeData volumeData = new ElasticSanVolumeData(100) { - CreationData = new Models.ElasticSanVolumeDataSourceInfo() + CreationData = new ElasticSanVolumeDataSourceInfo() }; ElasticSanVolumeResource volume = (await _collection.CreateOrUpdateAsync(WaitUntil.Completed, volumeName, volumeData)).Value; Assert.AreEqual(volume.Id.Name, volumeName); Assert.AreEqual(100, volume.Data.SizeGiB); Assert.AreEqual(ElasticSanVolumeCreateOption.None, volume.Data.CreationData.CreateSource); - } - - [Test] - [RecordedTest] - public async Task Get() - { - _collection = await GetVolumeCollection(); + Assert.IsNull(volume.Data.CreationData.SourceId); - string volumeName = Recording.GenerateAssetName("testvolume-"); - ElasticSanVolumeData volumeData = new ElasticSanVolumeData(100); - ElasticSanVolumeResource volume1 = (await _collection.CreateOrUpdateAsync(WaitUntil.Completed, volumeName, volumeData)).Value; ElasticSanVolumeResource volume2 = (await _collection.GetAsync(volumeName)).Value; - Assert.AreEqual(volume2.Id.Name, volume1.Id.Name); - Assert.AreEqual(100, volume1.Data.SizeGiB); - Assert.AreEqual(ElasticSanVolumeCreateOption.None, volume1.Data.CreationData.CreateSource); - Assert.IsNull(volume1.Data.CreationData.SourceUri); - } - - [Test] - [RecordedTest] - public async Task GetAll() - { - _collection = await GetVolumeCollection(); + Assert.AreEqual(volume2.Id.Name, volume.Id.Name); + Assert.AreEqual(100, volume.Data.SizeGiB); + Assert.AreEqual(ElasticSanVolumeCreateOption.None, volume.Data.CreationData.CreateSource); + Assert.IsNull(volume.Data.CreationData.SourceId); - string volumeName1 = Recording.GenerateAssetName("testvolume-"); string volumeName2 = Recording.GenerateAssetName("testvolume-"); - ElasticSanVolumeData volumeData = new ElasticSanVolumeData(100); - _ = (await _collection.CreateOrUpdateAsync(WaitUntil.Completed, volumeName1, volumeData)).Value; _ = (await _collection.CreateOrUpdateAsync(WaitUntil.Completed, volumeName2, volumeData)).Value; int count = 0; @@ -84,17 +65,7 @@ public async Task GetAll() count++; } Assert.GreaterOrEqual(count, 2); - } - [Test] - [RecordedTest] - public async Task Exists() - { - _collection = await GetVolumeCollection(); - - string volumeName = Recording.GenerateAssetName("testvolume-"); - ElasticSanVolumeData volumeData = new ElasticSanVolumeData(100); - _ = (await _collection.CreateOrUpdateAsync(WaitUntil.Completed, volumeName, volumeData)).Value; Assert.IsTrue(await _collection.ExistsAsync(volumeName)); Assert.IsFalse(await _collection.ExistsAsync(volumeName + "111")); } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/tests/Scenario/ElasticSanVolumeGroupCollectionTests.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/tests/Scenario/ElasticSanVolumeGroupCollectionTests.cs index 38f04e887871..fb157623aad3 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/tests/Scenario/ElasticSanVolumeGroupCollectionTests.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/tests/Scenario/ElasticSanVolumeGroupCollectionTests.cs @@ -10,8 +10,7 @@ using Azure.Core; using Azure.Core.TestFramework; using Azure.ResourceManager.ElasticSan.Models; -using Azure.ResourceManager.Resources; -using Microsoft.Identity.Client; +using Azure.ResourceManager.Models; using NUnit.Framework; namespace Azure.ResourceManager.ElasticSan.Tests.Scenario @@ -25,7 +24,7 @@ public ElasticSanVolumeGroupCollectionTests(bool isAsync) [Test] [RecordedTest] - public async Task CreateOrUpdate() + public async Task CreateUpdateGet() { ElasticSanCollection elasticSanCollection = (await GetResourceGroupAsync(ResourceGroupName)).GetElasticSans(); ElasticSanVolumeGroupCollection collection = (await elasticSanCollection.GetAsync(ElasticSanName)).Value.GetElasticSanVolumeGroups(); @@ -34,7 +33,8 @@ public async Task CreateOrUpdate() ElasticSanVolumeGroupData volumeGroupData = new ElasticSanVolumeGroupData() { ProtocolType = StorageTargetType.Iscsi, - Encryption = ElasticSanEncryptionType.EncryptionAtRestWithPlatformKey + Encryption = ElasticSanEncryptionType.EncryptionAtRestWithPlatformKey, + Identity = new ManagedServiceIdentity(ManagedServiceIdentityType.SystemAssigned) }; // vnet resource id is created by following instructions in https://docs.microsoft.com/en-us/azure/storage/common/storage-network-security?tabs=azure-portal var vnetResourceId = new ResourceIdentifier("/subscriptions/" + DefaultSubscription.Data.Id.Name + "/resourceGroups/" + ResourceGroupName + "/providers/Microsoft.Network/virtualNetworks/testvnet/subnets/subnet1"); @@ -46,22 +46,13 @@ public async Task CreateOrUpdate() Assert.AreEqual(StorageTargetType.Iscsi, volumeGroupResource.Data.ProtocolType); Assert.GreaterOrEqual(volumeGroupResource.Data.VirtualNetworkRules.Count, 1); Assert.AreEqual(vnetResourceId, volumeGroupResource.Data.VirtualNetworkRules[0].VirtualNetworkResourceId); - } - - [Test] - [RecordedTest] - public async Task Get() - { - ElasticSanCollection elasticSanCollection = (await GetResourceGroupAsync(ResourceGroupName)).GetElasticSans(); - ElasticSanVolumeGroupCollection collection = (await elasticSanCollection.GetAsync(ElasticSanName)).Value.GetElasticSanVolumeGroups(); - string volumeGroupName = Recording.GenerateAssetName("testvolumegroup-"); - _ = (await collection.CreateOrUpdateAsync(WaitUntil.Completed, volumeGroupName, new ElasticSanVolumeGroupData())).Value; ElasticSanVolumeGroupResource volumeGroup = (await collection.GetAsync(volumeGroupName)).Value; - Assert.AreEqual(volumeGroup.Id.Name, volumeGroupName); - Assert.IsEmpty(volumeGroup.Data.VirtualNetworkRules); - Assert.AreEqual(StorageTargetType.Iscsi, volumeGroup.Data.ProtocolType); - Assert.AreEqual(ElasticSanEncryptionType.EncryptionAtRestWithPlatformKey, volumeGroup.Data.Encryption); + Assert.AreEqual(volumeGroupResource.Id.Name, volumeGroupName); + Assert.AreEqual(ElasticSanEncryptionType.EncryptionAtRestWithPlatformKey, volumeGroupResource.Data.Encryption); + Assert.AreEqual(StorageTargetType.Iscsi, volumeGroupResource.Data.ProtocolType); + Assert.GreaterOrEqual(volumeGroupResource.Data.VirtualNetworkRules.Count, 1); + Assert.AreEqual(vnetResourceId, volumeGroupResource.Data.VirtualNetworkRules[0].VirtualNetworkResourceId); } [Test] diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/tests/Scenario/ElasticSanVolumeGroupResourceTests.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/tests/Scenario/ElasticSanVolumeGroupResourceTests.cs index ead5f21704b0..f25b9da9732a 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/tests/Scenario/ElasticSanVolumeGroupResourceTests.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/tests/Scenario/ElasticSanVolumeGroupResourceTests.cs @@ -9,7 +9,7 @@ using Azure.Core; using Azure.Core.TestFramework; using Azure.ResourceManager.ElasticSan.Models; -using Azure.ResourceManager.Resources; +using Azure.ResourceManager.Models; using NUnit.Framework; namespace Azure.ResourceManager.ElasticSan.Tests.Scenario @@ -32,7 +32,7 @@ private async Task GetVolumeGroupCollection() [Test] [RecordedTest] - public async Task Get() + public async Task GetUpdateDelete() { _collection = await GetVolumeGroupCollection(); @@ -43,40 +43,24 @@ public async Task Get() Assert.IsEmpty(volumeGroup1.Data.VirtualNetworkRules); Assert.AreEqual(StorageTargetType.Iscsi, volumeGroup1.Data.ProtocolType); Assert.AreEqual(ElasticSanEncryptionType.EncryptionAtRestWithPlatformKey, volumeGroup1.Data.Encryption); - } - - [Test] - [RecordedTest] - public async Task Delete() - { - _collection = await GetVolumeGroupCollection(); - string volumeGroupName = Recording.GenerateAssetName("testvolumegroup-"); - ElasticSanVolumeGroupResource volumeGroup = (await _collection.CreateOrUpdateAsync(WaitUntil.Completed, volumeGroupName, new ElasticSanVolumeGroupData())).Value; - await volumeGroup.DeleteAsync(WaitUntil.Completed); - Assert.IsFalse(await _collection.ExistsAsync(volumeGroupName)); - } - [Test] - [RecordedTest] - public async Task Update() - { - _collection = await GetVolumeGroupCollection(); - string volumeGroupName = Recording.GenerateAssetName("testvolgroup-"); - ElasticSanVolumeGroupResource volGroup = (await _collection.CreateOrUpdateAsync(WaitUntil.Completed, volumeGroupName, new ElasticSanVolumeGroupData())).Value; - - ElasticSanVolumeGroupPatch patch = new ElasticSanVolumeGroupPatch() + ElasticSanVolumeGroupPatch patch = new() { ProtocolType = StorageTargetType.Iscsi, - Encryption = ElasticSanEncryptionType.EncryptionAtRestWithPlatformKey + Encryption = ElasticSanEncryptionType.EncryptionAtRestWithPlatformKey, + Identity = new ManagedServiceIdentity(ManagedServiceIdentityType.SystemAssigned) }; var vnetResourceId = new ResourceIdentifier("/subscriptions/" + DefaultSubscription.Data.Id.Name + "/resourceGroups/" + ResourceGroupName + "/providers/Microsoft.Network/virtualNetworks/testvnet/subnets/subnet1"); patch.VirtualNetworkRules.Add(new ElasticSanVirtualNetworkRule(vnetResourceId)); - ElasticSanVolumeGroupResource volGroup1 = (await volGroup.UpdateAsync(WaitUntil.Completed, patch)).Value; + ElasticSanVolumeGroupResource volGroup1 = (await volumeGroup.UpdateAsync(WaitUntil.Completed, patch)).Value; Assert.AreEqual(volumeGroupName, volGroup1.Id.Name); Assert.AreEqual(StorageTargetType.Iscsi, volGroup1.Data.ProtocolType); Assert.AreEqual(ElasticSanEncryptionType.EncryptionAtRestWithPlatformKey, volGroup1.Data.Encryption); Assert.AreEqual(vnetResourceId, volGroup1.Data.VirtualNetworkRules[0].VirtualNetworkResourceId); + + await volumeGroup.DeleteAsync(WaitUntil.Completed); + Assert.IsFalse(await _collection.ExistsAsync(volumeGroupName)); } } } diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/tests/Scenario/ElasticSanVolumeResourceTests.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/tests/Scenario/ElasticSanVolumeResourceTests.cs index 7af83e3aca23..61baa1990038 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/tests/Scenario/ElasticSanVolumeResourceTests.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/tests/Scenario/ElasticSanVolumeResourceTests.cs @@ -35,7 +35,7 @@ public async Task GetVolumeCollection() [Test] [RecordedTest] - public async Task Get() + public async Task GetUpdateDelete() { _collection = await GetVolumeCollection(); string volumeName = Recording.GenerateAssetName("testvolume-"); @@ -44,34 +44,16 @@ public async Task Get() ElasticSanVolumeResource volume2 = await volume1.GetAsync(); Assert.AreEqual(volume1.Id.Name, volume2.Id.Name); Assert.AreEqual(100, volume2.Data.SizeGiB); - Assert.IsNull(volume2.Data.CreationData.SourceUri); Assert.AreEqual(ElasticSanVolumeCreateOption.None, volume1.Data.CreationData.CreateSource); - } - - [Test] - [RecordedTest] - public async Task Delete() - { - _collection = await GetVolumeCollection(); - string volumeName = Recording.GenerateAssetName("testvolume-"); - ElasticSanVolumeResource volume1 = (await _collection.CreateOrUpdateAsync(WaitUntil.Completed, volumeName, GetDefaultElasticSanVolumeData())).Value; - await volume1.DeleteAsync(WaitUntil.Completed); - //Skip validation for deletion as server has an issue of still showing deleted volume as active - } - [Test] - [RecordedTest] - public async Task Update() - { - _collection = await GetVolumeCollection(); - string volumeName = Recording.GenerateAssetName("testvolume-"); - ElasticSanVolumeResource volume1 = (await _collection.CreateOrUpdateAsync(WaitUntil.Completed, volumeName, GetDefaultElasticSanVolumeData())).Value; ElasticSanVolumePatch patch = new ElasticSanVolumePatch() { SizeGiB = 200 }; - ElasticSanVolumeResource volume2 = (await volume1.UpdateAsync(WaitUntil.Completed, patch)).Value; - Assert.AreEqual(200, volume2.Data.SizeGiB); + ElasticSanVolumeResource volume3 = (await volume1.UpdateAsync(WaitUntil.Completed, patch)).Value; + Assert.AreEqual(200, volume3.Data.SizeGiB); + + await volume1.DeleteAsync(WaitUntil.Completed, XMsDeleteSnapshot.True, XMsForceDelete.True); } } }