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 3df08653bc84..35d6e73bf0e2 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 @@ -23,6 +23,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; } } @@ -43,6 +44,7 @@ public static partial class ElasticSanExtensions 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; } public static Azure.AsyncPageable GetSkusAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.ElasticSan.SnapshotResource GetSnapshotResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } } public partial class ElasticSanPrivateEndpointConnectionCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable { @@ -128,6 +130,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 string 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; } } @@ -151,6 +155,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; } } @@ -170,6 +176,9 @@ protected ElasticSanVolumeGroupResource() { } 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; } + public virtual Azure.Response GetSnapshot(string snapshotName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSnapshotAsync(string snapshotName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ElasticSan.SnapshotCollection GetSnapshots() { throw null; } public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.ElasticSan.Models.ElasticSanVolumeGroupPatch 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.ElasticSanVolumeGroupPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } @@ -180,28 +189,66 @@ 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; } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.ElasticSan.Models.ElasticSanVolumePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } + public partial class SnapshotCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected SnapshotCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string snapshotName, Azure.ResourceManager.ElasticSan.SnapshotData 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.SnapshotData 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; } + 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 SnapshotData : Azure.ResourceManager.Models.ResourceData + { + public SnapshotData(Azure.ResourceManager.ElasticSan.Models.SnapshotCreationData creationData) { } + public string 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 SnapshotResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected SnapshotResource() { } + public virtual Azure.ResourceManager.ElasticSan.SnapshotData 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.SnapshotData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.ElasticSan.SnapshotData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } } 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.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, string 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; } + public static Azure.ResourceManager.ElasticSan.SnapshotData SnapshotData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string creationDataSourceId = null, Azure.ResourceManager.ElasticSan.Models.ElasticSanProvisioningState? provisioningState = default(Azure.ResourceManager.ElasticSan.Models.ElasticSanProvisioningState?), long? sourceVolumeSizeGiB = default(long?), string volumeName = null) { throw null; } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct ElasticSanEncryptionType : System.IEquatable @@ -209,6 +256,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)] @@ -225,6 +273,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)] @@ -352,7 +401,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)] @@ -372,21 +420,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; } @@ -401,12 +445,14 @@ 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 string 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; } } } @@ -415,6 +461,12 @@ public partial class ElasticSanVolumePatch public ElasticSanVolumePatch() { } 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() { } @@ -424,6 +476,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 { @@ -448,6 +528,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(string sourceId) { } + public string SourceId { get { throw null; } set { } } + } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct StorageTargetType : System.IEquatable { @@ -466,4 +551,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/src/Generated/ArmElasticSanModelFactory.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ArmElasticSanModelFactory.cs index 3eb73b6865a4..45515ca619b1 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, string 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 SnapshotData. + /// 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 SnapshotData SnapshotData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string creationDataSourceId = null, ElasticSanProvisioningState? provisioningState = null, long? sourceVolumeSizeGiB = null, string volumeName = null) + { + return new SnapshotData(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/ElasticSanVolumeData.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeData.cs index 175544419196..e7280f91db1f 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. + public string 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..909d23308010 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 SnapshotResources in the ElasticSanVolumeGroup. + /// An object representing collection of SnapshotResources and their operations over a SnapshotResource. + public virtual SnapshotCollection GetSnapshots() + { + return GetCachedClient(Client => new SnapshotCollection(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> GetSnapshotAsync(string snapshotName, CancellationToken cancellationToken = default) + { + return await GetSnapshots().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 GetSnapshot(string snapshotName, CancellationToken cancellationToken = default) + { + return GetSnapshots().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..43bbaeeb466a 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 SnapshotResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static SnapshotResource GetSnapshotResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + SnapshotResource.ValidateResourceId(id); + return new SnapshotResource(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/SnapshotOperationSource.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/LongRunningOperation/SnapshotOperationSource.cs new file mode 100644 index 000000000000..94ba60b7822b --- /dev/null +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/LongRunningOperation/SnapshotOperationSource.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 SnapshotOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal SnapshotOperationSource(ArmClient client) + { + _client = client; + } + + SnapshotResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = SnapshotData.DeserializeSnapshotData(document.RootElement); + return new SnapshotResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = SnapshotData.DeserializeSnapshotData(document.RootElement); + return new SnapshotResource(_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/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..758cc2a6c199 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,13 @@ 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 = 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..30d1d6a97f1d 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeDataSourceInfo.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ElasticSanVolumeDataSourceInfo.cs @@ -5,8 +5,6 @@ #nullable disable -using System; - namespace Azure.ResourceManager.ElasticSan.Models { /// Data source used when creating the volume. @@ -19,16 +17,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, string 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 string 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/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..ff1c130e4064 --- /dev/null +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ManagedByInfo.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 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)) + { + resourceId = 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..37b4ac021810 --- /dev/null +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/ManagedByInfo.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +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. + internal ManagedByInfo(string resourceId) + { + ResourceId = resourceId; + } + + /// Resource ID of the resource managing the volume. + public string 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..3b4c1894f74f --- /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; + } + string sourceId = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("sourceId"u8)) + { + sourceId = 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..2ffc9a1f7fe5 --- /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(string 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 string SourceId { get; set; } + } +} diff --git a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/SnapshotData.Serialization.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/SnapshotData.Serialization.cs new file mode 100644 index 000000000000..ed5da6e1e082 --- /dev/null +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/SnapshotData.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 SnapshotData : 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 SnapshotData DeserializeSnapshotData(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 SnapshotData(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/SnapshotList.Serialization.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Models/SnapshotList.Serialization.cs new file mode 100644 index 000000000000..4326bd239041 --- /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(SnapshotData.DeserializeSnapshotData(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..c1ace7319daa --- /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..3b93daf566aa --- /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, SnapshotData 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, SnapshotData 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, SnapshotData 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: + { + SnapshotData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SnapshotData.DeserializeSnapshotData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((SnapshotData)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: + { + SnapshotData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SnapshotData.DeserializeSnapshotData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((SnapshotData)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/Generated/SnapshotCollection.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/SnapshotCollection.cs new file mode 100644 index 000000000000..634c32527c30 --- /dev/null +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/SnapshotCollection.cs @@ -0,0 +1,343 @@ +// 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 a instance call the GetSnapshots method from an instance of . + /// + public partial class SnapshotCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _snapshotVolumeSnapshotsClientDiagnostics; + private readonly VolumeSnapshotsRestOperations _snapshotVolumeSnapshotsRestClient; + + /// Initializes a new instance of the class for mocking. + protected SnapshotCollection() + { + } + + /// 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 SnapshotCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _snapshotVolumeSnapshotsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ElasticSan", SnapshotResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(SnapshotResource.ResourceType, out string snapshotVolumeSnapshotsApiVersion); + _snapshotVolumeSnapshotsRestClient = new VolumeSnapshotsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, snapshotVolumeSnapshotsApiVersion); +#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, SnapshotData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _snapshotVolumeSnapshotsClientDiagnostics.CreateScope("SnapshotCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _snapshotVolumeSnapshotsRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, snapshotName, data, cancellationToken).ConfigureAwait(false); + var operation = new ElasticSanArmOperation(new SnapshotOperationSource(Client), _snapshotVolumeSnapshotsClientDiagnostics, Pipeline, _snapshotVolumeSnapshotsRestClient.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, SnapshotData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(snapshotName, nameof(snapshotName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _snapshotVolumeSnapshotsClientDiagnostics.CreateScope("SnapshotCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _snapshotVolumeSnapshotsRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, snapshotName, data, cancellationToken); + var operation = new ElasticSanArmOperation(new SnapshotOperationSource(Client), _snapshotVolumeSnapshotsClientDiagnostics, Pipeline, _snapshotVolumeSnapshotsRestClient.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 = _snapshotVolumeSnapshotsClientDiagnostics.CreateScope("SnapshotCollection.Get"); + scope.Start(); + try + { + var response = await _snapshotVolumeSnapshotsRestClient.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 SnapshotResource(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 = _snapshotVolumeSnapshotsClientDiagnostics.CreateScope("SnapshotCollection.Get"); + scope.Start(); + try + { + var response = _snapshotVolumeSnapshotsRestClient.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 SnapshotResource(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) => _snapshotVolumeSnapshotsRestClient.CreateListByVolumeGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _snapshotVolumeSnapshotsRestClient.CreateListByVolumeGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SnapshotResource(Client, SnapshotData.DeserializeSnapshotData(e)), _snapshotVolumeSnapshotsClientDiagnostics, Pipeline, "SnapshotCollection.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) => _snapshotVolumeSnapshotsRestClient.CreateListByVolumeGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _snapshotVolumeSnapshotsRestClient.CreateListByVolumeGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, filter); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SnapshotResource(Client, SnapshotData.DeserializeSnapshotData(e)), _snapshotVolumeSnapshotsClientDiagnostics, Pipeline, "SnapshotCollection.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 = _snapshotVolumeSnapshotsClientDiagnostics.CreateScope("SnapshotCollection.Exists"); + scope.Start(); + try + { + var response = await _snapshotVolumeSnapshotsRestClient.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 = _snapshotVolumeSnapshotsClientDiagnostics.CreateScope("SnapshotCollection.Exists"); + scope.Start(); + try + { + var response = _snapshotVolumeSnapshotsRestClient.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; + } + } + + 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/SnapshotData.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/SnapshotData.cs new file mode 100644 index 000000000000..9a9907e497ae --- /dev/null +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/SnapshotData.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 Snapshot data model. + /// Response for Volume Snapshot request. + /// + public partial class SnapshotData : ResourceData + { + /// Initializes a new instance of SnapshotData. + /// Data used when creating a volume snapshot. + /// is null. + public SnapshotData(SnapshotCreationData creationData) + { + Argument.AssertNotNull(creationData, nameof(creationData)); + + CreationData = creationData; + } + + /// Initializes a new instance of SnapshotData. + /// 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 SnapshotData(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 string 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/SnapshotResource.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/SnapshotResource.cs new file mode 100644 index 000000000000..f8be3be206fc --- /dev/null +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/SnapshotResource.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 a Snapshot along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetSnapshotResource method. + /// Otherwise you can get one from its parent resource using the GetSnapshot method. + /// + public partial class SnapshotResource : 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 _snapshotVolumeSnapshotsClientDiagnostics; + private readonly VolumeSnapshotsRestOperations _snapshotVolumeSnapshotsRestClient; + private readonly SnapshotData _data; + + /// Initializes a new instance of the class for mocking. + protected SnapshotResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal SnapshotResource(ArmClient client, SnapshotData 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 SnapshotResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _snapshotVolumeSnapshotsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ElasticSan", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string snapshotVolumeSnapshotsApiVersion); + _snapshotVolumeSnapshotsRestClient = new VolumeSnapshotsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, snapshotVolumeSnapshotsApiVersion); +#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 SnapshotData 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 = _snapshotVolumeSnapshotsClientDiagnostics.CreateScope("SnapshotResource.Get"); + scope.Start(); + try + { + var response = await _snapshotVolumeSnapshotsRestClient.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 SnapshotResource(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 = _snapshotVolumeSnapshotsClientDiagnostics.CreateScope("SnapshotResource.Get"); + scope.Start(); + try + { + var response = _snapshotVolumeSnapshotsRestClient.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 SnapshotResource(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 = _snapshotVolumeSnapshotsClientDiagnostics.CreateScope("SnapshotResource.Delete"); + scope.Start(); + try + { + var response = await _snapshotVolumeSnapshotsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new ElasticSanArmOperation(_snapshotVolumeSnapshotsClientDiagnostics, Pipeline, _snapshotVolumeSnapshotsRestClient.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 = _snapshotVolumeSnapshotsClientDiagnostics.CreateScope("SnapshotResource.Delete"); + scope.Start(); + try + { + var response = _snapshotVolumeSnapshotsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new ElasticSanArmOperation(_snapshotVolumeSnapshotsClientDiagnostics, Pipeline, _snapshotVolumeSnapshotsRestClient.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, SnapshotData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _snapshotVolumeSnapshotsClientDiagnostics.CreateScope("SnapshotResource.Update"); + scope.Start(); + try + { + var response = await _snapshotVolumeSnapshotsRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new ElasticSanArmOperation(new SnapshotOperationSource(Client), _snapshotVolumeSnapshotsClientDiagnostics, Pipeline, _snapshotVolumeSnapshotsRestClient.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, SnapshotData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _snapshotVolumeSnapshotsClientDiagnostics.CreateScope("SnapshotResource.Update"); + scope.Start(); + try + { + var response = _snapshotVolumeSnapshotsRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new ElasticSanArmOperation(new SnapshotOperationSource(Client), _snapshotVolumeSnapshotsClientDiagnostics, Pipeline, _snapshotVolumeSnapshotsRestClient.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/autorest.md b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/autorest.md index cbcc2d414021..0d8eee725948 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: /mnt/vss/_work/1/s/azure-rest-api-specs/specification/elasticsan/resource-manager/readme.md output-folder: $(this-folder)/Generated clear-output-folder: true skip-csproj: true