diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/CHANGELOG.md b/sdk/storagemover/Azure.ResourceManager.StorageMover/CHANGELOG.md index 8b2f15284412..41785c3bb332 100644 --- a/sdk/storagemover/Azure.ResourceManager.StorageMover/CHANGELOG.md +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/CHANGELOG.md @@ -1,14 +1,11 @@ # Release History -## 1.1.0-beta.2 (Unreleased) +## 1.1.0-beta.2 (2023-08-08) ### Features Added -### Breaking Changes - -### Bugs Fixed - -### Other Changes +- Upgrade to API version 2023-07-01-preview +- Added support for SMB endpoint and SMB file share endpoint. ## 1.1.0-beta.1 (2023-05-31) diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/api/Azure.ResourceManager.StorageMover.netstandard2.0.cs b/sdk/storagemover/Azure.ResourceManager.StorageMover/api/Azure.ResourceManager.StorageMover.netstandard2.0.cs index 87a0358df4f8..e1528e6440f0 100644 --- a/sdk/storagemover/Azure.ResourceManager.StorageMover/api/Azure.ResourceManager.StorageMover.netstandard2.0.cs +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/api/Azure.ResourceManager.StorageMover.netstandard2.0.cs @@ -296,30 +296,57 @@ namespace Azure.ResourceManager.StorageMover.Models public static partial class ArmStorageMoverModelFactory { public static Azure.ResourceManager.StorageMover.Models.AzureStorageBlobContainerEndpointProperties AzureStorageBlobContainerEndpointProperties(string description = null, Azure.ResourceManager.StorageMover.Models.StorageMoverProvisioningState? provisioningState = default(Azure.ResourceManager.StorageMover.Models.StorageMoverProvisioningState?), string storageAccountResourceId = null, string blobContainerName = null) { throw null; } + public static Azure.ResourceManager.StorageMover.Models.AzureStorageSmbFileShareEndpointProperties AzureStorageSmbFileShareEndpointProperties(string description = null, Azure.ResourceManager.StorageMover.Models.StorageMoverProvisioningState? provisioningState = default(Azure.ResourceManager.StorageMover.Models.StorageMoverProvisioningState?), Azure.Core.ResourceIdentifier storageAccountResourceId = null, string fileShareName = null) { throw null; } public static Azure.ResourceManager.StorageMover.Models.EndpointBaseProperties EndpointBaseProperties(string endpointType = "Unknown", string description = null, Azure.ResourceManager.StorageMover.Models.StorageMoverProvisioningState? provisioningState = default(Azure.ResourceManager.StorageMover.Models.StorageMoverProvisioningState?)) { throw null; } public static Azure.ResourceManager.StorageMover.JobDefinitionData JobDefinitionData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string description = null, Azure.ResourceManager.StorageMover.Models.StorageMoverCopyMode copyMode = default(Azure.ResourceManager.StorageMover.Models.StorageMoverCopyMode), string sourceName = null, Azure.Core.ResourceIdentifier sourceResourceId = null, string sourceSubpath = null, string targetName = null, Azure.Core.ResourceIdentifier targetResourceId = null, string targetSubpath = null, string latestJobRunName = null, Azure.Core.ResourceIdentifier latestJobRunResourceId = null, Azure.ResourceManager.StorageMover.Models.JobRunStatus? latestJobRunStatus = default(Azure.ResourceManager.StorageMover.Models.JobRunStatus?), string agentName = null, Azure.Core.ResourceIdentifier agentResourceId = null, Azure.ResourceManager.StorageMover.Models.StorageMoverProvisioningState? provisioningState = default(Azure.ResourceManager.StorageMover.Models.StorageMoverProvisioningState?)) { throw null; } public static Azure.ResourceManager.StorageMover.JobRunData JobRunData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.StorageMover.Models.JobRunStatus? status = default(Azure.ResourceManager.StorageMover.Models.JobRunStatus?), Azure.ResourceManager.StorageMover.Models.JobRunScanStatus? scanStatus = default(Azure.ResourceManager.StorageMover.Models.JobRunScanStatus?), string agentName = null, Azure.Core.ResourceIdentifier agentResourceId = null, System.DateTimeOffset? executionStartOn = default(System.DateTimeOffset?), System.DateTimeOffset? executionEndOn = default(System.DateTimeOffset?), System.DateTimeOffset? lastStatusUpdate = default(System.DateTimeOffset?), long? itemsScanned = default(long?), long? itemsExcluded = default(long?), long? itemsUnsupported = default(long?), long? itemsNoTransferNeeded = default(long?), long? itemsFailed = default(long?), long? itemsTransferred = default(long?), long? bytesScanned = default(long?), long? bytesExcluded = default(long?), long? bytesUnsupported = default(long?), long? bytesNoTransferNeeded = default(long?), long? bytesFailed = default(long?), long? bytesTransferred = default(long?), string sourceName = null, Azure.Core.ResourceIdentifier sourceResourceId = null, System.BinaryData sourceProperties = null, string targetName = null, Azure.Core.ResourceIdentifier targetResourceId = null, System.BinaryData targetProperties = null, System.BinaryData jobDefinitionProperties = null, Azure.ResourceManager.StorageMover.Models.JobRunError error = null, Azure.ResourceManager.StorageMover.Models.StorageMoverProvisioningState? provisioningState = default(Azure.ResourceManager.StorageMover.Models.StorageMoverProvisioningState?)) { throw null; } public static Azure.ResourceManager.StorageMover.Models.JobRunError JobRunError(string code = null, string message = null, string target = null) { throw null; } public static Azure.ResourceManager.StorageMover.Models.JobRunResourceId JobRunResourceId(Azure.Core.ResourceIdentifier jobRunResourceIdValue = null) { throw null; } public static Azure.ResourceManager.StorageMover.Models.NfsMountEndpointProperties NfsMountEndpointProperties(string description = null, Azure.ResourceManager.StorageMover.Models.StorageMoverProvisioningState? provisioningState = default(Azure.ResourceManager.StorageMover.Models.StorageMoverProvisioningState?), string host = null, Azure.ResourceManager.StorageMover.Models.NfsVersion? nfsVersion = default(Azure.ResourceManager.StorageMover.Models.NfsVersion?), string export = null) { throw null; } + public static Azure.ResourceManager.StorageMover.Models.SmbMountEndpointProperties SmbMountEndpointProperties(string description = null, Azure.ResourceManager.StorageMover.Models.StorageMoverProvisioningState? provisioningState = default(Azure.ResourceManager.StorageMover.Models.StorageMoverProvisioningState?), string host = null, string shareName = null, Azure.ResourceManager.StorageMover.Models.AzureKeyVaultSmbCredentials credentials = null) { throw null; } public static Azure.ResourceManager.StorageMover.StorageMoverAgentData StorageMoverAgentData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string description = null, string agentVersion = null, string arcResourceId = null, string arcVmUuid = null, Azure.ResourceManager.StorageMover.Models.StorageMoverAgentStatus? agentStatus = default(Azure.ResourceManager.StorageMover.Models.StorageMoverAgentStatus?), System.DateTimeOffset? lastStatusUpdate = default(System.DateTimeOffset?), string localIPAddress = null, long? memoryInMB = default(long?), long? numberOfCores = default(long?), long? uptimeInSeconds = default(long?), Azure.ResourceManager.StorageMover.Models.StorageMoverAgentPropertiesErrorDetails errorDetails = null, Azure.ResourceManager.StorageMover.Models.StorageMoverProvisioningState? provisioningState = default(Azure.ResourceManager.StorageMover.Models.StorageMoverProvisioningState?)) { throw null; } public static Azure.ResourceManager.StorageMover.Models.StorageMoverAgentPropertiesErrorDetails StorageMoverAgentPropertiesErrorDetails(string code = null, string message = null) { throw null; } public static Azure.ResourceManager.StorageMover.StorageMoverData StorageMoverData(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), string description = null, Azure.ResourceManager.StorageMover.Models.StorageMoverProvisioningState? provisioningState = default(Azure.ResourceManager.StorageMover.Models.StorageMoverProvisioningState?)) { throw null; } public static Azure.ResourceManager.StorageMover.StorageMoverEndpointData StorageMoverEndpointData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.StorageMover.Models.EndpointBaseProperties properties = null) { throw null; } public static Azure.ResourceManager.StorageMover.StorageMoverProjectData StorageMoverProjectData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string description = null, Azure.ResourceManager.StorageMover.Models.StorageMoverProvisioningState? provisioningState = default(Azure.ResourceManager.StorageMover.Models.StorageMoverProvisioningState?)) { throw null; } } + public partial class AzureKeyVaultSmbCredentials : Azure.ResourceManager.StorageMover.Models.StorageMoverCredentials + { + public AzureKeyVaultSmbCredentials() { } + public string PasswordUriString { get { throw null; } set { } } + public string UsernameUriString { get { throw null; } set { } } + } public partial class AzureStorageBlobContainerEndpointProperties : Azure.ResourceManager.StorageMover.Models.EndpointBaseProperties { public AzureStorageBlobContainerEndpointProperties(string storageAccountResourceId, string blobContainerName) { } public string BlobContainerName { get { throw null; } set { } } public string StorageAccountResourceId { get { throw null; } set { } } } + public partial class AzureStorageBlobContainerEndpointUpdateProperties : Azure.ResourceManager.StorageMover.Models.EndpointBaseUpdateProperties + { + public AzureStorageBlobContainerEndpointUpdateProperties() { } + } + public partial class AzureStorageSmbFileShareEndpointProperties : Azure.ResourceManager.StorageMover.Models.EndpointBaseProperties + { + public AzureStorageSmbFileShareEndpointProperties(Azure.Core.ResourceIdentifier storageAccountResourceId, string fileShareName) { } + public string FileShareName { get { throw null; } set { } } + public Azure.Core.ResourceIdentifier StorageAccountResourceId { get { throw null; } set { } } + } + public partial class AzureStorageSmbFileShareEndpointUpdateProperties : Azure.ResourceManager.StorageMover.Models.EndpointBaseUpdateProperties + { + public AzureStorageSmbFileShareEndpointUpdateProperties() { } + } public abstract partial class EndpointBaseProperties { protected EndpointBaseProperties() { } public string Description { get { throw null; } set { } } public Azure.ResourceManager.StorageMover.Models.StorageMoverProvisioningState? ProvisioningState { get { throw null; } } } + public abstract partial class EndpointBaseUpdateProperties + { + protected EndpointBaseUpdateProperties() { } + public string Description { get { throw null; } set { } } + } public partial class JobDefinitionPatch { public JobDefinitionPatch() { } @@ -389,6 +416,10 @@ public NfsMountEndpointProperties(string host, string export) { } public string Host { get { throw null; } set { } } public Azure.ResourceManager.StorageMover.Models.NfsVersion? NfsVersion { get { throw null; } set { } } } + public partial class NfsMountEndpointUpdateProperties : Azure.ResourceManager.StorageMover.Models.EndpointBaseUpdateProperties + { + public NfsMountEndpointUpdateProperties() { } + } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct NfsVersion : System.IEquatable { @@ -408,6 +439,18 @@ public NfsMountEndpointProperties(string host, string export) { } public static bool operator !=(Azure.ResourceManager.StorageMover.Models.NfsVersion left, Azure.ResourceManager.StorageMover.Models.NfsVersion right) { throw null; } public override string ToString() { throw null; } } + public partial class SmbMountEndpointProperties : Azure.ResourceManager.StorageMover.Models.EndpointBaseProperties + { + public SmbMountEndpointProperties(string host, string shareName) { } + public Azure.ResourceManager.StorageMover.Models.AzureKeyVaultSmbCredentials Credentials { get { throw null; } set { } } + public string Host { get { throw null; } set { } } + public string ShareName { get { throw null; } set { } } + } + public partial class SmbMountEndpointUpdateProperties : Azure.ResourceManager.StorageMover.Models.EndpointBaseUpdateProperties + { + public SmbMountEndpointUpdateProperties() { } + public Azure.ResourceManager.StorageMover.Models.AzureKeyVaultSmbCredentials Credentials { get { throw null; } set { } } + } public partial class StorageMoverAgentPatch { public StorageMoverAgentPatch() { } @@ -459,10 +502,17 @@ internal StorageMoverAgentPropertiesErrorDetails() { } public static bool operator !=(Azure.ResourceManager.StorageMover.Models.StorageMoverCopyMode left, Azure.ResourceManager.StorageMover.Models.StorageMoverCopyMode right) { throw null; } public override string ToString() { throw null; } } + public abstract partial class StorageMoverCredentials + { + protected StorageMoverCredentials() { } + } public partial class StorageMoverEndpointPatch { public StorageMoverEndpointPatch() { } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + [System.ObsoleteAttribute("This method is obsolete and will be removed in a future release", false)] public string EndpointBaseUpdateDescription { get { throw null; } set { } } + public Azure.ResourceManager.StorageMover.Models.EndpointBaseUpdateProperties Properties { get { throw null; } set { } } } public partial class StorageMoverPatch { diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/assets.json b/sdk/storagemover/Azure.ResourceManager.StorageMover/assets.json index 0945ec04b0f6..7a14434b603f 100644 --- a/sdk/storagemover/Azure.ResourceManager.StorageMover/assets.json +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "net", "TagPrefix": "net/storagemover/Azure.ResourceManager.StorageMover", - "Tag": "net/storagemover/Azure.ResourceManager.StorageMover_9fad905cce" + "Tag": "net/storagemover/Azure.ResourceManager.StorageMover_a69a115eac" } diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Customization/Models/StorageMoverEndpointPatch.cs b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Customization/Models/StorageMoverEndpointPatch.cs new file mode 100644 index 000000000000..add964de9879 --- /dev/null +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Customization/Models/StorageMoverEndpointPatch.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.Core; + +namespace Azure.ResourceManager.StorageMover.Models +{ + /// The Endpoint resource. + public partial class StorageMoverEndpointPatch + { + /// A description for the Endpoint. + [Obsolete("This method is obsolete and will be removed in a future release", false)] + [EditorBrowsable(EditorBrowsableState.Never)] + public string EndpointBaseUpdateDescription + { + get => Properties is null ? default : Properties.Description; + set + { + if (Properties is null) + Properties = new UnknownEndpointBaseUpdateProperties(); + Properties.Description = value; + } + } + } +} diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Customization/Models/UnknownEndpointBaseUpdateProperties.cs b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Customization/Models/UnknownEndpointBaseUpdateProperties.cs new file mode 100644 index 000000000000..0082287e1510 --- /dev/null +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Customization/Models/UnknownEndpointBaseUpdateProperties.cs @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.StorageMover.Models +{ + /// The UnknownEndpointBaseUpdateProperties. + internal partial class UnknownEndpointBaseUpdateProperties : EndpointBaseUpdateProperties + { + } +} diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/ArmStorageMoverModelFactory.cs b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/ArmStorageMoverModelFactory.cs index 9a14381c595c..5ee970775a9f 100644 --- a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/ArmStorageMoverModelFactory.cs +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/ArmStorageMoverModelFactory.cs @@ -73,7 +73,7 @@ public static StorageMoverAgentPropertiesErrorDetails StorageMoverAgentPropertie /// /// The resource specific properties for the Storage Mover resource. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include and . + /// The available derived classes include , , and . /// /// A new instance for mocking. public static StorageMoverEndpointData StorageMoverEndpointData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, EndpointBaseProperties properties = null) @@ -208,5 +208,28 @@ public static NfsMountEndpointProperties NfsMountEndpointProperties(string descr { return new NfsMountEndpointProperties(EndpointType.NfsMount, description, provisioningState, host, nfsVersion, export); } + + /// Initializes a new instance of AzureStorageSmbFileShareEndpointProperties. + /// A description for the Endpoint. + /// The provisioning state of this resource. + /// The Azure Resource ID of the storage account. + /// The name of the Azure Storage file share. + /// A new instance for mocking. + public static AzureStorageSmbFileShareEndpointProperties AzureStorageSmbFileShareEndpointProperties(string description = null, StorageMoverProvisioningState? provisioningState = null, ResourceIdentifier storageAccountResourceId = null, string fileShareName = null) + { + return new AzureStorageSmbFileShareEndpointProperties(EndpointType.AzureStorageSmbFileShare, description, provisioningState, storageAccountResourceId, fileShareName); + } + + /// Initializes a new instance of SmbMountEndpointProperties. + /// A description for the Endpoint. + /// The provisioning state of this resource. + /// The host name or IP address of the server exporting the file system. + /// The name of the SMB share being exported from the server. + /// The Azure Key Vault secret URIs which store the required credentials to access the SMB share. + /// A new instance for mocking. + public static SmbMountEndpointProperties SmbMountEndpointProperties(string description = null, StorageMoverProvisioningState? provisioningState = null, string host = null, string shareName = null, AzureKeyVaultSmbCredentials credentials = null) + { + return new SmbMountEndpointProperties(EndpointType.SmbMount, description, provisioningState, host, shareName, credentials); + } } } diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/AzureKeyVaultSmbCredentials.Serialization.cs b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/AzureKeyVaultSmbCredentials.Serialization.cs new file mode 100644 index 000000000000..8d23135b78bf --- /dev/null +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/AzureKeyVaultSmbCredentials.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.StorageMover.Models +{ + public partial class AzureKeyVaultSmbCredentials : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(UsernameUriString)) + { + writer.WritePropertyName("usernameUri"u8); + writer.WriteStringValue(UsernameUriString); + } + if (Optional.IsDefined(PasswordUriString)) + { + writer.WritePropertyName("passwordUri"u8); + writer.WriteStringValue(PasswordUriString); + } + writer.WritePropertyName("type"u8); + writer.WriteStringValue(CredentialType.ToString()); + writer.WriteEndObject(); + } + + internal static AzureKeyVaultSmbCredentials DeserializeAzureKeyVaultSmbCredentials(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional usernameUriString = default; + Optional passwordUriString = default; + CredentialType type = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("usernameUri"u8)) + { + usernameUriString = property.Value.GetString(); + continue; + } + if (property.NameEquals("passwordUri"u8)) + { + passwordUriString = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new CredentialType(property.Value.GetString()); + continue; + } + } + return new AzureKeyVaultSmbCredentials(type, usernameUriString.Value, passwordUriString.Value); + } + } +} diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/AzureKeyVaultSmbCredentials.cs b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/AzureKeyVaultSmbCredentials.cs new file mode 100644 index 000000000000..1759c84d9417 --- /dev/null +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/AzureKeyVaultSmbCredentials.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.StorageMover.Models +{ + /// The Azure Key Vault secret URIs which store the credentials. + public partial class AzureKeyVaultSmbCredentials : StorageMoverCredentials + { + /// Initializes a new instance of AzureKeyVaultSmbCredentials. + public AzureKeyVaultSmbCredentials() + { + CredentialType = CredentialType.AzureKeyVaultSmb; + } + + /// Initializes a new instance of AzureKeyVaultSmbCredentials. + /// The Credentials type. + /// The Azure Key Vault secret URI which stores the username. Use empty string to clean-up existing value. + /// The Azure Key Vault secret URI which stores the password. Use empty string to clean-up existing value. + internal AzureKeyVaultSmbCredentials(CredentialType credentialType, string usernameUriString, string passwordUriString) : base(credentialType) + { + UsernameUriString = usernameUriString; + PasswordUriString = passwordUriString; + CredentialType = credentialType; + } + + /// The Azure Key Vault secret URI which stores the username. Use empty string to clean-up existing value. + public string UsernameUriString { get; set; } + /// The Azure Key Vault secret URI which stores the password. Use empty string to clean-up existing value. + public string PasswordUriString { get; set; } + } +} diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/AzureStorageBlobContainerEndpointProperties.cs b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/AzureStorageBlobContainerEndpointProperties.cs index 4987b28d5cc1..6820ea1cb6ed 100644 --- a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/AzureStorageBlobContainerEndpointProperties.cs +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/AzureStorageBlobContainerEndpointProperties.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.StorageMover.Models { - /// The AzureStorageBlobContainerEndpointProperties. + /// The properties of Azure Storage blob container endpoint. public partial class AzureStorageBlobContainerEndpointProperties : EndpointBaseProperties { /// Initializes a new instance of AzureStorageBlobContainerEndpointProperties. diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/AzureStorageBlobContainerEndpointUpdateProperties.Serialization.cs b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/AzureStorageBlobContainerEndpointUpdateProperties.Serialization.cs new file mode 100644 index 000000000000..b9d84278725f --- /dev/null +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/AzureStorageBlobContainerEndpointUpdateProperties.Serialization.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.StorageMover.Models +{ + public partial class AzureStorageBlobContainerEndpointUpdateProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("endpointType"u8); + writer.WriteStringValue(EndpointType.ToString()); + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/AzureStorageBlobContainerEndpointUpdateProperties.cs b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/AzureStorageBlobContainerEndpointUpdateProperties.cs new file mode 100644 index 000000000000..37f10d31376c --- /dev/null +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/AzureStorageBlobContainerEndpointUpdateProperties.cs @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.StorageMover.Models +{ + /// The AzureStorageBlobContainerEndpointUpdateProperties. + public partial class AzureStorageBlobContainerEndpointUpdateProperties : EndpointBaseUpdateProperties + { + /// Initializes a new instance of AzureStorageBlobContainerEndpointUpdateProperties. + public AzureStorageBlobContainerEndpointUpdateProperties() + { + EndpointType = EndpointType.AzureStorageBlobContainer; + } + } +} diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/AzureStorageSmbFileShareEndpointProperties.Serialization.cs b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/AzureStorageSmbFileShareEndpointProperties.Serialization.cs new file mode 100644 index 000000000000..b630f5bc3dc6 --- /dev/null +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/AzureStorageSmbFileShareEndpointProperties.Serialization.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.StorageMover.Models +{ + public partial class AzureStorageSmbFileShareEndpointProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("storageAccountResourceId"u8); + writer.WriteStringValue(StorageAccountResourceId); + writer.WritePropertyName("fileShareName"u8); + writer.WriteStringValue(FileShareName); + writer.WritePropertyName("endpointType"u8); + writer.WriteStringValue(EndpointType.ToString()); + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + writer.WriteEndObject(); + } + + internal static AzureStorageSmbFileShareEndpointProperties DeserializeAzureStorageSmbFileShareEndpointProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier storageAccountResourceId = default; + string fileShareName = default; + EndpointType endpointType = default; + Optional description = default; + Optional provisioningState = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("storageAccountResourceId"u8)) + { + storageAccountResourceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("fileShareName"u8)) + { + fileShareName = property.Value.GetString(); + continue; + } + if (property.NameEquals("endpointType"u8)) + { + endpointType = new EndpointType(property.Value.GetString()); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new StorageMoverProvisioningState(property.Value.GetString()); + continue; + } + } + return new AzureStorageSmbFileShareEndpointProperties(endpointType, description.Value, Optional.ToNullable(provisioningState), storageAccountResourceId, fileShareName); + } + } +} diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/AzureStorageSmbFileShareEndpointProperties.cs b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/AzureStorageSmbFileShareEndpointProperties.cs new file mode 100644 index 000000000000..93ad42bd6f26 --- /dev/null +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/AzureStorageSmbFileShareEndpointProperties.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.ResourceManager.StorageMover.Models +{ + /// The properties of Azure Storage SMB file share endpoint. + public partial class AzureStorageSmbFileShareEndpointProperties : EndpointBaseProperties + { + /// Initializes a new instance of AzureStorageSmbFileShareEndpointProperties. + /// The Azure Resource ID of the storage account. + /// The name of the Azure Storage file share. + /// or is null. + public AzureStorageSmbFileShareEndpointProperties(ResourceIdentifier storageAccountResourceId, string fileShareName) + { + Argument.AssertNotNull(storageAccountResourceId, nameof(storageAccountResourceId)); + Argument.AssertNotNull(fileShareName, nameof(fileShareName)); + + StorageAccountResourceId = storageAccountResourceId; + FileShareName = fileShareName; + EndpointType = EndpointType.AzureStorageSmbFileShare; + } + + /// Initializes a new instance of AzureStorageSmbFileShareEndpointProperties. + /// The Endpoint resource type. + /// A description for the Endpoint. + /// The provisioning state of this resource. + /// The Azure Resource ID of the storage account. + /// The name of the Azure Storage file share. + internal AzureStorageSmbFileShareEndpointProperties(EndpointType endpointType, string description, StorageMoverProvisioningState? provisioningState, ResourceIdentifier storageAccountResourceId, string fileShareName) : base(endpointType, description, provisioningState) + { + StorageAccountResourceId = storageAccountResourceId; + FileShareName = fileShareName; + EndpointType = endpointType; + } + + /// The Azure Resource ID of the storage account. + public ResourceIdentifier StorageAccountResourceId { get; set; } + /// The name of the Azure Storage file share. + public string FileShareName { get; set; } + } +} diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/AzureStorageSmbFileShareEndpointUpdateProperties.Serialization.cs b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/AzureStorageSmbFileShareEndpointUpdateProperties.Serialization.cs new file mode 100644 index 000000000000..5b29a8cda93d --- /dev/null +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/AzureStorageSmbFileShareEndpointUpdateProperties.Serialization.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.StorageMover.Models +{ + public partial class AzureStorageSmbFileShareEndpointUpdateProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("endpointType"u8); + writer.WriteStringValue(EndpointType.ToString()); + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/AzureStorageSmbFileShareEndpointUpdateProperties.cs b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/AzureStorageSmbFileShareEndpointUpdateProperties.cs new file mode 100644 index 000000000000..1c90cb173548 --- /dev/null +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/AzureStorageSmbFileShareEndpointUpdateProperties.cs @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.StorageMover.Models +{ + /// The properties of Azure Storage SMB file share endpoint to update. + public partial class AzureStorageSmbFileShareEndpointUpdateProperties : EndpointBaseUpdateProperties + { + /// Initializes a new instance of AzureStorageSmbFileShareEndpointUpdateProperties. + public AzureStorageSmbFileShareEndpointUpdateProperties() + { + EndpointType = EndpointType.AzureStorageSmbFileShare; + } + } +} diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/CredentialType.cs b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/CredentialType.cs new file mode 100644 index 000000000000..f2e2c4c192c2 --- /dev/null +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/CredentialType.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.StorageMover.Models +{ + /// The Credentials type. + internal readonly partial struct CredentialType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public CredentialType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AzureKeyVaultSmbValue = "AzureKeyVaultSmb"; + + /// AzureKeyVaultSmb. + public static CredentialType AzureKeyVaultSmb { get; } = new CredentialType(AzureKeyVaultSmbValue); + /// Determines if two values are the same. + public static bool operator ==(CredentialType left, CredentialType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(CredentialType left, CredentialType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator CredentialType(string value) => new CredentialType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is CredentialType other && Equals(other); + /// + public bool Equals(CredentialType 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/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/EndpointBaseProperties.Serialization.cs b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/EndpointBaseProperties.Serialization.cs index bbd084cffb2c..b52db7d06ccf 100644 --- a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/EndpointBaseProperties.Serialization.cs +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/EndpointBaseProperties.Serialization.cs @@ -36,7 +36,9 @@ internal static EndpointBaseProperties DeserializeEndpointBaseProperties(JsonEle switch (discriminator.GetString()) { case "AzureStorageBlobContainer": return AzureStorageBlobContainerEndpointProperties.DeserializeAzureStorageBlobContainerEndpointProperties(element); + case "AzureStorageSmbFileShare": return AzureStorageSmbFileShareEndpointProperties.DeserializeAzureStorageSmbFileShareEndpointProperties(element); case "NfsMount": return NfsMountEndpointProperties.DeserializeNfsMountEndpointProperties(element); + case "SmbMount": return SmbMountEndpointProperties.DeserializeSmbMountEndpointProperties(element); } } return UnknownEndpointBaseProperties.DeserializeUnknownEndpointBaseProperties(element); diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/EndpointBaseProperties.cs b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/EndpointBaseProperties.cs index fe0d69b72fea..4169fb79e8af 100644 --- a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/EndpointBaseProperties.cs +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/EndpointBaseProperties.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.StorageMover.Models /// /// The resource specific properties for the Storage Mover resource. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include and . + /// The available derived classes include , , and . /// public abstract partial class EndpointBaseProperties { diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/EndpointBaseUpdateProperties.Serialization.cs b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/EndpointBaseUpdateProperties.Serialization.cs index 909778a360d5..61038e695b73 100644 --- a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/EndpointBaseUpdateProperties.Serialization.cs +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/EndpointBaseUpdateProperties.Serialization.cs @@ -10,11 +10,13 @@ namespace Azure.ResourceManager.StorageMover.Models { - internal partial class EndpointBaseUpdateProperties : IUtf8JsonSerializable + public partial class EndpointBaseUpdateProperties : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + writer.WritePropertyName("endpointType"u8); + writer.WriteStringValue(EndpointType.ToString()); if (Optional.IsDefined(Description)) { writer.WritePropertyName("description"u8); diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/EndpointBaseUpdateProperties.cs b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/EndpointBaseUpdateProperties.cs index def899a88d6b..b00d4daa1f24 100644 --- a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/EndpointBaseUpdateProperties.cs +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/EndpointBaseUpdateProperties.cs @@ -7,14 +7,20 @@ namespace Azure.ResourceManager.StorageMover.Models { - /// The Endpoint resource, which contains information about file sources and targets. - internal partial class EndpointBaseUpdateProperties + /// + /// The Endpoint resource, which contains information about file sources and targets. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , and . + /// + public abstract partial class EndpointBaseUpdateProperties { /// Initializes a new instance of EndpointBaseUpdateProperties. - public EndpointBaseUpdateProperties() + protected EndpointBaseUpdateProperties() { } + /// The Endpoint resource type. + internal EndpointType EndpointType { get; set; } /// A description for the Endpoint. public string Description { get; set; } } diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/EndpointType.cs b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/EndpointType.cs index 68db4ff329c5..68ab592cd48b 100644 --- a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/EndpointType.cs +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/EndpointType.cs @@ -24,11 +24,17 @@ public EndpointType(string value) private const string AzureStorageBlobContainerValue = "AzureStorageBlobContainer"; private const string NfsMountValue = "NfsMount"; + private const string AzureStorageSmbFileShareValue = "AzureStorageSmbFileShare"; + private const string SmbMountValue = "SmbMount"; /// AzureStorageBlobContainer. public static EndpointType AzureStorageBlobContainer { get; } = new EndpointType(AzureStorageBlobContainerValue); /// NfsMount. public static EndpointType NfsMount { get; } = new EndpointType(NfsMountValue); + /// AzureStorageSmbFileShare. + public static EndpointType AzureStorageSmbFileShare { get; } = new EndpointType(AzureStorageSmbFileShareValue); + /// SmbMount. + public static EndpointType SmbMount { get; } = new EndpointType(SmbMountValue); /// Determines if two values are the same. public static bool operator ==(EndpointType left, EndpointType right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/NfsMountEndpointProperties.cs b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/NfsMountEndpointProperties.cs index 1d1822e8ba5f..194f6d99c30c 100644 --- a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/NfsMountEndpointProperties.cs +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/NfsMountEndpointProperties.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.StorageMover.Models { - /// The NfsMountEndpointProperties. + /// The properties of NFS share endpoint. public partial class NfsMountEndpointProperties : EndpointBaseProperties { /// Initializes a new instance of NfsMountEndpointProperties. diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/NfsMountEndpointUpdateProperties.Serialization.cs b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/NfsMountEndpointUpdateProperties.Serialization.cs new file mode 100644 index 000000000000..8f67dd7cc6fa --- /dev/null +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/NfsMountEndpointUpdateProperties.Serialization.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.StorageMover.Models +{ + public partial class NfsMountEndpointUpdateProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("endpointType"u8); + writer.WriteStringValue(EndpointType.ToString()); + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/NfsMountEndpointUpdateProperties.cs b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/NfsMountEndpointUpdateProperties.cs new file mode 100644 index 000000000000..b6d4e29b6d11 --- /dev/null +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/NfsMountEndpointUpdateProperties.cs @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.StorageMover.Models +{ + /// The NfsMountEndpointUpdateProperties. + public partial class NfsMountEndpointUpdateProperties : EndpointBaseUpdateProperties + { + /// Initializes a new instance of NfsMountEndpointUpdateProperties. + public NfsMountEndpointUpdateProperties() + { + EndpointType = EndpointType.NfsMount; + } + } +} diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/SmbMountEndpointProperties.Serialization.cs b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/SmbMountEndpointProperties.Serialization.cs new file mode 100644 index 000000000000..34ee22829e68 --- /dev/null +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/SmbMountEndpointProperties.Serialization.cs @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.StorageMover.Models +{ + public partial class SmbMountEndpointProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("host"u8); + writer.WriteStringValue(Host); + writer.WritePropertyName("shareName"u8); + writer.WriteStringValue(ShareName); + if (Optional.IsDefined(Credentials)) + { + writer.WritePropertyName("credentials"u8); + writer.WriteObjectValue(Credentials); + } + writer.WritePropertyName("endpointType"u8); + writer.WriteStringValue(EndpointType.ToString()); + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + writer.WriteEndObject(); + } + + internal static SmbMountEndpointProperties DeserializeSmbMountEndpointProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string host = default; + string shareName = default; + Optional credentials = default; + EndpointType endpointType = default; + Optional description = default; + Optional provisioningState = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("host"u8)) + { + host = property.Value.GetString(); + continue; + } + if (property.NameEquals("shareName"u8)) + { + shareName = property.Value.GetString(); + continue; + } + if (property.NameEquals("credentials"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + credentials = AzureKeyVaultSmbCredentials.DeserializeAzureKeyVaultSmbCredentials(property.Value); + continue; + } + if (property.NameEquals("endpointType"u8)) + { + endpointType = new EndpointType(property.Value.GetString()); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new StorageMoverProvisioningState(property.Value.GetString()); + continue; + } + } + return new SmbMountEndpointProperties(endpointType, description.Value, Optional.ToNullable(provisioningState), host, shareName, credentials.Value); + } + } +} diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/SmbMountEndpointProperties.cs b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/SmbMountEndpointProperties.cs new file mode 100644 index 000000000000..9ff4ea2c7841 --- /dev/null +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/SmbMountEndpointProperties.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.ResourceManager.StorageMover.Models +{ + /// The properties of SMB share endpoint. + public partial class SmbMountEndpointProperties : EndpointBaseProperties + { + /// Initializes a new instance of SmbMountEndpointProperties. + /// The host name or IP address of the server exporting the file system. + /// The name of the SMB share being exported from the server. + /// or is null. + public SmbMountEndpointProperties(string host, string shareName) + { + Argument.AssertNotNull(host, nameof(host)); + Argument.AssertNotNull(shareName, nameof(shareName)); + + Host = host; + ShareName = shareName; + EndpointType = EndpointType.SmbMount; + } + + /// Initializes a new instance of SmbMountEndpointProperties. + /// The Endpoint resource type. + /// A description for the Endpoint. + /// The provisioning state of this resource. + /// The host name or IP address of the server exporting the file system. + /// The name of the SMB share being exported from the server. + /// The Azure Key Vault secret URIs which store the required credentials to access the SMB share. + internal SmbMountEndpointProperties(EndpointType endpointType, string description, StorageMoverProvisioningState? provisioningState, string host, string shareName, AzureKeyVaultSmbCredentials credentials) : base(endpointType, description, provisioningState) + { + Host = host; + ShareName = shareName; + Credentials = credentials; + EndpointType = endpointType; + } + + /// The host name or IP address of the server exporting the file system. + public string Host { get; set; } + /// The name of the SMB share being exported from the server. + public string ShareName { get; set; } + /// The Azure Key Vault secret URIs which store the required credentials to access the SMB share. + public AzureKeyVaultSmbCredentials Credentials { get; set; } + } +} diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/SmbMountEndpointUpdateProperties.Serialization.cs b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/SmbMountEndpointUpdateProperties.Serialization.cs new file mode 100644 index 000000000000..8c70ccd6bf33 --- /dev/null +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/SmbMountEndpointUpdateProperties.Serialization.cs @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.StorageMover.Models +{ + public partial class SmbMountEndpointUpdateProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Credentials)) + { + writer.WritePropertyName("credentials"u8); + writer.WriteObjectValue(Credentials); + } + writer.WritePropertyName("endpointType"u8); + writer.WriteStringValue(EndpointType.ToString()); + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/SmbMountEndpointUpdateProperties.cs b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/SmbMountEndpointUpdateProperties.cs new file mode 100644 index 000000000000..365955601657 --- /dev/null +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/SmbMountEndpointUpdateProperties.cs @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.StorageMover.Models +{ + /// The properties of SMB share endpoint to update. + public partial class SmbMountEndpointUpdateProperties : EndpointBaseUpdateProperties + { + /// Initializes a new instance of SmbMountEndpointUpdateProperties. + public SmbMountEndpointUpdateProperties() + { + EndpointType = EndpointType.SmbMount; + } + + /// The Azure Key Vault secret URIs which store the required credentials to access the SMB share. + public AzureKeyVaultSmbCredentials Credentials { get; set; } + } +} diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/StorageMoverCredentials.Serialization.cs b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/StorageMoverCredentials.Serialization.cs new file mode 100644 index 000000000000..123b6e3cf4cc --- /dev/null +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/StorageMoverCredentials.Serialization.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.StorageMover.Models +{ + public partial class StorageMoverCredentials : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("type"u8); + writer.WriteStringValue(CredentialType.ToString()); + writer.WriteEndObject(); + } + + internal static StorageMoverCredentials DeserializeStorageMoverCredentials(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("type", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "AzureKeyVaultSmb": return AzureKeyVaultSmbCredentials.DeserializeAzureKeyVaultSmbCredentials(element); + } + } + return UnknownCredentials.DeserializeUnknownCredentials(element); + } + } +} diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/StorageMoverCredentials.cs b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/StorageMoverCredentials.cs new file mode 100644 index 000000000000..fd6334c444fe --- /dev/null +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/StorageMoverCredentials.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.StorageMover.Models +{ + /// + /// The Credentials. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + public abstract partial class StorageMoverCredentials + { + /// Initializes a new instance of StorageMoverCredentials. + protected StorageMoverCredentials() + { + } + + /// Initializes a new instance of StorageMoverCredentials. + /// The Credentials type. + internal StorageMoverCredentials(CredentialType credentialType) + { + CredentialType = credentialType; + } + + /// The Credentials type. + internal CredentialType CredentialType { get; set; } + } +} diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/StorageMoverEndpointPatch.cs b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/StorageMoverEndpointPatch.cs index 125572b68c27..61af6784ca2b 100644 --- a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/StorageMoverEndpointPatch.cs +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/StorageMoverEndpointPatch.cs @@ -15,18 +15,11 @@ public StorageMoverEndpointPatch() { } - /// The Endpoint resource, which contains information about file sources and targets. - internal EndpointBaseUpdateProperties Properties { get; set; } - /// A description for the Endpoint. - public string EndpointBaseUpdateDescription - { - get => Properties is null ? default : Properties.Description; - set - { - if (Properties is null) - Properties = new EndpointBaseUpdateProperties(); - Properties.Description = value; - } - } + /// + /// The Endpoint resource, which contains information about file sources and targets. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , and . + /// + public EndpointBaseUpdateProperties Properties { get; set; } } } diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/UnknownCredentials.Serialization.cs b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/UnknownCredentials.Serialization.cs new file mode 100644 index 000000000000..151d876072f4 --- /dev/null +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/UnknownCredentials.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.StorageMover.Models +{ + internal partial class UnknownCredentials : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("type"u8); + writer.WriteStringValue(CredentialType.ToString()); + writer.WriteEndObject(); + } + + internal static UnknownCredentials DeserializeUnknownCredentials(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CredentialType type = "Unknown"; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = new CredentialType(property.Value.GetString()); + continue; + } + } + return new UnknownCredentials(type); + } + } +} diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/UnknownCredentials.cs b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/UnknownCredentials.cs new file mode 100644 index 000000000000..938dea57c446 --- /dev/null +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/Models/UnknownCredentials.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.StorageMover.Models +{ + /// The UnknownCredentials. + internal partial class UnknownCredentials : StorageMoverCredentials + { + /// Initializes a new instance of UnknownCredentials. + /// The Credentials type. + internal UnknownCredentials(CredentialType credentialType) : base(credentialType) + { + CredentialType = credentialType; + } + } +} diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/RestOperations/AgentsRestOperations.cs b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/RestOperations/AgentsRestOperations.cs index 066e0782f93a..58a228ebb21b 100644 --- a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/RestOperations/AgentsRestOperations.cs +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/RestOperations/AgentsRestOperations.cs @@ -33,7 +33,7 @@ public AgentsRestOperations(HttpPipeline pipeline, string applicationId, Uri end { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-01"; + _apiVersion = apiVersion ?? "2023-07-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/RestOperations/EndpointsRestOperations.cs b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/RestOperations/EndpointsRestOperations.cs index cada89bec20d..d9e86467d3b1 100644 --- a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/RestOperations/EndpointsRestOperations.cs +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/RestOperations/EndpointsRestOperations.cs @@ -33,7 +33,7 @@ public EndpointsRestOperations(HttpPipeline pipeline, string applicationId, Uri { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-01"; + _apiVersion = apiVersion ?? "2023-07-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/RestOperations/JobDefinitionsRestOperations.cs b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/RestOperations/JobDefinitionsRestOperations.cs index 858f3599a854..8fba4aa8fc60 100644 --- a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/RestOperations/JobDefinitionsRestOperations.cs +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/RestOperations/JobDefinitionsRestOperations.cs @@ -33,7 +33,7 @@ public JobDefinitionsRestOperations(HttpPipeline pipeline, string applicationId, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-01"; + _apiVersion = apiVersion ?? "2023-07-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/RestOperations/JobRunsRestOperations.cs b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/RestOperations/JobRunsRestOperations.cs index 5697665f3fab..e1fd6316c7aa 100644 --- a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/RestOperations/JobRunsRestOperations.cs +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/RestOperations/JobRunsRestOperations.cs @@ -33,7 +33,7 @@ public JobRunsRestOperations(HttpPipeline pipeline, string applicationId, Uri en { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-01"; + _apiVersion = apiVersion ?? "2023-07-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/RestOperations/ProjectsRestOperations.cs b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/RestOperations/ProjectsRestOperations.cs index 6aff90eb1777..e3ce1e27b95f 100644 --- a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/RestOperations/ProjectsRestOperations.cs +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/RestOperations/ProjectsRestOperations.cs @@ -33,7 +33,7 @@ public ProjectsRestOperations(HttpPipeline pipeline, string applicationId, Uri e { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-01"; + _apiVersion = apiVersion ?? "2023-07-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/RestOperations/StorageMoversRestOperations.cs b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/RestOperations/StorageMoversRestOperations.cs index bf02debda1ed..9ca339d2e561 100644 --- a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/RestOperations/StorageMoversRestOperations.cs +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/RestOperations/StorageMoversRestOperations.cs @@ -33,7 +33,7 @@ public StorageMoversRestOperations(HttpPipeline pipeline, string applicationId, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-03-01"; + _apiVersion = apiVersion ?? "2023-07-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/StorageMoverEndpointData.cs b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/StorageMoverEndpointData.cs index fdd2d28bea11..07e56a8770ba 100644 --- a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/StorageMoverEndpointData.cs +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/StorageMoverEndpointData.cs @@ -22,7 +22,7 @@ public partial class StorageMoverEndpointData : ResourceData /// /// The resource specific properties for the Storage Mover resource. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include and . + /// The available derived classes include , , and . /// /// is null. public StorageMoverEndpointData(EndpointBaseProperties properties) @@ -40,7 +40,7 @@ public StorageMoverEndpointData(EndpointBaseProperties properties) /// /// The resource specific properties for the Storage Mover resource. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include and . + /// The available derived classes include , , and . /// internal StorageMoverEndpointData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, EndpointBaseProperties properties) : base(id, name, resourceType, systemData) { @@ -50,7 +50,7 @@ internal StorageMoverEndpointData(ResourceIdentifier id, string name, ResourceTy /// /// The resource specific properties for the Storage Mover resource. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include and . + /// The available derived classes include , , and . /// public EndpointBaseProperties Properties { get; set; } } diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/autorest.md b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/autorest.md index 6c628e493225..9b160fc3c2b4 100644 --- a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/autorest.md +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/autorest.md @@ -7,7 +7,7 @@ azure-arm: true csharp: true library-name: StorageMover namespace: Azure.ResourceManager.StorageMover -require: https://github.com/Azure/azure-rest-api-specs/blob/0b1805b3ce076549ba4e9285a4f0f8727caf53a5/specification/storagemover/resource-manager/readme.md +require: https://github.com/Azure/azure-rest-api-specs/blob/ed9bde6a3db71b84fdba076ba0546213bcce56ee/specification/storagemover/resource-manager/readme.md output-folder: $(this-folder)/Generated clear-output-folder: true skip-csproj: true @@ -22,6 +22,7 @@ rename-mapping: AgentStatus: StorageMoverAgentStatus CopyMode: StorageMoverCopyMode ProvisioningState: StorageMoverProvisioningState + Credentials : StorageMoverCredentials JobDefinition.properties.agentResourceId: -|arm-id JobDefinition.properties.latestJobRunResourceId: -|arm-id JobDefinition.properties.targetResourceId: -|arm-id @@ -30,12 +31,12 @@ rename-mapping: JobRun.properties.sourceResourceId: -|arm-id JobRun.properties.targetResourceId: -|arm-id JobRunResourceId.jobRunResourceId: -|arm-id + AzureStorageBlobContainerEndpointProperties.storageAccountResourceId: -|string format-by-name-rules: 'tenantId': 'uuid' 'ETag': 'etag' 'location': 'azure-location' - '*Uri': 'Uri' '*Uris': 'Uri' rename-rules: @@ -60,5 +61,6 @@ rename-rules: SSO: Sso URI: Uri Etag: ETag|etag - + PasswordUri: PasswordUriString + UsernameUri: UsernameUriString ``` diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/tests/Scenario/EndpointCollectionTests.cs b/sdk/storagemover/Azure.ResourceManager.StorageMover/tests/Scenario/EndpointCollectionTests.cs deleted file mode 100644 index 65355e01cf65..000000000000 --- a/sdk/storagemover/Azure.ResourceManager.StorageMover/tests/Scenario/EndpointCollectionTests.cs +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System.Threading.Tasks; -using Azure.Core.TestFramework; -using Azure.ResourceManager.Resources; -using Azure.ResourceManager.StorageMover.Models; -using NUnit.Framework; - -namespace Azure.ResourceManager.StorageMover.Tests.Scenario -{ - public class EndpointCollectionTests : StorageMoverManagementTestBase - { - public EndpointCollectionTests(bool isAsync) - : base(isAsync) //, RecordedTestMode.Record) - { - } - - [Test] - [RecordedTest] - public async Task CreateUpdateGetTest() - { - ResourceGroupResource resourceGroup = await GetResourceGroupAsync(ResourceGroupName); - StorageMoverCollection storageMovers = resourceGroup.GetStorageMovers(); - StorageMoverEndpointCollection endpoints = (await storageMovers.GetAsync(StorageMoverName)).Value.GetStorageMoverEndpoints(); - - string cEndpointName = Recording.GenerateAssetName("conendpoint-"); - string nfsEndpointName = Recording.GenerateAssetName("nfsendpoint-"); - string accountResourceId = DefaultSubscription.Id.ToString() + "/resourceGroups/" + ResourceGroupName + - "/providers/Microsoft.Storage/storageAccounts/" + StorageAccountName; - - AzureStorageBlobContainerEndpointProperties containerEndpointProperties = - new AzureStorageBlobContainerEndpointProperties(accountResourceId, ContainerName); - StorageMoverEndpointData data = new StorageMoverEndpointData(containerEndpointProperties); - StorageMoverEndpointResource cEndpoint = (await endpoints.CreateOrUpdateAsync(WaitUntil.Completed, cEndpointName, data)).Value; - Assert.AreEqual(cEndpoint.Data.Name, cEndpointName); - Assert.AreEqual("AzureStorageBlobContainer", cEndpoint.Data.Properties.EndpointType.ToString()); - - NfsMountEndpointProperties nfsMountEndpointProperties = new NfsMountEndpointProperties("10.0.0.1", "/"); - data = new StorageMoverEndpointData(nfsMountEndpointProperties); - StorageMoverEndpointResource nfsEndpoint = (await endpoints.CreateOrUpdateAsync(WaitUntil.Completed, nfsEndpointName, data)).Value; - Assert.AreEqual(nfsEndpoint.Data.Name, nfsEndpointName); - Assert.AreEqual("NfsMount", nfsEndpoint.Data.Properties.EndpointType.ToString()); - - cEndpoint = (await endpoints.GetAsync(cEndpointName)).Value; - Assert.AreEqual(cEndpoint.Data.Name, cEndpointName); - Assert.AreEqual("AzureStorageBlobContainer", cEndpoint.Data.Properties.EndpointType.ToString()); - - int counter = 0; - await foreach (StorageMoverEndpointResource _ in endpoints.GetAllAsync()) - { - counter++; - } - Assert.Greater(counter, 1); - - Assert.IsTrue(await endpoints.ExistsAsync(cEndpointName)); - Assert.IsFalse(await endpoints.ExistsAsync(cEndpointName + "111")); - } - } -} diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/tests/Scenario/EndpointResourceTests.cs b/sdk/storagemover/Azure.ResourceManager.StorageMover/tests/Scenario/EndpointResourceTests.cs deleted file mode 100644 index 12903f8e6ad1..000000000000 --- a/sdk/storagemover/Azure.ResourceManager.StorageMover/tests/Scenario/EndpointResourceTests.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System.Threading.Tasks; -using Azure.Core.TestFramework; -using Azure.ResourceManager.Resources; -using Azure.ResourceManager.StorageMover.Models; -using NUnit.Framework; - -namespace Azure.ResourceManager.StorageMover.Tests.Scenario -{ - public class EndpointResourceTests : StorageMoverManagementTestBase - { - public EndpointResourceTests(bool isAsync) - : base(isAsync) //, RecordedTestMode.Record) - { - } - - [Test] - [RecordedTest] - public async Task GetUpdateDeleteTest() - { - ResourceGroupResource resourceGroup = await GetResourceGroupAsync(ResourceGroupName); - StorageMoverCollection storageMovers = resourceGroup.GetStorageMovers(); - StorageMoverEndpointCollection endpoints = (await storageMovers.GetAsync(StorageMoverName)).Value.GetStorageMoverEndpoints(); - - string accountResourceId = DefaultSubscription.Id.ToString() + "/resourceGroups/" + ResourceGroupName + - "/providers/Microsoft.Storage/storageAccounts/" + StorageAccountName; - - string endpointName = Recording.GenerateAssetName("endpoint-"); - AzureStorageBlobContainerEndpointProperties containerEndpointProperties = - new AzureStorageBlobContainerEndpointProperties(accountResourceId, ContainerName); - StorageMoverEndpointData data = new StorageMoverEndpointData(containerEndpointProperties); - StorageMoverEndpointResource endpoint1 = (await endpoints.CreateOrUpdateAsync(WaitUntil.Completed, endpointName, data)).Value; - StorageMoverEndpointResource endpoint2 = (await endpoint1.GetAsync()).Value; - Assert.AreEqual(endpoint1.Data.Name, endpoint2.Data.Name); - Assert.AreEqual(endpoint1.Data.Properties.Description, endpoint2.Data.Properties.Description); - Assert.AreEqual(endpoint1.Id.Name, endpoint2.Id.Name); - Assert.AreEqual(endpoint1.Id.Location, endpoint2.Id.Location); - - StorageMoverEndpointPatch patch = new(); - patch.Properties = new EndpointBaseUpdateProperties(); - patch.Properties.Description = "this is an updated endpoint"; - endpoint1 = (await endpoint1.UpdateAsync(patch)).Value; - Assert.AreEqual("this is an updated endpoint", endpoint1.Data.Properties.Description); - - await endpoint1.DeleteAsync(WaitUntil.Completed); - Assert.IsFalse(await endpoints.ExistsAsync(endpointName)); - } - } -} diff --git a/sdk/storagemover/Azure.ResourceManager.StorageMover/tests/Scenario/EndpointTests.cs b/sdk/storagemover/Azure.ResourceManager.StorageMover/tests/Scenario/EndpointTests.cs new file mode 100644 index 000000000000..b15db92b456c --- /dev/null +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/tests/Scenario/EndpointTests.cs @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Threading.Tasks; +using Azure.Core.TestFramework; +using Azure.ResourceManager.Resources; +using Azure.ResourceManager.StorageMover.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.StorageMover.Tests.Scenario +{ + public class EndpointTests : StorageMoverManagementTestBase + { + public EndpointTests(bool isAsync) + : base(isAsync) //, RecordedTestMode.Record) + { + } + + [Test] + [RecordedTest] + public async Task CreateUpdateGetDeleteTest() + { + ResourceGroupResource resourceGroup = await GetResourceGroupAsync(ResourceGroupName); + StorageMoverCollection storageMovers = resourceGroup.GetStorageMovers(); + StorageMoverEndpointCollection endpoints = (await storageMovers.GetAsync(StorageMoverName)).Value.GetStorageMoverEndpoints(); + + string cEndpointName = Recording.GenerateAssetName("conendpoint-"); + string nfsEndpointName = Recording.GenerateAssetName("nfsendpoint-"); + string smbEndpointName = Recording.GenerateAssetName("smbendpoint-"); + string fsEndpointName = Recording.GenerateAssetName("fsendpoint-"); + string accountResourceId = DefaultSubscription.Id.ToString() + "/resourceGroups/" + ResourceGroupName + + "/providers/Microsoft.Storage/storageAccounts/" + StorageAccountName; + + // Create and get a container endpoint + AzureStorageBlobContainerEndpointProperties containerEndpointProperties = + new AzureStorageBlobContainerEndpointProperties(accountResourceId, ContainerName); + StorageMoverEndpointData data = new StorageMoverEndpointData(containerEndpointProperties); + data.Properties.Description = "New container endpoint"; + StorageMoverEndpointResource cEndpoint = (await endpoints.CreateOrUpdateAsync(WaitUntil.Completed, cEndpointName, data)).Value; + Assert.AreEqual(cEndpoint.Data.Name, cEndpointName); + Assert.AreEqual("AzureStorageBlobContainer", cEndpoint.Data.Properties.EndpointType.ToString()); + + StorageMoverEndpointResource cEndpoint2 = (await cEndpoint.GetAsync()).Value; + Assert.AreEqual(cEndpoint2.Data.Name, cEndpointName); + Assert.AreEqual(cEndpoint2.Data.Properties.EndpointType.ToString(), "AzureStorageBlobContainer"); + + cEndpoint = (await endpoints.GetAsync(cEndpointName)).Value; + Assert.AreEqual(cEndpoint.Data.Name, cEndpointName); + Assert.AreEqual("AzureStorageBlobContainer", cEndpoint.Data.Properties.EndpointType.ToString()); + + // Create and get a NFS endpoint + NfsMountEndpointProperties nfsMountEndpointProperties = new NfsMountEndpointProperties("10.0.0.1", "/"); + data = new StorageMoverEndpointData(nfsMountEndpointProperties); + data.Properties.Description = "New NFS endpoint"; + StorageMoverEndpointResource nfsEndpoint = (await endpoints.CreateOrUpdateAsync(WaitUntil.Completed, nfsEndpointName, data)).Value; + Assert.AreEqual(nfsEndpoint.Data.Name, nfsEndpointName); + Assert.AreEqual("NfsMount", nfsEndpoint.Data.Properties.EndpointType.ToString()); + Assert.AreEqual(((NfsMountEndpointProperties)nfsEndpoint.Data.Properties).Export, "/"); + Assert.AreEqual(((NfsMountEndpointProperties)nfsEndpoint.Data.Properties).Host, "10.0.0.1"); + + nfsEndpoint = (await endpoints.GetAsync(nfsEndpointName)).Value; + Assert.AreEqual(nfsEndpoint.Data.Name, nfsEndpointName); + Assert.AreEqual("NfsMount", nfsEndpoint.Data.Properties.EndpointType.ToString()); + Assert.AreEqual(((NfsMountEndpointProperties)nfsEndpoint.Data.Properties).Export, "/"); + Assert.AreEqual(((NfsMountEndpointProperties)nfsEndpoint.Data.Properties).Host, "10.0.0.1"); + + // Create, get, update and delete a SMB endpoint + SmbMountEndpointProperties smbMountEndpointProperties = new SmbMountEndpointProperties("10.0.0.1", "testshare"); + AzureKeyVaultSmbCredentials credentials = new AzureKeyVaultSmbCredentials + { + UsernameUriString = "https://examples-azureKeyVault.vault.azure.net/secrets/examples-username", + PasswordUriString = "https://examples-azureKeyVault.vault.azure.net/secrets/examples-password", + }; + data = new StorageMoverEndpointData(smbMountEndpointProperties); + smbMountEndpointProperties.Credentials = credentials; + data.Properties.Description = "New Smb mount endpoint"; + StorageMoverEndpointResource smbEndpoint = (await endpoints.CreateOrUpdateAsync(WaitUntil.Completed, smbEndpointName, data)).Value; + Assert.AreEqual(smbEndpoint.Data.Name, smbEndpointName); + Assert.AreEqual(smbEndpoint.Data.Properties.EndpointType.ToString(), "SmbMount"); + Assert.AreEqual(((SmbMountEndpointProperties)smbEndpoint.Data.Properties).Credentials.UsernameUriString, "https://examples-azureKeyVault.vault.azure.net/secrets/examples-username"); + Assert.AreEqual(((SmbMountEndpointProperties)smbEndpoint.Data.Properties).Credentials.PasswordUriString, "https://examples-azureKeyVault.vault.azure.net/secrets/examples-password"); + Assert.AreEqual(((SmbMountEndpointProperties)smbEndpoint.Data.Properties).Host, "10.0.0.1"); + Assert.AreEqual(((SmbMountEndpointProperties)smbEndpoint.Data.Properties).ShareName, "testshare"); + + smbEndpoint = (await endpoints.GetAsync(smbEndpointName)).Value; + Assert.AreEqual(smbEndpoint.Data.Name, smbEndpointName); + Assert.AreEqual(smbEndpoint.Data.Properties.EndpointType.ToString(), "SmbMount"); + Assert.AreEqual(((SmbMountEndpointProperties)smbEndpoint.Data.Properties).Credentials.UsernameUriString, "https://examples-azureKeyVault.vault.azure.net/secrets/examples-username"); + Assert.AreEqual(((SmbMountEndpointProperties)smbEndpoint.Data.Properties).Credentials.PasswordUriString, "https://examples-azureKeyVault.vault.azure.net/secrets/examples-password"); + Assert.AreEqual(((SmbMountEndpointProperties)smbEndpoint.Data.Properties).Host, "10.0.0.1"); + Assert.AreEqual(((SmbMountEndpointProperties)smbEndpoint.Data.Properties).ShareName, "testshare"); + + credentials.UsernameUriString = ""; + credentials.PasswordUriString = ""; + SmbMountEndpointUpdateProperties updateProperties = new SmbMountEndpointUpdateProperties + { + Credentials = credentials, + Description = "Update endpoint", + }; + StorageMoverEndpointPatch patch = new StorageMoverEndpointPatch + { + Properties = updateProperties, + }; + patch.Properties = updateProperties; + smbEndpoint = (await smbEndpoint.UpdateAsync(patch)).Value; + Assert.AreEqual(smbEndpoint.Data.Name, smbEndpointName); + Assert.AreEqual(smbEndpoint.Data.Properties.EndpointType.ToString(), "SmbMount"); + Assert.AreEqual(((SmbMountEndpointProperties)smbEndpoint.Data.Properties).Credentials.PasswordUriString, ""); + Assert.AreEqual(((SmbMountEndpointProperties)smbEndpoint.Data.Properties).Credentials.UsernameUriString, ""); + Assert.AreEqual(((SmbMountEndpointProperties)smbEndpoint.Data.Properties).Host, "10.0.0.1"); + Assert.AreEqual(((SmbMountEndpointProperties)smbEndpoint.Data.Properties).ShareName, "testshare"); + + await smbEndpoint.DeleteAsync(WaitUntil.Completed); + + // Create and get a file share endpoint + AzureStorageSmbFileShareEndpointProperties fileShareEndpointProperties = new AzureStorageSmbFileShareEndpointProperties(new Core.ResourceIdentifier(accountResourceId), "testfileshare"); + data = new StorageMoverEndpointData(fileShareEndpointProperties); + data.Properties.Description = "new file share endpoint"; + StorageMoverEndpointResource fsEndpoint = (await endpoints.CreateOrUpdateAsync(WaitUntil.Completed, fsEndpointName, data)).Value; + Assert.AreEqual(fsEndpoint.Data.Name, fsEndpointName); + Assert.AreEqual(fsEndpoint.Data.Properties.EndpointType.ToString(), "AzureStorageSmbFileShare"); + Assert.AreEqual(((AzureStorageSmbFileShareEndpointProperties)fsEndpoint.Data.Properties).FileShareName, "testfileshare"); + Assert.AreEqual(((AzureStorageSmbFileShareEndpointProperties)fsEndpoint.Data.Properties).Description, "new file share endpoint"); + + fsEndpoint = (await endpoints.GetAsync(fsEndpointName)).Value; + Assert.AreEqual(fsEndpoint.Data.Name, fsEndpointName); + Assert.AreEqual(fsEndpoint.Data.Properties.EndpointType.ToString(), "AzureStorageSmbFileShare"); + Assert.AreEqual(((AzureStorageSmbFileShareEndpointProperties)fsEndpoint.Data.Properties).FileShareName, "testfileshare"); + Assert.AreEqual(((AzureStorageSmbFileShareEndpointProperties)fsEndpoint.Data.Properties).Description, "new file share endpoint"); + + int counter = 0; + await foreach (StorageMoverEndpointResource _ in endpoints.GetAllAsync()) + { + counter++; + } + Assert.Greater(counter, 1); + + Assert.IsTrue(await endpoints.ExistsAsync(cEndpointName)); + Assert.IsFalse(await endpoints.ExistsAsync(cEndpointName + "111")); + Assert.IsFalse(await endpoints.ExistsAsync(smbEndpointName)); + } + } +}